Molecule

Qibochem provides the Molecule class to save various properties related to the molecular system, and to drive the classical quantum chemistry calculation to obtain the necessary quantities for any subsequent quantum compute calculations.

class qibochem.driver.molecule.Molecule(geometry: list | None = None, charge: int = 0, multiplicity: int = 1, basis: str = 'sto-3g', xyz_file: str | None = None, active: list | None = None)

Class representing a single molecule

Parameters:
  • geometry (list) – Molecular coordinates in OpenFermion format, e.g. [('H', (0.0, 0.0, 0.0)), ('H', (0.0, 0.0, 0.7))]

  • charge (int) – Net electronic charge of molecule. Default: 0

  • multiplicity (int) – Spin multiplicity of molecule, given as 2S + 1, where S is half the number of unpaired electrons. Default: 1

  • basis (str) – Atomic orbital basis set, used for the PySCF calculations. Default: "STO-3G" (minimal basis)

  • xyz_file (str) – .xyz file containing the molecular coordinates. The comment line can be used to define the electronic charge and spin multiplity if it is given in this format: {charge} {multiplicity}

  • active (list) – Iterable representing the set of MOs to be included in the quantum simulation e.g. list(range(3,6)) for an active space with orbitals 3, 4 and 5.

nelec: int = None

Total number of electrons for the molecule

norb: int = None

Number of molecular orbitals considered for the molecule

nso: int = None

Number of molecular spin-orbitals considered for the molecule

e_hf: float = None

Hartree-Fock energy

oei: ndarray = None

One-electron integrals

tei: ndarray = None

Two-electron integrals, order follows the second quantization notation

active: list = None

Iterable of molecular orbitals included in the active space

frozen: list = None

Iterable representing the occupied molecular orbitals removed from the simulation

n_active_e: int = None

Number of electrons included in the active space if HF embedding is used

n_active_orbs: int = None

Number of spin-orbitals in the active space if HF embedding is used

run_pyscf(max_scf_cycles=50)

Run a Hartree-Fock calculation with PySCF to obtain molecule quantities and molecular integrals

Parameters:

max_scf_cycles (int) – Maximum number of SCF cycles in PySCF

hf_embedding(active=None, frozen=None)

Turns on HF embedding for a given active/frozen space, and fills in the class attributes: inactive_energy , embed_oei, and embed_tei.

Parameters:
  • active (list) – Iterable representing the active-space for quantum simulation. Uses the Molecule.active class attribute if not given.

  • frozen (list) – Iterable representing the occupied orbitals to be removed from the simulation. Depends on the active argument if not given.

hamiltonian(ham_type=None, oei=None, tei=None, constant=None, ferm_qubit_map=None)

Builds a molecular Hamiltonian using the one-/two- electron integrals. If HF embedding has been applied, (i.e. the embed_oei, embed_tei, and inactive_energy class attributes are all not None), the corresponding values for the molecular integrals will be used instead.

Parameters:
  • ham_type (str) – Format of molecular Hamiltonian returned. The available options are: ("f", "ferm"): openfermion.FermionOperator, ("q", "qubit"): openfermion.QubitOperator, or ("s", "sym"): qibo.hamiltonians.SymbolicHamiltonian (default)

  • oei (ndarray) – 1-electron integrals (in the MO basis). The default value is the oei class attribute, unless the embed_oei attribute exists and is not None, then embed_oei is used.

  • tei (ndarray) – 2-electron integrals in the second-quantization notation (and MO basis). The default value is the tei class attribute , unless the embed_tei attribute exists and is not None, then embed_tei is used.

  • constant (float) – Constant value to be added to the electronic energy. Mainly used for adding the inactive Fock energy if HF embedding was applied. Default: 0.0, unless the inactive_energy class attribute exists and is not None, then inactive_energy is used.

  • ferm_qubit_map (str) – Which fermion to qubit transformation to use. Must be either "jw" (Default) or "bk"

Returns:

Molecular Hamiltonian in the format of choice

Return type:

openfermion.FermionOperator or openfermion.QubitOperator or qibo.hamiltonians.SymbolicHamiltonian

static eigenvalues(hamiltonian)

Finds the lowest 6 exact eigenvalues of a given Hamiltonian

Parameters:

hamiltonian (openfermion.FermionOperator or openfermion.QubitOperator or qibo.hamiltonians.SymbolicHamiltonian) – Hamiltonian of interest. If the input is a qibo.hamiltonians.SymbolicHamiltonian, the whole Hamiltonian matrix has to be built first (not recommended).