Implementation

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 $N_{\text{Pulay}} \times \text{No. of reciprocal space grid
points}$ were added, one for storing the preconditioned residuals on real space grid: $\fftinv\left(G \tilde{R}[\rho_{\text{in}}^i]\right)(\vec{r})$ and one for storing the covariant residuals for the wave-dependent metric on real space grid: $\fftinv\left(\frac{q^2 +
q_1^2}{q^2}
\tilde{R}[\tilde{\rho}_{\text{in}}^i]\right)(\vec{r})$. Note that here $\fftinv{}$ 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 $N_{\text{Pulay}}$ 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 $A_{ij}$--acting as the contravariant part of the inner product.

Three subroutines were added to the original hartree_module in 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.


\begin{algorithm}
% latex2html id marker 187\caption{Subroutine \texttt{kerke...
...ate $\var{FR_kerker}$ and $\var{FR_wdmetric}$
\end{algorithmic}\end{algorithm}

Pseudocode algorithm 1 gives a rough schematic for subroutine kerker_and_wdmetric. The subroutines kerker and 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 $\var{FR_kerker}$ and $\var{FR_wdmetric}$ (see algorithm 1) are stored in the correct Pulay history slots in the $\fftinv\left(G \tilde{R}[\rho_{\text{in}}^i]\right)(\vec{r})$ and $\fftinv\left(\frac{q^2 +
q_1^2}{q^2}
\tilde{R}[\tilde{\rho}_{\text{in}}^i]\right)(\vec{r})$ arrays 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