qrunch.chemistry.subspace_diagonalization.subspace_diagonalizer_protocols

Protocol for diagonalizing a Hamiltonian in a sampled determinant subspace.

Classes

SubspaceDiagonalizer

Protocol for computing the lowest eigenvalue of a Hamiltonian projected onto a determinant subspace.

class SubspaceDiagonalizer

Bases: Protocol

Protocol for computing the lowest eigenvalue of a Hamiltonian projected onto a determinant subspace.

Implementations hold (or reference) the Hamiltonian and diagonalize it in the subspace spanned by the given Slater determinants. Different implementations trade off accuracy and cost, e.g. a dense Slater-Condon build followed by a sparse eigensolver, or a matrix-free Davidson procedure.

__init__(*args, **kwargs)
compute_overlap_with_neighboring_states(bitstring: int, *, paired_electron_approximation: bool, return_max_n_overlaps: int = 1000) dict[int, float]

Return the Hamiltonian matrix element between a determinant and every state it couples to.

Parameters:
  • bitstring (int) – The determinant to expand around, as a computational-basis bitstring integer.

  • paired_electron_approximation (bool) – Whether to include only paired electron excitations.

  • return_max_n_overlaps (int) – Cap on the returned overlaps; the largest ones survive the cap.

Return type:

dict[int, float]

diagonal_elements(bitstrings_as_integers: list[int]) ndarray[tuple[Any, ...], dtype[float64]]

Return the diagonal Hamiltonian elements \(\bra{k}\hat{H}\ket{k}\) of the given determinants.

Parameters:

bitstrings_as_integers (list[int]) – Determinants to evaluate, as computational-basis bitstring integers.

Return type:

ndarray[tuple[Any, …], dtype[float64]]

lowest_eigenpair(bitstrings_as_integers: list[int]) tuple[float, ndarray[tuple[Any, ...], dtype[float64]]]

Return the lowest eigenvalue and its eigenvector of the Hamiltonian projected onto the determinants.

The eigenvector holds the configuration-interaction coefficient \(c_d\) of each determinant, in the order the determinants were given. Strategies that select determinants adaptively need those weights to tell which parts of the current subspace matter.

Parameters:

bitstrings_as_integers (list[int]) – Determinants spanning the diagonalization subspace, as computational-basis bitstring integers.

Return type:

tuple[float, ndarray[tuple[Any, …], dtype[float64]]]