qat.fermion.chemistry.wrapper.MoleculeInfo

class qat.fermion.chemistry.wrapper.MoleculeInfo(hamiltonian: MolecularHamiltonian, n_electrons: int, noons: ndarray | List[float], orbital_energies: ndarray)

MoleculeInfo helper class. This class is a even higher level version of the MolecularHamiltonian.

Parameters:
  • hamiltonian (MolecularHamiltonian) – The MolecularHamiltonian of the studied molecule.

  • n_electrons (int) – Number of electrons.

  • noons (Union[np.ndarray, List[float]]) – Natural orbital occupation number.

  • orbital_energies (np.ndarray) – Orbital energies.

nqbits

The total number of qubits.

Type:

int

one_body_integrals

One-body integrals \(I_{uv}\).

Type:

np.ndarray

two_body_integrals

Two-body integrals \(I_{uvwx}\).

Type:

np.ndarray

constant_coeff

Constant coefficient \(r\) (core repulsion).

Type:

np.ndarray

hamiltonian

The MolecularHamiltonian of the studied molecule.

Type:

MolecularHamiltonian

n_electrons

Number of electrons.

Type:

int

noons

Natural orbital occupation number.

Type:

Union[np.ndarray, List[float]]

orbital_energies

Orbital energies.

Type:

np.ndarray

Example

import numpy as np
from qat.fermion.chemistry import MolecularHamiltonian, MoleculeInfo

# For illustration purpose, initialize random one- and two-body integrals, and a constant
one_body_integral = np.random.randn(2, 2)
two_body_integral = np.random.randn(2, 2, 2, 2)
constant = np.random.rand()
noons = list(np.random.randn(10))
orbital_energies = list(np.random.randn(10))

# Define the MolecularHamiltonian
mol_h = MolecularHamiltonian(one_body_integral, two_body_integral, constant)

# Define MoleculeInfo
molecule = MoleculeInfo(
    mol_h,
    n_electrons=4,
    noons=noons,
    orbital_energies=orbital_energies
)

print(molecule)
MoleculeInfo(
 - MolecularHamiltonian(
    * constant_coeff : 0.7874458212027329
    * integrals shape
       ** one_body_integrals : (2, 2)
       ** two_body_integrals : (2, 2, 2, 2)
   )
 - n_electrons = 4
 - noons = [np.float64(0.5223002868773575), np.float64(-0.8616132176494687), np.float64(-1.2710065090121807), np.float64(-0.7596140848478499), np.float64(0.7660167624212675), np.float64(-0.7505191983624373), np.float64(1.2436647597328383), np.float64(-0.6940442052234869), np.float64(-0.2493680927122771), np.float64(1.4558028901380051)]
 - orbital energies = [np.float64(0.6213141037090146), np.float64(0.9174709982979758), np.float64(0.7867535994536635), np.float64(1.0060478221878144), np.float64(-0.14277372012571185), np.float64(0.5976649210066465), np.float64(-1.0337509167706027), np.float64(-0.1888352538404858), np.float64(-0.24629585764896755), np.float64(2.095465378822157)]
)
restrict_active_space(threshold_1: float | None = 0.02, threshold_2: float | None = 0.001)

Same method as the MolecularHamiltonian method select_active_space(), except it also modifies all the molecule parameters accordingly (NOONs, orbital energies, and number of electrons).

For more information, see select_active_space() documentation.

Parameters:
  • threshold_1 (Optional[float]) – The upper threshold \(\varepsilon_1\) on the NOON of an active orbital.

  • threshold_2 (Optional[float]) – The lower threshold \(\varepsilon_2\) on the NOON of an active orbital.