qat.fermion.chemistry.wrapper.MoleculeInfo

class qat.fermion.chemistry.wrapper.MoleculeInfo(hamiltonian: MolecularHamiltonian, n_electrons: int, noons: Union[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.8803127103138594
    * integrals shape
       ** one_body_integrals : (2, 2)
       ** two_body_integrals : (2, 2, 2, 2)
   )
 - n_electrons = 4
 - noons = [1.3162414648693153, 0.24268597232819272, 0.7483630308482484, -0.43975184444497595, -0.14336033418312327, 0.5712444819480262, 0.403579153632366, -1.720801978277542, 0.8632987438665266, 0.6236594266237275]
 - orbital energies = [-1.2977251700751646, 0.37592706080226174, 0.6248248866412615, 0.6665717426766709, -0.4419420643396751, 1.5230817114324762, 0.8412068469986201, -0.5662520521230993, -0.07502933810430831, 0.04301144920568956]
)
restrict_active_space(threshold_1: Optional[float] = 0.02, threshold_2: Optional[float] = 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.