Regarding the H5 molecules ( H5 Molecule (pennylane.ai)) in Quantum data, the vqe_energy and vqe_gates in the data do not match.
For instance, we can obtain the vqe_energy
as -1.7852284384849288 under the STO-3G basis when the bond length is 0.5. The code is as follows,
import pennylane as qml
import pennylane.numpy as np
H5 = qml.data.load("qchem", molname="H5", basis="STO-3G", bondlength=0.5)[0]
chem = H5
print(chem.fci_energy)
However, when using vqe_gates
to construct the circuit for calculation, the resulting energy is only -1.7561004846246622. The code is as follows:
import pennylane as qml
import pennylane.numpy as np
H5 = qml.data.load("qchem", molname="H5", basis="STO-3G", bondlength=0.5)[0]
chem = H5
n_wires = len(chem.hamiltonian.wires)
dev = qml.device("default.qubit", wires=n_wires)
cost_h = chem.hamiltonian
hf_state = chem.hf_state
gates = chem.vqe_gates
@qml.qnode(dev)
def qcircuit():
qml.BasisEmbedding(hf_state,wires=range(n_wires))
gates
return qml.expval(cost_h)
print(qcircuit())
I’m not sure if the issue lies with vqe_gates
or vqe_energy
, or perhaps the way I’m constructing the circuit is incorrect?