JDFTx  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NonlinearPCM Class Reference

Nonlinear solvation models: shared electrostatic part implementation. More...

#include <NonlinearPCM.h>

Inheritance diagram for NonlinearPCM:
PCM Minimizable< ScalarFieldMuEps > Pulay< ScalarFieldTilde > FluidSolver

Public Member Functions

 NonlinearPCM (const Everything &e, const FluidSolverParams &params)
 See createFluidSolver()
 
bool prefersGummel () const
 Specify whether fluid prefers a gummel loop (true) or is minimized each time (false)
 
void loadState (const char *filename)
 Load state from file.
 
void saveState (const char *filename) const
 Save state to file.
 
void dumpDensities (const char *filenamePattern) const
 
void minimizeFluid ()
 Converge using nonlinear conjugate gradients.
 
double operator() (const ScalarFieldMuEps &state, ScalarFieldMuEps &Adiel_state, ScalarFieldTilde *Adiel_rhoExplicitTilde=0, ScalarFieldTilde *Adiel_nCavityTilde=0, IonicGradient *forces=0) const
 Compute gradient and free energy (with optional outputs)
 
void step (const ScalarFieldMuEps &dir, double alpha)
 Move the state in parameter space along direction dir with scale alpha.
 
double compute (ScalarFieldMuEps *grad, ScalarFieldMuEps *Kgrad)
 Returns the objective function at the current state and store the gradient in grad and preconditioned gradient in Kgrad, if non-null.
 
- Public Member Functions inherited from PCM
 PCM (const Everything &e, const FluidSolverParams &fsp)
 
void dumpDensities (const char *filenamePattern) const
 dump cavity shape functions
 
void dumpDebug (const char *filenamePattern) const
 generate fluidDebug text file with common info to all PCMs
 
- Public Member Functions inherited from FluidSolver
 FluidSolver (const Everything &e, const FluidSolverParams &fsp)
 Any non-electrostatic contributions to A_rhoExplicitTilde (removed from dumped d_fluid / d_tot) More...
 
double ionWidthMuCorrection () const
 correction to electron chemical potential due to finite ion width in fluid interaction
 
bool useGummel () const
 
void set (const ScalarFieldTilde &rhoExplicitTilde, const ScalarFieldTilde &nCavityTilde)
 
double get_Adiel_and_grad (ScalarFieldTilde *Adiel_rhoExplicitTilde=0, ScalarFieldTilde *Adiel_nCavityTilde=0, IonicGradient *extraForces=0) const
 
virtual double bulkPotential ()
 
- Public Member Functions inherited from Minimizable< ScalarFieldMuEps >
virtual bool report (int iter)
 
virtual void constrain (ScalarFieldMuEps &)
 Constrain search directions to the space of free directions for minimize.
 
virtual double sync (double x) const
 Override to synchronize scalars over MPI processes (if the same minimization is happening in sync over many processes)
 
virtual double safeStepSize (const ScalarFieldMuEps &dir) const
 Override to return maximum safe step size along a given direction. Steps can be arbitrarily large by default.
 
double minimize (const MinimizeParams &params)
 Minimize this objective function with algorithm controlled by params and return the minimized value.
 
void fdTest (const MinimizeParams &params)
 
- Public Member Functions inherited from Pulay< ScalarFieldTilde >
 Pulay (const PulayParams &pp)
 
double minimize (double Eprev=+DBL_MAX, std::vector< string > extraNames=std::vector< string >(), std::vector< double > extraThresh=std::vector< double >())
 Minimize energy using a self-consistent iteration. More...
 
void loadState (const char *filename)
 Load the state from a single binary file.
 
void saveState (const char *filename) const
 Save the state to a single binary file.
 
void clearState ()
 remove past variables and residuals
 
virtual double sync (double x) const
 Override to synchronize scalars over MPI processes (if the same minimization is happening in sync over many processes)
 

Public Attributes

ScalarFieldMuEps state
 State of the solver = ion chemical potentials and effective local electric field.
 
- Public Attributes inherited from FluidSolver
const Everythinge
 
const GridInfogInfo
 
const FluidSolverParamsfsp
 
double epsBulk
 
double epsInf
 bulk dielectric constants of fluid
 
double k2factor
 prefactor to screening term (0 => no ionic screening)
 
std::vector< std::vector
< vector3<> > > 
atpos
 
ScalarFieldTilde A_rhoNonES
 atomic positions per species in the relevant coordinate system (depending on embedding option)
 

Protected Member Functions

void set_internal (const ScalarFieldTilde &rhoExplicitTilde, const ScalarFieldTilde &nCavityTilde)
 Fluid-dependent implementation of set()
 
