qxmt.hamiltonians.pennylane.molecular module#
- class qxmt.hamiltonians.pennylane.molecular.InitializationType(value)
Bases:
Enum
- DATASET = 1
- DIRECT_MOLECULE = 2
- INVALID = 3
- class qxmt.hamiltonians.pennylane.molecular.MolecularHamiltonian(molname=None, bondlength=None, symbols=None, coordinates=None, charge=0, multi=1, basis_name='STO-3G', unit='angstrom', method='dhf', active_electrons=None, active_orbitals=None, mapping='jordan_wigner', logger=<Logger qxmt.hamiltonians.pennylane.molecular (INFO)>)
Bases:
BaseHamiltonian
Molecular Hamiltonian for quantum chemistry calculations.
This class represents a molecular Hamiltonian using PennyLane’s quantum chemistry module. It supports both full and active space calculations for molecular systems.
- Parameters:
molname (str | None) – Name of the molecule in PennyLane’s dataset.
bondlength (float | str | None) – Bond length of the molecule in Angstroms.
symbols (list[str] | None) – List of atomic symbols (e.g., [‘H’, ‘H’] for H2).
coordinates (tensor | list[float] | list[list[float]] | None) – Array of atomic coordinates in Angstroms.
charge (int) – Total charge of the molecule. Defaults to 0.
multi (int) – Multiplicity of the molecule. Defaults to 1.
basis_name (Literal['STO-3G', '6-31G', '6-311G', 'CC-PVDZ']) – Basis set name. Only supported [“sto-3g”, “6-31g”, “6-311g”, “cc-pvdz”]. Defaults to “sto-3g”.
unit (Literal['angstrom', 'bohr']) – Unit of the coordinates. Only supported [“angstrom”, “bohr”]. Defaults to “angstrom”.
method (Literal['dhf', 'pyscf', 'openfermion']) – Method to use for the calculation. Only supported [“dhf”, “pyscf”, “openfermion”]. Defaults to “dhf”.
active_electrons (int | None) – Number of active electrons. If None, uses all electrons.
active_orbitals (int | None) – Number of active orbitals. If None, uses all orbitals.
mapping (Literal['jordan_wigner', 'bravyi_kitaev', 'parity']) – Mapping to use for the calculation. Defaults to “jordan_wigner”.
logger (Logger)
- hamiltonian
PennyLane Hamiltonian operator.
- n_qubits
Number of qubits required for the simulation.
- molecule
PennyLane Molecule object.
- get_active_electrons()
Get the number of active electrons.
If active_electrons is not specified, returns the total number of electrons.
- Returns:
Number of active electrons.
- Return type:
int
- get_active_orbitals()
Get the number of active orbitals.
If active_orbitals is not specified, returns the total number of molecular orbitals.
- Returns:
Number of active orbitals.
- Return type:
int
- get_active_spin_orbitals()
Get the number of active spin orbitals.
If active_orbitals is not specified, returns the total number of spin orbitals.
- Returns:
Number of active spin orbitals (2 * number of active orbitals).
- Return type:
int
- get_electrons()
Get the total number of electrons in the molecule.
- Returns:
Total number of electrons.
- Return type:
int
- get_fci_energy()
Get the FCI energy of the molecule.
- Returns:
FCI energy.
- Return type:
float
- get_hamiltonian()
Get the Hamiltonian operator.
- Returns:
The molecular Hamiltonian operator.
- Return type:
Sum
- get_hf_energy()
Get the Hartree-Fock energy of the molecule.
- Returns:
Hartree-Fock energy.
- Return type:
float
- get_molecular_orbitals()
Get the number of molecular orbitals.
- Returns:
Number of molecular orbitals.
- Return type:
int
- get_molecule()
Get the Molecule object.
- Returns:
The molecule object.
- Return type:
qml.qchem.Molecule
- get_n_qubits()
Get the number of qubits required for the simulation.
- Returns:
Number of qubits.
- Return type:
int
- get_spin_orbitals()
Get the number of spin orbitals.
- Returns:
Number of spin orbitals (2 * number of molecular orbitals).
- Return type:
int