qrunch.chemistry.subspace_diagonalization.efficient_slater_condon
Slater-Condon subspace diagonalizer backed by the Rust EfficientSlaterCondonCalculator.
Classes
Subspace diagonalizer built on the Rust-accelerated Slater-Condon CI matrix. |
- class EfficientSlaterCondonSubspaceDiagonalizer
Bases:
SubspaceDiagonalizerSubspace diagonalizer built on the Rust-accelerated Slater-Condon CI matrix.
Delegates to the full CI-matrix machinery from
EfficientSlaterCondonCalculator.The most recent
lowest_eigenpair()result is cached, so consumers sharing one diagonalizer – an adaptive determinant-selection strategy and the reweighter steering it, say – pay for a single diagonalization of a given subspace instead of one each.- __init__(integrals: RestrictedElectronicStructureIntegrals | UnrestrictedElectronicStructureIntegrals) None
Initialize the diagonalizer.
- Parameters:
integrals (RestrictedElectronicStructureIntegrals | UnrestrictedElectronicStructureIntegrals) – The electronic structure integrals.
- 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[tuple[Any, ...], dtype[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[tuple[Any, …], dtype[float64]]
- lowest_eigenpair(bitstrings_as_integers: list[int]) tuple[float, ndarray[tuple[Any, ...], dtype[float64]]]
Compute the lowest eigenvalue and its eigenvector of the CI matrix projected onto the determinants.
The CI matrix is built dense, so a direct LAPACK solve restricted to the lowest eigenpair beats an iterative one, which would need many dense matrix-vector products to converge on the extreme end of the spectrum.
Only the most recent subspace is cached: subspaces grow monotonically over a run, so an older one is never asked for again and keeping it would only tie up memory.
- Parameters:
bitstrings_as_integers (list[int]) – Determinants spanning the subspace, as bitstring integers.
- Return type:
tuple[float, ndarray[tuple[Any, …], dtype[float64]]]