openfermion.chem.MolecularData

Class for storing molecule data from a fixed basis set at a fixed geometry that is obtained from classical electronic structure packages.

Used in the notebooks

Used in the tutorials

Not every field is filled in every calculation. All data that can (for some instance) exceed 10 MB should be saved separately. Data saved in HDF5 format.

geometry A list of tuples giving the coordinates of each atom. An example is [('H', (0, 0, 0)), ('H', (0, 0, 0.7414))]. Distances in angstrom. Use atomic symbols to specify atoms. Only optional if loading from file.
basis A string giving the basis set. An example is 'cc-pvtz'. Only optional if loading from file.
charge An integer giving the total molecular charge. Defaults to 0. Only optional if loading from file.
multiplicity An integer giving the spin multiplicity. Only optional if loading from file.
description A optional string giving a description. As an example, for dimers a likely description is the bond length (e.g. 0.7414).
filename An optional string giving name of file. If filename is not provided, one is generated automatically.
data_directory Optional data directory to change from default data directory specified in config file.

geometry A list of tuples giving the coordinates of each atom. An example is [('H', (0, 0, 0)), ('H', (0, 0, 0.7414))]. Distances in angstrom. Use atomic symbols to specify atoms.
basis A string giving the basis set. An example is 'cc-pvtz'.
charge An integer giving the total molecular charge. Defaults to 0.
multiplicity An integer giving the spin multiplicity.
description An optional string giving a description. As an example, for dimers a likely description is the bond length (e.g. 0.7414).
name A string giving a characteristic name for the instance.
filename The name of the file where the molecule data is saved.
n_atoms Integer giving the number of atoms in the molecule.
n_electrons Integer giving the number of electrons in the molecule.
atoms List of the atoms in molecule sorted by atomic number.
protons List of atomic charges in molecule sorted by atomic number.
hf_energy Energy from open or closed shell Hartree-Fock.
nuclear_repulsion Energy from nuclei-nuclei interaction.
canonical_orbitals numpy array giving canonical orbital coefficients.
n_orbitals Integer giving total number of spatial orbitals.
n_qubits Integer giving total number of qubits that would be needed.
orbital_energies Numpy array giving the canonical orbital energies.
fock_matrix Numpy array giving the Fock matrix.
overlap_integrals Numpy array of AO overlap integrals
one_body_integrals Numpy array of one-electron integrals
two_body_integrals Numpy array of two-electron integrals
mp2_energy Energy from MP2 perturbation theory.
cisd_energy Energy from configuration interaction singles + doubles.
cisd_one_rdm Numpy array giving 1-RDM from CISD calculation.
cisd_two_rdm Numpy array giving 2-RDM from CISD calculation.
fci_energy Exact energy of molecule within given basis.
fci_one_rdm Numpy array giving 1-RDM from FCI calculation.
fci_two_rdm Numpy array giving 2-RDM from FCI calculation.
ccsd_energy Energy from coupled cluster singles + doubles.
ccsd_single_amps Numpy array holding single amplitudes
ccsd_double_amps Numpy array holding double amplitudes
general_calculations A dictionary storing general calculation results for this system annotated by the key.

Methods

get_active_space_integrals

View source

Restricts a molecule at a spatial orbital level to an active space

This active space may be defined by a list of active indices and doubly occupied indices. Note that one_body_integrals and two_body_integrals must be defined n an orthonormal basis set.

Args
occupied_indices A list of spatial orbital indices indicating which orbitals should be considered doubly occupied.
active_indices A list of spatial orbital indices indicating which orbitals should be considered active.

Returns
tuple Tuple with the following entries:

core_constant: Adjustment to constant shift in Hamiltonian from integrating out core orbitals

one_body_integrals_new: one-electron integrals over active space.

two_body_integrals_new: two-electron integrals over active space.

get_antisym

View source

Method to return anti-symmetrized integrals in spin-orbital basis.

Returns
antisymints Numpy array of anti-symmetrized integrals in spin- orbital basis = - (physicist ordering)

Raises
MissingCalculationError If integrals are not calculated.

get_from_file

View source

Helper routine to re-open HDF5 file and pull out single property

Args
property_name Property name to load from self.filename

Returns
The data located at file[property_name] for the HDF5 file at self.filename. Returns None if the key is not found in the file.

get_integrals

View source

Method to return 1-electron and 2-electron integrals in MO basis.

Returns
one_body_integrals An array of the one-electron integrals having shape of (n_orbitals, n_orbitals).
two_body_integrals An array of the two-electron integrals having shape of (n_orbitals, n_orbitals, n_orbitals, n_orbitals).

Raises
MissingCalculationError If integrals are not calculated.

get_j

View source

Method to return coulomb matrix.

Returns
k_matr Numpy array of the coulomb integrals J_{p,q} = (pp|qq) (in chemist notation).

Raises
MissingCalculationError If integrals are not calculated.

get_k

View source

Method to return exchange matrix.

Returns
k_matr Numpy array of the coulomb integrals K_{p,q} = (pq|qp) (in chemist notation).

Raises
MissingCalculationError If integrals are not calculated.

get_molecular_hamiltonian

View source

Output arrays of the second quantized Hamiltonian coefficients.

Args
occupied_indices list

A list of spatial orbital indices indicating which orbitals should be considered doubly occupied.

active_indices list

A list of spatial orbital indices indicating which orbitals should be considered active.

Returns
molecular_hamiltonian An instance of the MolecularOperator class.

Note
The indexing convention used is that even indices correspond to spin-up (alpha) modes and odd indices correspond to spin-down (beta) modes.

get_molecular_rdm

View source

Method to return 1-RDM and 2-RDMs from CISD or FCI.

Args
use_fci Boolean indicating whether to use RDM from FCI calculation.

Returns
rdm An instance of the MolecularRDM class.

Raises
MisissingCalculationError If the CI calculation has not been performed.

get_n_alpha_electrons

View source

Return number of alpha electrons.

get_n_beta_electrons

View source

Return number of beta electrons.

init_lazy_properties

View source

Initializes properties loaded on demand to None

load

View source

save

View source

Method to save the class under a systematic name.