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=None, charge=0, multiplicity=1, basis=None, xyz_file=None, active=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

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

  • basis (str) – Atomic orbital basis set, used for the PySCF/PSI4 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 – 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#

Total number of electrons for the molecule

norb#

Number of molecular orbitals considered for the molecule

nso#

Number of molecular spin-orbitals considered for the molecule

e_hf#

Hartree-Fock energy

oei#

One-electron integrals

tei#

Two-electron integrals, order follows the second quantization notation

active#

Iterable of molecular orbitals included in the active space

frozen#

Iterable representing the occupied molecular orbitals removed from the simulation

n_active_e#

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

n_active_orbs#

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 – 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 – Iterable representing the active-space for quantum simulation

  • frozen – Iterable representing the occupied orbitals to be removed from the simulation

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 attributes are all not None), the corresponding values for the molecular integrals will be used instead.

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

  • oei – 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 – 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 – 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 – Which fermion to qubit transformation to use. Must be either jw (default) or bk

Returns:

Molecular Hamiltonian in the format of choice

static eigenvalues(hamiltonian)#
Finds the lowest 6 exact eigenvalues of the molecular Hamiltonian

Note: Uses the eigenvalues() class method for a Qibo SymbolicHamiltonian object

Parameters:

hamiltonian – Molecular Hamiltonian, given as a FermionOperator, QubitOperator, or SymbolicHamiltonian (not recommended)