JDFTx  1.7.0
Pulay< Variable > Class Template Referenceabstract

Pulay mixing to optimize self-consistent field optimization . More...

#include <Pulay.h>

Public Member Functions

 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)
 

Protected Member Functions

virtual double cycle (double dEprev, std::vector< double > &extraValues)=0
 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...
 
virtual void report (int iter)
 Override to perform optional reporting.
 
virtual void axpy (double alpha, const Variable &X, Variable &Y) const =0
 Scaled accumulate on variable.
 
virtual double dot (const Variable &X, const Variable &Y) const =0
 Euclidean dot product. Metric applied separately for efficiency.
 
virtual size_t variableSize () const =0
 Number of bytes per variable.
 
virtual void readVariable (Variable &, FILE *) const =0
 Read variable from stream.
 
virtual void writeVariable (const Variable &, FILE *) const =0
 
virtual Variable getVariable () const =0
 Write variable to stream. More...
 
virtual Variable getResidual () const
 Get the current residual from state of system (override if not an SCF)
 
virtual void setVariable (const Variable &)=0
 Set the state of system to specified variable.
 
virtual Variable precondition (const Variable &) const =0
 Apply preconditioner to variable/residual.
 
virtual Variable applyMetric (const Variable &) const =0
 Apply metric to variable/residual.
 

Detailed Description

template<typename Variable>
class Pulay< Variable >

Pulay mixing to optimize self-consistent field optimization .

Member Function Documentation

◆ cycle()

template<typename Variable >
virtual double Pulay< Variable >::cycle ( double  dEprev,
std::vector< double > &  extraValues 
)
protectedpure virtual

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

Implemented in NonlinearPCM, and SCF.

◆ getVariable()

template<typename Variable >
virtual Variable Pulay< Variable >::getVariable ( ) const
protectedpure virtual

Write variable to stream.

Get the current variable from state of system

Implemented in NonlinearPCM, and SCF.

◆ minimize()

template<typename Variable >
double Pulay< Variable >::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.

Parameters
EprevInitial energy (optional)
extraNamesNames of extra convergence parameters to report and check every cycle
extraThreshThresholds for each extra convergence parameter
Returns
Energy at final cycle

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