double get_Adiel_and_grad_internal (ScalarFieldTilde &Adiel_rhoExplicitTilde, ScalarFieldTilde &Adiel_nCavityTilde, IonicGradient *extraForces) const
 Fluid-dependent implementation of get_Adiel_and_grad()
 
double cycle (double dEprev, std::vector< double > &extraValues)
 Single cycle of the self-consistency loop. In each subsequent cycle, Pulay will try to zero the difference between getVariable() before and after the cycle. The implementation should only do the work of computing the updated variable; debug printing and I/O, if any, should occur in report() instead. More...
 
void axpy (double alpha, const ScalarFieldTilde &X, ScalarFieldTilde &Y) const
 Scaled accumulate on variable.
 
double dot (const ScalarFieldTilde &X, const ScalarFieldTilde &Y) const
 Euclidean dot product. Metric applied separately for efficiency.
 
size_t variableSize () const
 Number of bytes per variable.
 
void readVariable (ScalarFieldTilde &X, FILE *fp) const
 Read variable from stream.
 
void writeVariable (const ScalarFieldTilde &X, FILE *fp) const
 
ScalarFieldTilde getVariable () const
 Write variable to stream. More...
 
void setVariable (const ScalarFieldTilde &)
 Set the state of system to specified variable.
 
ScalarFieldTilde precondition (const ScalarFieldTilde &) const
 Apply preconditioner to variable/residual.
 
ScalarFieldTilde applyMetric (const ScalarFieldTilde &) const
 Apply metric to variable/residual.
 
- Protected Member Functions inherited from PCM
virtual void printDebug (FILE *fp) const
 over-ride to get extra PCM-specific output in fluidDebug text file
 
void updateCavity ()
 update shape function(s) from nCavity, and energies dependent upon shape alone
 
void propagateCavityGradients (const ScalarFieldArray &A_shape, ScalarField &A_nCavity, ScalarFieldTilde &A_rhoExplicitTilde, IonicGradient *forces) const
 
void accumExtraForces (IonicGradient *forces, const ScalarFieldTilde &A_nCavityTilde) const
 Accumulate extra fluid forces (vdw and full-core forces, when applicable)
 
ScalarFieldTilde getFullCore () const
 get full core correction for PCM variants that need them
 
- Protected Member Functions inherited from Pulay< ScalarFieldTilde >
virtual void report (int iter)
 Override to perform optional reporting.
 

Additional Inherited Members

- Static Protected Member Functions inherited from PCM
static ScalarFieldTilde coulomb (const ScalarFieldTilde &rho)
 
- Protected Attributes inherited from PCM
EnergyComponents Adiel
 PCM energy components.
 
ScalarFieldTilde rhoExplicitTilde
 Charge density of explicit (electronic) system.
 
ScalarField nCavity
 
ScalarField tauCavity
 
ScalarField nCavityEx [2]
 Cavity determining electron density (or product for SaLSA, or KE density for SG14tauVW, and expanded electron densities for the SGA13 variant)
 
ScalarFieldArray shape
 Electrostatic cavity shape function. Second component, if any, is separate ionic cavity.
 
ScalarField shapeVdw
 Separate cavitation/dispersion shape function for the SGA13 variant.
 
std::vector< RadialFunctionGSf
 spherically-averaged structure factors for each solvent site
 
std::vector< int > atomicNumbers
 atomic number for each solvent site (for dispersion interactions)
 

Detailed Description

Nonlinear solvation models: shared electrostatic part implementation.

Member Function Documentation

double NonlinearPCM::cycle ( double  dEprev,
std::vector< double > &  extraValues 
)
protectedvirtual

Single cycle of the self-consistency loop. In each subsequent cycle, Pulay will try to zero the difference between getVariable() before and after the cycle. The implementation should only do the work of computing the updated variable; debug printing and I/O, if any, should occur in report() instead.

Parameters
dEprevenergy change at previous cycle, which may be used to adjust accuracy of any inner optimizations
extraValuesSpecify the values of any extra convergence parameters specified in minimize()
Returns
Energy at end of cycle

Implements Pulay< ScalarFieldTilde >.

void NonlinearPCM::dumpDensities ( const char *  filenamePattern) const
virtual

Dump relevant fluid densities (eg. NO and NH) to file(s) the provided pattern will have a single s which may be substituted Fluid solver implementations may override to dump fluid densities, no dumping by default

Reimplemented from FluidSolver.

ScalarFieldTilde NonlinearPCM::getVariable ( ) const
protectedvirtual

Write variable to stream.

Get the current variable from state of system

Implements Pulay< ScalarFieldTilde >.


The documentation for this class was generated from the following file: