# GeneralizedDavidsonSolver¶

class GeneralizedDavidsonSolver(absolute_tolerance=None, relative_tolerance=None, maximum_number_of_restarts=None, initialization_method=None)

Iterative eigensolver that uses a blocked generalized Davidson 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. relative_tolerance (float) – The amount the residual of the states has to be reduced compared to the residual of the initial guess. The reduction factor must be between 0.0 and 1.0. Default: 0.3 maximum_number_of_restarts (int) – The maximum number of restarts in the Davidson algorithm. Must be a positive 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
initializationMethod()
Returns: The method used to obtain the initial states for the residual minimizer. RandomBlochWaveInitialization | BasisSetInitialization
maximumNumberOfRestarts()
Returns: The maximum number of restarts in the Davidson algorithm. int
relativeTolerance()
Returns: The amount the residual of the states has to be reduced compared to the residual of the initial guess. float

## Usage Example¶

Define a density matrix method that uses the default GeneralizedDavidsonSolver:

algorithm_parameters = AlgorithmParameters(
density_matrix_method=GeneralizedDavidsonSolver())


A more robust eigensolver can be defined by tightening the tolerances and increasing the maximum_number_of_restarts.

density_matrix_method = GeneralizedDavidsonSolver(
relative_tolerance=0.001,
absolute_tolerance=1.0e-7,
maximum_number_of_restarts=4)

algorithm_parameters = AlgorithmParameters(
density_matrix_method=density_matrix_method)


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

density_matrix_method = GeneralizedDavidsonSolver(
initialization_method=RandomBlochWaveInitialization,
)

algorithm_parameters = AlgorithmParameters(
density_matrix_method=density_matrix_method)


## Notes¶

### Algorithm¶

The class implements the blocked generalized Davidson algorithm [Dav75], [MS86]. It is the default eigensolver for plane wave calculations.

One can increase the stability of the algorithm by lowering the relative_factor, which determines how much the residual of the current guess for the eigenstates has to be reduced in this SCF step. One can also use the absolute_tolerance keyword, which determines how small the norm of the residuals of the wave functions need to be. At the same time one should increase the maximum_number_of_restarts, which determines how many restarts are allowed. When a restart is performed, a new generalized Davidson optimization is started with the current best guess for the eigenstates as starting vectors.

 [Dav75] Ernest R. Davidson. The iterative calculation of a few of the lowest eigenvalues and corresponding eigenvectors of large real-symmetric matrices. Journal of Computational Physics, 17(1):87 – 94, 1975. doi:http://dx.doi.org/10.1016/0021-9991(75)90065-0.
 [MS86] Ronald B. Morgan and David S. Scott. Generalizations of davidson’s method for computing eigenvalues of sparse symmetric matrices. SIAM Journal on Scientific and Statistical Computing, 7(3):817–825, 1986. doi:10.1137/0907054.