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 (float) – 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 fraction of the number of occupied states between 0 and 1 (not inclusive). Default:
0.05
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.
- Return type:
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)
- Return type:
int
- bufferStates()¶
- Returns:
The number of buffer states, given as a fraction of the number of occupied 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.
- Return type:
float
- initializationMethod()¶
- Returns:
The method used to obtain the initial states for the residual minimizer.
- Return type:
RandomBlochWaveInitialization
|BasisSetInitialization
- maximumNumberOfIterations()¶
- Returns:
The maximum number of iterations for the ppcg algorithm.
- Return type:
int
- relativeTolerance()¶
- Returns:
The amount the residual of the states has to be reduced compared to the residual of the initial guess.
- Return type:
float
- rrPeriod()¶
- Returns:
The Rayleigh-Ritz period, i.e. every ‘how many’ iterations we perform a full subspace diagonalization.
- Return type:
int
- uniqueString()¶
Return a unique string representing the state of the object.
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 [1].
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 Absolute Scaling and Relative Scaling 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 Absolute Scaling shows the wall time for the number of processes going from 1 to 32. Figure Relative Scaling shows the speedup compared to the calculation run in serial.
Absolute Scaling¶
Relative Scaling¶