qrunch.chemistry.subspace_diagonalization.sparse_slater_condon

Slater-Condon subspace diagonalizer holding the CI matrix in sparse form.

Classes

SparseSlaterCondonSubspaceDiagonalizer

Subspace diagonalizer holding the Slater-Condon CI matrix in sparse form.

class SparseSlaterCondonSubspaceDiagonalizer

Bases: SubspaceDiagonalizer

Subspace diagonalizer holding the Slater-Condon CI matrix in sparse form.

Identical in result to EfficientSlaterCondonSubspaceDiagonalizer, but it never materializes the dense CI matrix. A determinant couples only to its own single and double excitations, so the nonzero count per row is fixed by the excitation structure rather than by the size of the subspace, turning the memory cost from \(O(N^2)\) into \(O(N)\).

__init__(integrals: RestrictedElectronicStructureIntegrals | UnrestrictedElectronicStructureIntegrals | None = None, *, rng: Generator, paired_electron_approximation: bool = False) → None

Initialize the diagonalizer.

Parameters:
  • integrals (RestrictedElectronicStructureIntegrals | UnrestrictedElectronicStructureIntegrals | None) – The electronic structure integrals. If None, the diagonalizer cannot be used until update_hamiltonian() has supplied a Hamiltonian.

  • rng (Generator) – Random generator supplying iterative eigensolver starting probes.

  • paired_electron_approximation (bool) – Whether input determinants use one bit per occupied electron pair.

Return type:

None

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

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

Parameters:
  • bitstring (int) – The determinant to expand around, as a 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[float64]

Compute the diagonal CI matrix elements \(\bra{k}\hat{H}\ket{k}\) of the given determinants.

Parameters:

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

Return type:

NDArray[float64]

lowest_eigenpair(bitstrings_as_integers: list[int]) → tuple[float, NDArray[float64]]

Compute the lowest eigenvalue and its eigenvector of the CI matrix projected onto the determinants.

Parameters:

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

Return type:

tuple[float, NDArray[float64]]

lowest_eigenpairs(bitstrings_as_integers: list[int], *, number_of_eigenpairs: int) → tuple[NDArray[float64], NDArray[float64]]

Compute the lowest eigenvalues and their eigenvectors of the CI matrix projected onto the determinants.

Parameters:
  • bitstrings_as_integers (list[int]) – Determinants spanning the subspace, as bitstring integers.

  • number_of_eigenpairs (int) – Positive number of lowest eigenpairs to compute.

Return type:

tuple[NDArray[float64], NDArray[float64]]

update_hamiltonian(hamiltonian: FermionHermitianSum | PairedHardcoreBosonHermitianSum) → None

Replace the calculator with one built from the current Hamiltonian.

Parameters:

hamiltonian (FermionHermitianSum | PairedHardcoreBosonHermitianSum) – Current fermionic or paired hard-core-bosonic Hamiltonian.

Return type:

None