PSCF v1.3.2
|
Anderson Mixing iterator on grid (no space-group symmetry). More...
#include <AmIteratorGrid.h>
Public Types | |
using | AmTmpl = AmIteratorTmpl< Iterator<D>, DArray<double> > |
Alias for indirect base (grandparent) class. | |
Public Types inherited from Pscf::AmIteratorDArray< Iterator< D > > | |
using | AmTmpl |
Alias for base class template. |
Public Member Functions | |
AmIteratorGrid (System< D > &system) | |
Constructor. | |
~AmIteratorGrid () | |
Destructor. | |
void | readParameters (std::istream &in) override |
Read all parameters and initialize. | |
void | outputTimers (std::ostream &out) const override |
Output timing results to log file. | |
Public Member Functions inherited from Pscf::AmIteratorDArray< Iterator< D > > | |
AmIteratorDArray ()=default | |
Constructor. | |
~AmIteratorDArray ()=default | |
Destructor. | |
Public Member Functions inherited from Pscf::AmIteratorTmpl< Iterator, DArray< double > > | |
AmIteratorTmpl () | |
Constructor. | |
~AmIteratorTmpl () | |
Destructor. | |
int | solve (bool isContinuation=false) |
Iterate to a solution. | |
void | outputTimers (std::ostream &out) const |
Log output timing results. | |
void | clearTimers () |
Clear timers. |
Protected Member Functions | |
void | setup (bool isContinuation) override |
Setup iterator just before entering iteration loop. | |
int | verbose () const |
Verbosity level, allowed values 0, 1, or 2. | |
DArray< double > const & | residual () const |
Get the current residual vector by const reference. | |
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. | |
Protected Member Functions inherited from Pscf::AmIteratorTmpl< Iterator, DArray< double > > | |
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. | |
void | readMixingParameters (std::istream &in, bool useLambdaRamp=true) |
Read optional parameters used in default correction algorithm. | |
void | allocateAM () |
Allocate memory required by AM algorithm, if necessary. | |
bool | isAllocatedAM () const |
Have data structures required by the AM algorithm been allocated? | |
virtual void | clear () |
Clear information about history. | |
virtual double | computeError (DArray< double > &residTrial, DArray< double > &stateTrial, std::string errorType, int verbose) |
Compute and return error used to test for convergence. | |
double | computeError (int verbose) |
Compute and return error used to test for convergence. | |
double | lambdaRampFactor () |
Compute ramped prefactor of mixing parameter lambda. | |
virtual double | computeLambda () |
Compute mixing parameter for correction step of Anderson mixing. | |
int | verbose () const |
Verbosity level, allowed values 0, 1, or 2. | |
std::string | errorType () const |
Get error type string. | |
DArray< double > const & | residual () const |
Get the current residual vector by const reference. | |
DArray< double > const & | state () const |
Return the current state vector by const reference. | |
int | totalItr () |
Return the total number of iterations needed to converge. | |
double | timerTotal () |
Get total time. | |
double | timerMDE () |
Get time spent solving the modified diffusion equation (MDE). | |
double | timerAM () |
Get total time for AM algorithm, excluding MDE solution. | |
double | timerResid () |
Get time spent computing residual. | |
double | timerError () |
Get time evaluating scalar error. | |
double | timerCoeff () |
Get time spent evaluating Anderson mixing coefficients. | |
double | timerOmega () |
Get time spent updating w states. |
Additional Inherited Members | |
Protected Attributes inherited from Pscf::AmIteratorTmpl< Iterator, DArray< double > > | |
double | epsilon_ |
Error tolerance. | |
int | maxItr_ |
Maximum number of iterations to attempt. | |
int | maxHist_ |
Maximum number of basis vectors in AM algorithm. | |
int | verbose_ |
Verbosity level. | |
std::string | errorType_ |
Type of error criterion used to test convergence. |
Anderson Mixing iterator on grid (no space-group symmetry).
Definition at line 39 of file rpc/scft/iterator/AmIteratorGrid.h.
using Pscf::Rpc::AmIteratorGrid< D >::AmTmpl = AmIteratorTmpl< Iterator<D>, DArray<double> > |
Alias for indirect base (grandparent) class.
Definition at line 71 of file rpc/scft/iterator/AmIteratorGrid.h.
Pscf::Rpc::AmIteratorGrid< D >::AmIteratorGrid | ( | System< D > & | system | ) |
Constructor.
system | System object associated with this iterator. |
Definition at line 38 of file rpc/scft/iterator/AmIteratorGrid.tpp.
References Util::ParamComposite::setClassName().
Pscf::Rpc::AmIteratorGrid< D >::~AmIteratorGrid | ( | ) |
Destructor.
Definition at line 49 of file rpc/scft/iterator/AmIteratorGrid.tpp.
|
overridevirtual |
Read all parameters and initialize.
in | input filestream |
Reimplemented from Pscf::AmIteratorTmpl< Iterator, DArray< double > >.
Definition at line 56 of file rpc/scft/iterator/AmIteratorGrid.tpp.
References Pscf::Prdc::UnitCellBase< D >::nParameter(), Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >::readErrorType(), Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >::readMixingParameters(), readOptional(), readOptionalFSArray(), Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >::readParameters(), and UTIL_CHECK.
|
override |
Output timing results to log file.
out | output stream for timer report |
Definition at line 108 of file rpc/scft/iterator/AmIteratorGrid.tpp.
References Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >::outputTimers().
|
overrideprotectedvirtual |
Setup iterator just before entering iteration loop.
isContinuation | Is this a continuation within a sweep? |
Reimplemented from Pscf::AmIteratorTmpl< Iterator, DArray< double > >.
Definition at line 119 of file rpc/scft/iterator/AmIteratorGrid.tpp.
References Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >::setup().
|
protected |
Verbosity level, allowed values 0, 1, or 2.
|
protected |
Get the current residual vector by const reference.
|
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().