Skip to content

sci_solvers.hamiltonian

HamiltonianData [source] dataclass

HamiltonianData(hcore: ndarray, eri: ndarray, e_nuc: float, num_orbitals: int, num_elec_a: int, num_elec_b: int, fcidump_path: str | PathLike[str] | None = None)

Hamiltonian data for energy calculations.

Note: Chemists' notation is assumed, as expected by qiskit-addon-sqd and pyscf. If you route integrals through ffsim instead, ffsim uses physicists' notation apply eri.transpose(0, 2, 3, 1) (or its inverse) at that boundary.

Attributes:

Name Type Description
hcore ndarray

One-electron integrals, shape (n_orbitals, n_orbitals).

eri ndarray

Two-electron repulsion integrals, shape (n_orbitals, n_orbitals, n_orbitals, n_orbitals).

e_nuc float

Nuclear repulsion energy.

num_orbitals int

Number of spatial orbitals.

num_elec_a int

Number of alpha (spin-up) electrons.

num_elec_b int

Number of beta (spin-down) electrons.

fcidump_path str | PathLike[str] | None

Optional path to the source FCIDUMP file

is_complex property

is_complex: bool

True if the integrals are complex (a complex Hermitian Hamiltonian).

num_elec property

num_elec: int

Total number of electrons.

ms2 property

ms2: int

2 * M_s (spin projection quantum number).

is_closed_shell property

is_closed_shell: bool

True if alpha and beta electron counts are equal.

from_fcidump classmethod

from_fcidump(filename: str | PathLike[str]) -> HamiltonianData

Load Hamiltonian from an FCIDUMP file.

to_fcidump

to_fcidump(filename: str | PathLike[str]) -> None

Save Hamiltonian to an FCIDUMP file.

Raises:

Type Description
NotImplementedError

If the integrals are complex. The FCIDUMP format stores only real integrals; a complex Hermitian Hamiltonian (e.g. a non-Gamma k-point) cannot be represented and would be silently truncated to its real part, so this is refused.