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 = qml.data.load("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)
@qml.qnode(dev)
def circuit_expected():
    qml.BasisState(h2.hf_state, wires = range(qubits))
    for op in h2.vqe_gates:
        qml.apply(op)
    return qml.expval(H)

print(circuit_expected())

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