PSCF v1.3
|
Rpg implementation of the Anderson Mixing iterator. More...
#include <AmIteratorBasis.h>
Public Member Functions | |
AmIteratorBasis (System< D > &system) | |
Constructor. | |
~AmIteratorBasis () | |
Destructor. | |
void | readParameters (std::istream &in) |
Read all parameters and initialize. | |
void | outputTimers (std::ostream &out) const |
Output timing results to log file. | |
Public Member Functions inherited from Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > > | |
AmIteratorTmpl () | |
Constructor. | |
~AmIteratorTmpl () | |
Destructor. | |
void | readParameters (std::istream &in) |
Read all parameters and initialize. | |
int | solve (bool isContinuation=false) |
Iterate to a solution. | |
void | outputTimers (std::ostream &out) const |
Log output timing results. | |
void | clearTimers () |
Clear timers. | |
std::string | errorType () const |
Obtain error type. |
Protected Member Functions | |
void | setup (bool isContinuation) |
Setup iterator just before entering iteration loop. | |
template<typename Type> | |
ScalarParam< Type > & | readOptional (std::istream &in, const char *label, Type &value) |
Add and read a new optional ScalarParam < Type > object. | |
void | readParamCompositeOptional (std::istream &in, ParamComposite &child, bool next=true) |
Add and attempt to read an optional child ParamComposite. | |
template<typename Type, int N> | |
FSArrayParam< Type, N > & | readOptionalFSArray (std::istream &in, const char *label, FSArray< Type, N > &array, int size) |
Add and read an optional FSArray < Type, N > array parameter. | |
void | setClassName (const char *className) |
Set class name string. | |
Protected Member Functions inherited from Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > > | |
void | setMaxItr (int maxItr) |
Set value of maxItr. | |
void | setMaxHist (int maxHist) |
Set value of maxHist (number of retained previous states) | |
void | setErrorType (std::string errorType) |
Set and validate value of errorType string. | |
void | readErrorType (std::istream &in) |
Read and validate the optional errorType string parameter. | |
virtual bool | isValidErrorType () |
Checks if a string is a valid error type. | |
virtual double | norm (DArray< double > const &hist) |
Find the L2 norm of a vector. | |
void | allocateAM () |
Allocate memory required by AM algorithm, if necessary. | |
virtual void | clear () |
Clear information about history. | |
virtual double | computeError (DArray< double > &residTrial, DArray< double > &fieldTrial, std::string errorType, int verbose) |
Compute and return error used to test for convergence. | |
virtual double | computeLambda (double r) |
Compute mixing parameter for correction step of Anderson mixing. | |
DArray< double > const & | residual () const |
Return the current residual vector by const reference. | |
DArray< double > const & | field () const |
Return the current field or state vector by const reference. | |
int | verbose () const |
Verbosity level, allowed values 0, 1, or 2. | |
int | totalItr () |
Return the total number of iterations needed to converge. | |
double | timerTotal () |
Get total time. | |
double | timerMDE () |
Get time solving modified diffusion equation (MDE). | |
double | timerAM () |
Get total time for AM algorithm, excluding MDE solution. | |
double | timerResid () |
Get time computing residual. | |
double | timerError () |
Get time evaluating scalar error. | |
double | timerCoeff () |
Get time evaluating Anderson mixing coefficients. | |
double | timerOmega () |
Get time updating w fields. | |
bool | isAllocatedAM () const |
Have data structures required by the AM algorithm been allocated? |
Additional Inherited Members | |
Protected Attributes inherited from Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > > | |
std::string | errorType_ |
Type of error criterion used to test convergence. |
Rpg implementation of the Anderson Mixing iterator.
Definition at line 32 of file rpg/scft/iterator/AmIteratorBasis.h.
Pscf::Rpg::AmIteratorBasis< D >::AmIteratorBasis | ( | System< D > & | system | ) |
Constructor.
system | parent system object |
Definition at line 31 of file rpg/scft/iterator/AmIteratorBasis.tpp.
References setClassName().
Pscf::Rpg::AmIteratorBasis< D >::~AmIteratorBasis | ( | ) |
Destructor.
Definition at line 40 of file rpg/scft/iterator/AmIteratorBasis.tpp.
void Pscf::Rpg::AmIteratorBasis< D >::readParameters | ( | std::istream & | in | ) |
Read all parameters and initialize.
in | input filestream |
Definition at line 45 of file rpg/scft/iterator/AmIteratorBasis.tpp.
References Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >::AmIteratorTmpl(), Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >::readErrorType(), readOptional(), readOptionalFSArray(), readParameters(), and UTIL_CHECK.
Referenced by readParameters().
void Pscf::Rpg::AmIteratorBasis< D >::outputTimers | ( | std::ostream & | out | ) | const |
Output timing results to log file.
out | output stream for timer report |
Definition at line 89 of file rpg/scft/iterator/AmIteratorBasis.tpp.
References Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >::AmIteratorTmpl(), and outputTimers().
Referenced by outputTimers().
|
protectedvirtual |
Setup iterator just before entering iteration loop.
isContinuation | Is this a continuation within a sweep? |
Reimplemented from Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >.
Definition at line 101 of file rpg/scft/iterator/AmIteratorBasis.tpp.
References Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >::AmIteratorTmpl(), and setup().
Referenced by setup().
|
inlineprotected |
Add and read a new optional ScalarParam < Type > object.
This is equivalent to ScalarParam<Type>(in, label, value, false).
in | input stream for reading |
label | Label string |
value | reference to new ScalarParam< Type > |
Definition at line 319 of file ParamComposite.h.
Referenced by readParameters().
|
protected |
Add and attempt to read an optional child ParamComposite.
in | input stream for reading |
child | child ParamComposite object |
next | true if the indent level is one higher than parent. |
Definition at line 292 of file ParamComposite.cpp.
|
inlineprotected |
Add and read an optional FSArray < Type, N > array parameter.
in | input stream for reading |
label | Label string for new array |
array | FSArray object |
size | logical size of array |
Definition at line 427 of file ParamComposite.h.
Referenced by readParameters().
|
protected |
Set class name string.
Should be set in subclass constructor.
Definition at line 900 of file ParamComposite.cpp.
Referenced by AmIteratorBasis().