ffsim.MolecularData

class ffsim.MolecularData(*, core_energy, one_body_integrals, two_body_integrals, norb, nelec, atom=None, basis=None, spin=None, symmetry=None, mo_coeff=None, mo_occ=None, active_space=None, hf_energy=None, hf_mo_coeff=None, hf_mo_occ=None, mp2_energy=None, mp2_t2=None, ccsd_energy=None, ccsd_t1=None, ccsd_t2=None, cisd_energy=None, cisd_vec=None, sci_energy=None, sci_vec=None, fci_energy=None, fci_vec=None, dmrg_energy=None, dipole_integrals=None, orbital_symmetries=None)[source]

Bases: object

Class for storing molecular data.

core_energy

The core energy.

Type:

float

one_body_integrals

The one-body integrals.

Type:

np.ndarray

two_body_integrals

The two-body integrals in compressed format.

Type:

np.ndarray

norb

The number of spatial orbitals.

Type:

int

nelec

The number of alpha and beta electrons.

Type:

tuple[int, int]

atom

The coordinates of the atoms in the molecule.

Type:

list[tuple[str, list[float]]] | None

basis

The basis set, e.g. “sto-6g”.

Type:

str | None

spin

The spin of the molecule.

Type:

int | None

symmetry

The symmetry of the molecule.

Type:

str | None

mo_coeff

Molecular orbital coefficients in the AO basis.

Type:

np.ndarray | None

mo_occ

Molecular orbital occupancies.

Type:

np.ndarray | None

active_space

The molecular orbitals included in the active space.

Type:

list[int] | None

hf_energy

The Hartree-Fock energy.

Type:

float | None

hf_mo_coeff

Hartree-Fock canonical orbital coefficients in the AO basis.

Type:

np.ndarray | None

hf_mo_occ

Hartree-Fock canonical orbital occupancies.

Type:

np.ndarray | None

mp2_energy

The MP2 energy.

Type:

float | None

mp2_t2

The MP2 t2 amplitudes.

Type:

np.ndarray | tuple[np.ndarray, np.ndarray, np.ndarray] | None

ccsd_energy

The CCSD energy.

Type:

float | None

ccsd_t1

The CCSD t1 amplitudes.

Type:

np.ndarray | tuple[np.ndarray, np.ndarray] | None

ccsd_t2

The CCSD t2 amplitudes.

Type:

np.ndarray | tuple[np.ndarray, np.ndarray, np.ndarray] | None

cisd_energy

The CISD energy.

Type:

float | None

cisd_vec

The CISD state vector.

Type:

np.ndarray | None

sci_energy

The SCI energy.

Type:

float | None

sci_vec

The SCI state vector coefficients, spin alpha strings, and spin beta strings.

Type:

tuple[np.ndarray, np.ndarray, np.ndarray] | None

fci_energy

The FCI energy.

Type:

float | None

fci_vec

The FCI state vector.

Type:

np.ndarray | None

dipole_integrals

The dipole integrals.

Type:

np.ndarray | None

orbital_symmetries

The orbital symmetries.

Type:

list[str] | None

Methods

from_fcidump(file)

Initialize a MolecularData from an FCIDUMP file.

from_json(file[, compression])

Load a MolecularData from a (possibly compressed) JSON file.

from_scf(hartree_fock[, active_space])

Initialize a MolecularData object from a Hartree-Fock calculation.

run_ccsd([t1, t2, store_t1, store_t2])

Run CCSD and store results.

run_cisd(*[, store_cisd_vec])

Run CISD and store results.

run_fci(*[, store_fci_vec])

Run FCI and store results.

run_mp2(*[, store_t2])

Run MP2 and store results.

run_sci(*[, store_sci_vec])

Run SCI and store results.

to_fcidump(file)

Save data to disk in FCIDUMP format.

to_json(file[, compression])

Serialize to JSON format, optionally compressed, and save to disk.

static from_fcidump(file)[source]

Initialize a MolecularData from an FCIDUMP file.

Parameters:

file (str | bytes | PathLike) – The FCIDUMP file path.

Return type:

MolecularData

static from_json(file, compression=None)[source]

Load a MolecularData from a (possibly compressed) JSON file.

Parameters:
  • file (str | bytes | PathLike) – The file path to read from.

  • compression (str | None) – The compression algorithm, if any, which was used to compress the file. Options: "gzip", "bz2", "lzma".

Return type:

MolecularData

Returns: The MolecularData object.

static from_scf(hartree_fock, active_space=None)[source]

Initialize a MolecularData object from a Hartree-Fock calculation.

Parameters:
  • hartree_fock (SCF) – The Hartree-Fock object.

  • active_space (Iterable[int] | None) – An optional list of orbitals to use for the active space.

Return type:

MolecularData

run_ccsd(t1=None, t2=None, *, store_t1=False, store_t2=False)[source]

Run CCSD and store results.

Return type:

None

run_cisd(*, store_cisd_vec=False)[source]

Run CISD and store results.

Return type:

None

run_fci(*, store_fci_vec=False)[source]

Run FCI and store results.

Return type:

None

run_mp2(*, store_t2=False)[source]

Run MP2 and store results.

run_sci(*, store_sci_vec=False)[source]

Run SCI and store results.

Return type:

None

to_fcidump(file)[source]

Save data to disk in FCIDUMP format.

Note

The FCIDUMP format does not retain all information stored in the MolecularData object. To serialize a MolecularData object losslessly, use the to_json() method to save to JSON format.

Parameters:

file (str | bytes | PathLike) – The file path to save to.

Return type:

None

to_json(file, compression=None)[source]

Serialize to JSON format, optionally compressed, and save to disk.

Parameters:
  • file (str | bytes | PathLike) – The file path to save to.

  • compression (str | None) – The optional compression algorithm to use. Options: "gzip", "bz2", "lzma".

Return type:

None

Attributes

active_space

atom

basis

ccsd_energy

ccsd_t1

ccsd_t2

cisd_energy

cisd_vec

dipole_integrals

dmrg_energy

fci_energy

fci_vec

hamiltonian

The Hamiltonian defined by the molecular data.

hf_energy

hf_mo_coeff

hf_mo_occ

mo_coeff

mo_occ

mole

The PySCF Mole class for this molecular data.

mp2_energy

mp2_t2

orbital_symmetries

scf

A PySCF SCF class for this molecular data.

sci_energy

sci_vec

spin

symmetry

core_energy

one_body_integrals

two_body_integrals

norb

nelec