forte2.helpers.davidsonliu#
Module Contents#
- class forte2.helpers.davidsonliu.DavidsonLiuSolver(size: int, nroot: int, basis_per_root: int = 4, collapse_per_root: int = 2, maxiter: int = 100, e_tol: float = 1e-12, r_tol: float = 1e-06, eta: float | None = None, log_level: int = logger.get_verbosity_level(), dtype: type = np.float64)#
Davidson-Liu solver for iterative diagonalization of Hermitian matrices.
- Parameters:
- sizeint
Dimension of the matrix / number of basis vectors.
- nrootint
Number of roots to find.
- basis_per_rootint, optional, default=4
Number of basis vectors to keep per root.
- collapse_per_rootint, optional, default=2
Number of vectors to collapse to per root.
- maxiterint, optional, default=100
Maximum number of iterations to perform.
- e_tolfloat, optional, default=1e-12
Convergence tolerance for eigenvalues.
- r_tolfloat, optional, default=1e-6
Convergence tolerance for residuals.
- etafloat, optional
Target eigenvalue shift for sorting eigenpairs. If None, no shift is applied.
- log_levelint, optional, default=logger.get_verbosity_level()
Logging level for output messages.
- dtypetype, optional, default=np.float64
Data type of the matrix to diagonalize. Must be float or complex.
- Attributes:
- iterint
Current iteration number.
- convergedbool
Whether the solver has converged.
- size#
- nroot#
- collapse_per_root = 2#
- basis_per_root = 4#
- maxiter = 100#
- e_tol = 1e-12#
- r_tol = 1e-06#
- eta = None#
- log_level = 3#
- dtype#
- collapse_size#
- max_subspace_size#
- b#
- sigma#
- r#
- h_diag = None#
- G#
- alpha#
- lam#
- lam_old#
- schmidt_discard_threshold = 1e-07#
- schmidt_orthogonality_threshold = 1e-12#
- basis_size = 0#
- sigma_size = 0#
- add_sigma_builder(sigma_builder)#
Add the function that builds the matrix-vector product.
- Parameters:
- sigma_buildercallable
This function should have signature
sigma_builder(basis_block, sigma_block) -> None, wherebasis_block.shape == (size, m)andsigma_block.shape == (size, m). and it modifiessigma_blockin place, performing the operationsigma_block = matrix @ basis_block.
- add_h_diag(h_diag)#
- add_guesses(guesses)#
Add initial guesses for the eigenvectors.
- Parameters:
- guesses: NDArray
guesses.shape == (size, n_guess), with n_guess between 1 and subspace_size.
- add_project_out(project_out)#
project_out: list of arrays each shape (size,)
- solve()#
- add_rows_and_orthonormalize(A_existing: numpy.ndarray, B_candidates: numpy.ndarray, A_slots: numpy.ndarray) int#
Add candidate column vectors from B_candidates into A_slots, using iterative orthogonalization per vector. Returns the number of columns added.
- orthonormality_check(b: numpy.ndarray, msg: str = 'Orthonormality check failed.')#
Check if the columns of b are orthonormal.