PSCF v1.4.0
Pscf::Rp::AmIteratorBasis< D, T > Class Template Reference

Anderson Mixing iterator with imposed space-group symmetry. More...

#include <AmIteratorBasis.h>

Inheritance diagram for Pscf::Rp::AmIteratorBasis< D, T >:
Pscf::AmIteratorTmpl< T::Iterator, DArray< double > >

Public Types

using IteratorT = typename T::Iterator
 Alias for iterator type.
using VectorT = DArray<double>
 Alias for type of residual and state vectors.
using AmIterTmplT = AmIteratorTmpl< IteratorT, VectorT >
 Alias for base class.

Public Member Functions

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::AmIteratorTmpl< T::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

 AmIteratorBasis (typename T::System &system)
 Constructor.
virtual ~AmIteratorBasis ()
 Destructor.
void setup (bool isContinuation) override
 Setup iterator just before entering iteration loop.
Protected Member Functions inherited from Pscf::AmIteratorTmpl< T::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 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< T::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.

Detailed Description

template<int D, class T>
class Pscf::Rp::AmIteratorBasis< D, T >

Anderson Mixing iterator with imposed space-group symmetry.

This variant of the Anderson mixing algorithm uses an expansion in symmetry-adapted Fourier basis functions to represent all fields, thus automatically imposing a user-specified space group symmetry. Specializations of this class template are used as base classes for two closely analogous class templates, also named AmIteratorBasis, that are defined in Rpc and Rpg namespaces and used in the pscf_rpc and pscf_rpg programs, respectively.

Template parameters:

See also
Manual Page
AM Iteration Algorithm

Definition at line 42 of file scft/iterator/AmIteratorBasis.h.

Member Typedef Documentation

◆ IteratorT

template<int D, class T>
using Pscf::Rp::AmIteratorBasis< D, T >::IteratorT = typename T::Iterator

Alias for iterator type.

Definition at line 49 of file scft/iterator/AmIteratorBasis.h.

◆ VectorT

template<int D, class T>
using Pscf::Rp::AmIteratorBasis< D, T >::VectorT = DArray<double>

Alias for type of residual and state vectors.

Definition at line 52 of file scft/iterator/AmIteratorBasis.h.

◆ AmIterTmplT

template<int D, class T>
using Pscf::Rp::AmIteratorBasis< D, T >::AmIterTmplT = AmIteratorTmpl< IteratorT, VectorT >

Alias for base class.

Definition at line 55 of file scft/iterator/AmIteratorBasis.h.

Constructor & Destructor Documentation

◆ AmIteratorBasis()

template<int D, class T>
Pscf::Rp::AmIteratorBasis< D, T >::AmIteratorBasis ( typename T::System & system)
protected

Constructor.

Parameters
systemSystem object associated with this iterator.

Definition at line 34 of file AmIteratorBasis.tpp.

References Util::ParamComposite::setClassName().

◆ ~AmIteratorBasis()

template<int D, class T>
Pscf::Rp::AmIteratorBasis< D, T >::~AmIteratorBasis ( )
protectedvirtual

Destructor.

Definition at line 48 of file AmIteratorBasis.tpp.

Member Function Documentation

◆ readParameters()

template<int D, class T>
void Pscf::Rp::AmIteratorBasis< D, T >::readParameters ( std::istream & in)
overridevirtual

Read all parameters and initialize.

Parameters
ininput filestream

Reimplemented from Pscf::AmIteratorTmpl< T::Iterator, DArray< double > >.

Definition at line 55 of file AmIteratorBasis.tpp.

References Pscf::AmIteratorTmpl< IteratorT, VectorT >::readErrorType(), and Pscf::AmIteratorTmpl< IteratorT, VectorT >::readParameters().

◆ outputTimers()

template<int D, class T>
void Pscf::Rp::AmIteratorBasis< D, T >::outputTimers ( std::ostream & out) const
override

Output timing results to log file.

Parameters
outoutput stream for timer report

Definition at line 110 of file AmIteratorBasis.tpp.

References Pscf::AmIteratorTmpl< IteratorT, VectorT >::outputTimers().

◆ setup()

template<int D, class T>
void Pscf::Rp::AmIteratorBasis< D, T >::setup ( bool isContinuation)
overrideprotectedvirtual

Setup iterator just before entering iteration loop.

Parameters
isContinuationIs this a continuation within a sweep?

Reimplemented from Pscf::AmIteratorTmpl< T::Iterator, DArray< double > >.

Definition at line 121 of file AmIteratorBasis.tpp.

References Pscf::AmIteratorTmpl< IteratorT, VectorT >::setup().


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