PSCF v1.3.3
AmIteratorGrid

The AmIteratorGrid algorithm available to the pscf_pc or pscf_pg programs uses an Anderson mixing algorithm in which residual equations and field updates are formulated using values defined on the nodes of a regular spatial grid. The algorithm can be used to either solve the SCFT equations for a rigid unit cell or to solve the SCFT equations and also optimize the unit cell parameters of a flexible unit cell so as to minimize the free energy density. Closely analogous classes to implement this algorithm are defined in the Pscf::Rpc and Pscf::Rpg namespaces.

Class API documentation:

See also
Anderson mixing algorithms

Parameter file

The full format of an AmIteratorGrid parameter block is described below:

AmIteratorGrid{
epsilon real
maxItr* int (200 by default)
maxHist* int (50 by default0
verbose* int (0-2, 0 by default)
errorType* string ("norm", "rms", "max", or "relNorm", "relNorm" by default)
isFlexible* bool (0 or 1, 0/false by default)
scaleStress* real (10.0 by default)
lambda* real (1.0 by default)
useLambdaRamp* bool (true by default)
r* real (0.9 by default)
}

Here, as elsewhere, labels followed by an asterisk (*) represent optional parameters. The only required parmeter is the error tolerance, epsilon. The meaning of most of the other parameters is explained in a general discussion of Anderson mixing algorithms, and summarized below:

Label Description
epsilon error tolerance - iteration stops if the magnitude of the scalar error becomes less than epsilon.
maxItr* Maximum number of iterations that will be attempted (200 by default)
maxHist* Maximum number of previous trial solultions that will be retained in memory for used by the AM algorithm (50 by default)
verbose* Integer level 0-2 for verbosity of log output during iteration. (0 by default)
errorType* String identifer for the type of variable used to define scalar error . The only allowed values are "norm", "rms", "max", and "relNorm". ("relNorm" by default)
isFlexible* Set isFlexible true to enable or false to disable iterative optimization of the unit cell parameters so as to minimize the free energy. (True by default)
scaleStress* Constant factor by which stress components are multipled in the definition of the residual vector if isFlexible is true (10.0 by default).
lambda* Mixing parameter \( \lambda \) in a standard mixing correction step for an Anderson mixing algorithm. (1.0 by default)
useLambdaRamp* If true, use slow ramp-up of mixing parameter, as discussed here. (true by default)
r* Ratio \( r \) used in formula for ramp factor \( \alpha \) that multiplies the mixing parameter, as discussed here. (only allowed if useLambdaRamp is true, 0.9 by default)

The iterative loop exits if the number of iterations has reaches maxItr or if the magnitude of the scalar error drops below epsilon.

Residual definition

The AmIteratorGrid iterator uses a definition of the residual vector that is analogous to that used by AmIteratorBasis, except that residal elements are associated with grid points, rather than with coefficients of basis functions in a symmetry-adapted Fourier series. The residual vector is thus a real-space version of that described by Eqs. (10-13) of the article by Arora et al. (J. Chem. Phys. 2017). In what follows, we use zero based indexing for monomer types, and use \( N_{\rm m} \) to denote the number of monomer types (i.e., the parameter nMonomer).

Let \( w_{i}({\bf r}) \) and \( \phi_{i}({\bf r)} \) denote values of the chemical potential field and volume fraction for monomer type i at a grid point located at position \( {\bf r} \). The residual component \( R_{i}({\bf r})\) associated with grid point \( {\bf r} \) and monomer type i is given by

\[ R_{i}({\bf r}) = \sum_{j=0}^{N_{\rm m}-1} \left ( \chi_{ij} \phi_{j}({\bf r}) - P_{ij}w_{j}({\bf r}) \right ) \quad. \]

Here, \( P_{ij} \) is an element of an idempotent \( N_{\rm m} \times N_{\rm m} \) matrix \( P \) that can be expressed in matrix notation as

\[ P = I - \frac{\epsilon \epsilon^{T} \chi^{-1} } { \epsilon^{T} \chi^{-1} \epsilon } \quad. \]

where \( \chi^{-1} \) is the matrix inverse of the symmetric \( \chi \) matrix, and \(\epsilon\) is a \( N_{m} \)-component column vector with elements given by \( \epsilon_{i} = 1 \) for all \( i = 0, \ldots, N_{\rm m}-1 \).

The vector of residuals for a calculation with a flexible unit cell (when parameter isFleixble set true) has one additional stress residual associated with each flexible unit cell parameter. The residual \( R_{m} \) associated with flexible unit cell parameter \( \theta_{m} \) is given by

\[ R_{m} = -S\frac{\partial f}{\partial \theta_{m}} \]

where \( f \) is the free energy per monomer (i.e., the free energy density times the monomer reference volume) in units in which \( kT = 1 \), while \(S\) is an arbitrary prefactor whose value is given by the parameter scaleStress, which is set to 10.0 by default.