forte2.helpers.davidsonliu#

Module Contents#

class forte2.helpers.davidsonliu.DavidsonLiuSolver#

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.

davidson_liu_paramsDavidsonLiuParams, optional

Parameters for the Davidson-Liu solver.

energy_shiftfloat, 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: int#
nroot: int#
davidson_liu_params: forte2.base_classes.params.DavidsonLiuParams#
energy_shift: float = None#
log_level: int#
dtype: type#
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, where basis_block.shape == (size, m) and sigma_block.shape == (size, m). and it modifies sigma_block in place, performing the operation sigma_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)#

Add vectors to project out during the solve.

Parameters:
project_out: list of arrays

Each array should have the same dtype and shape, but can have lengths less than or equal to size. The vectors will be orthogonalized and stored as rows for projection during the solve. If the lengths are less than size, they will be considered to be zero-padded to size during projection.

do_project_out(A)#
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.