Is there a way to get the fermionic hamiltonian expressed in terms of creation and annihilation operators without the qubit mapping transformation?
Hi @Cesaray10 and welcome to the forum!
Yes, you can get the fermionic hamiltonian from the meanfield data file. Please note that PennyLane currently uses PySCF/Psi4 and OpenFermion to construct the electronic Hamiltonian and convert it to a represented in the Pauli basis. I have copied a sample code for getting the fermionic hamiltonian expressed in terms of creation and annihilation operators in the following.
from pennylane import qchem from pennylane import numpy as np from openfermion import MolecularData from openfermion.transforms import get_fermion_operator symbols = ["O", "H", "H"] coordinates = np.array([0.00, 0.00, 0.28, 0.00, 1.45, -0.97, 0.00, -1.45, -0.97]) # in Bohr hf_file = qchem.meanfield(symbols, coordinates) molecule = MolecularData(filename=hf_file.strip()) terms_molecular_hamiltonian = molecule.get_molecular_hamiltonian() fermionic_hamiltonian = get_fermion_operator(terms_molecular_hamiltonian) print(fermionic_hamiltonian)
Thanks a lot @sjahangiri !