# PPCGSolver¶

class PPCGSolver(absolute_tolerance=None, relative_tolerance=None, maximum_number_of_iterations=None, block_size=None, rr_period=None, buffer_states=None, initialization_method=None)

Density matrix method that uses a blocked preconditioned conjugate gradient algorithm to improve on an initial guess for the eigenstates of the Hamiltonian.

Parameters: absolute_tolerance (float) – The absolute tolerance up to which the residuals have to be converged for the algorithm to end. Default: 1.0e-8 relative_tolerance (float) – The tolerance up to which the residuals have to be converged relative to the original value of the residuals. Default: 1.0e-99 maximum_number_of_iterations – The maximum number of iterations to take. Given as a non-negative integer. Default: 2 block_size (int) – The size of the inner diagonalization problem that is to be solved i.e. how many states are coupled during the update in each iteration. Given as a positive integer. Default: 5 rr_period (int) – The Rayleigh-Ritz period, i.e. every ‘how many’ iterations we perform a full subspace diagonalization. Given as a positive integer. Default: maximum_number_of_iterations + 1 buffer_states (int) – Buffer states are states that are used in the optimization algorithm, but not used to check the convergence. They add stability to the algorithm if there are many near degenerate states and speed up the convergence of lower lying states. Given as a non-negative integer. Default: 0 initialization_method (RandomBlochWaveInitialization | BasisSetInitialization) – The method used to obtain the initial states for the Generalized Davidson algorithm, see Initialization methods. Default: BasisSetInitialization
absoluteTolerance()
Returns: The absolute tolerance up to which the residuals have to be converged for the algorithm to end. float
blockSize()
Returns: The size of the inner diagonalization problem that is to be solved. (i.e. How many states are coupled during the update in each iteration) int
bufferStates()
Returns: The number of buffer states. Buffer states are states that are used in the optimization algorithm, but not used to check the convergence. They add stability to the algorithm if there are many near degenerate states and speed up the convergence of lower lying states. int
initializationMethod()
Returns: The method used to obtain the initial states for the residual minimizer. RandomBlochWaveInitialization | BasisSetInitialization
maximumNumberOfIterations()
Returns: The maximum number of iterations for the ppcg algorithm. int
relativeTolerance()
Returns: The amount the residual of the states has to be reduced compared to the residual of the initial guess. float
rrPeriod()
Returns: The Rayleigh-Ritz period, i.e. every ‘how many’ iterations we perform a full subspace diagonalization. int

## Usage Example¶

Define a density matrix method that uses the default PPCGSolver:

algorithm_parameters = AlgorithmParameters(
density_matrix_method=PPCGSolver())


This will apply the settings we have found to generally lead to the fastest convergence of the SCF loop.

A more robust eigensolver can be defined, e.g.:

density_matrix_method = PPCGSolver(
relative_tolerance=0.001,
absolute_tolerance=1.0e-7,
maximal_number_of_iterations=100,
block_size=100,
rr_period=2)

algorithm_parameters = AlgorithmParameters(
density_matrix_method=density_matrix_method)


By increasing the block_size we slow down the algorithm but make the inner iterations more accurate. The parameters rr_period determines after how many iterations a subspace diagonalization is performed. By default this is chosen to be larger than the number of iterations so a subspace diagonalization will only be performed at the end. By doing this multiple times we can make the algorithm more stable.

A different initial guess for the states can be chosen by setting the initialization_method:

density_matrix_method = PPCGSolver(
initialization_method=RandomBlochWaveInitialization,
)

algorithm_parameters = AlgorithmParameters(
density_matrix_method=density_matrix_method)


## Notes¶

### Algorithm¶

The PPCGSolver class implements the projected preconditioned conjugate gradient algorithm (PPCG) as explained in [VYP15].

This method is a combination of a generalized davidson and a conjugate gradient method. The method has a better parallel scaling for large systems. In the example figures Fig. 134 and Fig. 135 we compare the performance and scaling of the PPCG algorithm against our default Generalized Davidson solver for a pristine 128 Si FCC system at the Gamma point.

Figure Fig. 134 shows the wall time for the number of processes going from 1 to 32. Figure Fig. 135 shows the speedup compared to the calculation run in serial.

 [VYP15] Eugene Vecharynski, Chao Yang, and John E. Pask. A projected preconditioned conjugate gradient algorithm for computing many extreme eigenpairs of a hermitian matrix. Journal of Computational Physics, 290:73 – 89, 2015. URL: http://www.sciencedirect.com/science/article/pii/S002199911500100X, doi:10.1016/j.jcp.2015.02.030.