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
MolecularHamiltonianof the studied molecule.- Type:
- 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.6908286341170636 * integrals shape ** one_body_integrals : (2, 2) ** two_body_integrals : (2, 2, 2, 2) ) - n_electrons = 4 - noons = [np.float64(-0.6248860899212999), np.float64(-0.046707175679911755), np.float64(-2.0263254948614384), np.float64(0.9427379403411723), np.float64(0.21392606636893036), np.float64(-0.13360711671819375), np.float64(-0.7631586392871808), np.float64(-1.0141209142332404), np.float64(-0.3298168959417237), np.float64(-0.3861293958787078)] - orbital energies = [np.float64(1.8819478819486084), np.float64(1.4595366383544668), np.float64(0.838483134620712), np.float64(1.0510010544288448), np.float64(0.07060418616117557), np.float64(1.1910075534998759), np.float64(1.3080962090715036), np.float64(-1.601991027134508), np.float64(-0.0978965655821221), np.float64(0.13511536601258203)] )
- restrict_active_space(threshold_1: float | None = 0.02, threshold_2: float | None = 0.001)
Same method as the
MolecularHamiltonianmethodselect_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.