davidson_solver¶
- psi4.driver.p4util.davidson_solver(engine, guess, *, nroot, r_convergence=0.0001, max_ss_size=100, maxiter=60, verbose=1, nonneg_only=False)[source]¶
Solves for the lowest few eigenvalues and eigenvectors of a large problem emulated through an engine.
If the large matrix A has dimension {NxN} and N is very large, and only a small number of roots, k are desired this algorithm is preferable to standard methods as uses on the order of N * k memory. One only needs to have the ability to compute the product of a times a vector.
For non-hermitan A the basis of the algorithm breaks down. However in practice, for strongly diagonally-dominant A such as the similarity-transformed Hamiltonian in EOM-CC this algorithm is commonly still used.
- Parameters:
engine (
Type
[SolverEngine
]) – The engine drive all operations involving data structures that have at least one “large” dimension. SeeSolverEngine
for requirementsguess (
List
) – list {engine dependent} At least nroot initial expansion vectorsnroot (
int
) – Number of roots desiredr_convergence (
float
) – Convergence tolerance for residual vectorsmax_ss_size (
int
) – The maximum number of trial vectors in the iterative subspace that will be stored before a collapse is done.maxiter (
int
) – The maximum number of iterationsverbose (
int
) – The amount of logging info to print (0 -> none, 1 -> some, >1 -> everything)nonneg_only (
bool
) – Should eigenpairs with eigenvalue < 0 be ignored?
- Return type:
- Returns:
best_values (numpy.ndarray) – (nroots, ) The best approximation of the eigenvalues of A, computed on the last iteration of the solver
best_vectors (List[vector]) – (nroots) The best approximation of the eigenvectors of A, computed on the last iteration of the solver
stats (List[Dict]) – Statistics collected on each iteration
count : int, iteration number
res_norm : np.ndarray (nroots, ), the norm of residual vector for each roots
val : np.ndarray (nroots, ), the eigenvalue corresponding to each root
delta_val : np.ndarray (nroots, ), the change in eigenvalue from the last iteration to this ones
collapse : bool, if a subspace collapse was performed
product_count : int, the running total of product evaluations that was performed
done : bool, if all roots were converged
Notes
The solution vector is normalized to 1/2
The solver will return even when maxiter iterations are performed without convergence. The caller must check
stats[-1]['done']
for failure and handle each case accordingly.