Converting the result of expval Hamilton to eV

I am trying to compare the ground state energy of H_2 calculated using Pennylane vs the empirical measurement, which is -13.6 eV

import pennylane as qml

h2_dataset ="qchem", molname="H2", bondlength=0.742, basis="STO-3G")
h2 = h2_dataset[0]
H, qubits = h2.hamiltonian, len(h2.hamiltonian.wires)

dev = qml.device("default.qubit", wires=qubits)
def circuit_expected():
    qml.BasisState(h2.hf_state, wires = range(qubits))
    for op in h2.vqe_gates:
    return qml.expval(H)


I have -1.1363765762751892 as a result. Assuming the unit is Hatree, -1.136*27.21=-30.91 eV != -13.6 eV. What unit are we using here, or am I making a mistake? Thank you :slight_smile:

Hi @mchau, the units we use are indeed Hartree.

The ground state energy for an H2 molecule is about -31eV which indeed corresponds to -1.136 Hartree. The value -13.6eV corresponds to the Hydrogen atom, not the H2 molecule.

It’s nice that you’re experimenting with quantum chemistry! You may enjoy our demo on VQE or our other demos on quantum chemistry. Maybe you’ll also like the one on chemical reactions.

Enjoy using PennyLane!

1 Like