To implement both Kerker preconditioning and wave-dependent metric method into CONQUEST we note that both involves at least two Fourier transforms (to transform into reciprocal space and then back). It is therefore ideal if we can add the Kerker preconditioning and the wave-dependent weight at the same time while we are working inside the reciprocal space. Two additional arrays of the dimensions were added, one for storing the preconditioned residuals on real space grid: and one for storing the covariant residuals for the wave-dependent metric on real space grid: . Note that here denotes the inverse Fourier transform.
It is possible to save the memory and calculate the preconditioned and the covariant residuals for every Pulay history and then accumulate in the Pulay mixing procedure (see equation (1)). However since CONQUEST is a code optimised for parallel calculation with many processors and Fourier transformation is a very communication intensive procedure, such approach would mean we have to do two Fourier transforms for every of the Pulay histories for every history summation loop in equation (1), and this would result a very inefficient code. By introducing two additional arrays to the code we minimise communications required for performing Fourier transforms. Note also that the original histories of the residual are still required because they are still needed in the calculation of the metric --acting as the contravariant part of the inner product.
Three subroutines were added to the original
the CONQUEST source code. Subroutine
kerker is for
self-consistent calculation using Kerker preconditioning only,
wdmetric is for using wave-dependent metric only and
kerker_and_wdmetric is for using both.
Pseudocode algorithm 1 gives a rough schematic for
kerker_and_wdmetric. The subroutines
wdmetric are similar with the relevant parts omitted (for
kerker the parts with wave-dependent metric will be omitted and
vice versa for
wdmetric). One of the subroutines is called
depending on user input (whether to use Kerker preconditioning or
wave-dependent metric or both) for every new residual, and the results
from the temporary arrays
(see algorithm 1) are stored in the correct Pulay history
slots in the
respectively. The preconditioned and covariant residuals are then used
in the normal Pulay mixing routine already implemented in
CONQUEST, replacing the appropriate Pulay history residuals.
Lianheng Tong 2011-03-02