Molecular optimization with VQE: bond lengths of H₂ and LiH against exact chemistry
We ran VQE with a UCCSD ansatz along the bond scans of hydrogen (4 qubits) and lithium hydride (10 qubits, core frozen) on a noiseless simulator, and checked every point against the exact energy of the same basis. Started from the Hartree-Fock state, it matched the exact energy at every point and found the same equilibrium bond length; from random starting angles, every lithium hydride run settled in a local minimum above the ground state, which shows how much the starting state decides. Classical full configuration interaction solved every point faster, as it does for any molecule this small: the run checks the method where exact chemistry is cheap, not where it runs out, and the same scan runs in a few lines of eigenkit.
Updated
The short answer
- Accuracy on the curve
- From the Hartree-Fock start, VQE with a UCCSD ansatz stayed within chemical accuracy (1.6 mHa) of the exact energy at 36 of 36 bond lengths and 40 of 40 LiH bond lengths. The largest LiH error was 0.00008 mHa
- Equilibrium bond length
- VQE and the exact solution gave the same minimum: 0.7351 Å for and 1.5475 Å for LiH in the STO-3G basis. Hartree-Fock put both bonds too short
- Where it failed
- From random starting angles, 0 of 25 LiH runs reached chemical accuracy: each settled in a local minimum. The 2-layer hardware-efficient ansatz missed on stretched bonds
- Against classical chemistry
- At this size classical methods were faster and as accurate. PySCF's FCI took 0.011 s per LiH point against 1.63 s ± 0.38 s for VQE on the simulator, and CCSD(T) agreed with the exact energy everywhere
- Hardware
- None. Exact expectation values on eigenkit's NumPy statevector simulator: no shots, no gate noise, no QPU.
What a bond scan asks of VQE
A molecule's geometry is the arrangement of nuclei with the lowest electronic energy. For a diatomic molecule that is one number, the bond length, and the standard way to find it is to compute the ground-state energy on a grid of bond lengths and read off the minimum of the curve. The same curve, followed out to long bonds, gives the dissociation energy. Both are tests of the method that computes each point, and stretched bonds are the hard part: as the bond breaks, a single Slater determinant, which is what Hartree-Fock assumes, describes the molecule worse and worse.
The variational quantum eigensolver (VQE) computes each point by preparing a parameterised trial state on qubits, measuring the energy and letting a classical optimiser lower it[1]. By the variational principle every is an upper bound on the true ground-state energy; nothing guarantees that the optimiser gets close to it. The VQE chapter of the eigenkit docs explains the four steps: a fermionic Hamiltonian, a mapping onto qubits, an ansatz and the optimisation. This page is about what happens when you run them along a curve.
Bond scans are the classic hardware demonstration. O'Malley and colleagues computed the curve on superconducting qubits with a UCCSD ansatz and recovered the dissociation energy within chemical accuracy of the exact result[2]. Kandala and colleagues went to six qubits[3] and over a hundred Pauli terms[3], up to , with a hardware-efficient ansatz, and the largest of the Hartree-Fock simulations Arute and colleagues ran on a superconducting processor in 2020 used a dozen qubits and 78 two-qubit gates[4]. All of these molecules are small enough that a laptop solves them exactly, which is also true of ours.
What our run measured: H₂ and LiH along their curves
and LiH in the STO-3G basis, integrals and Hartree-Fock from PySCF[9], Jordan-Wigner mapping, UCCSD with one Trotter step, SciPy's L-BFGS-B with the simulator's analytic gradient. LiH is solved with the Li 1s orbital frozen: 2 electrons in 5 spatial orbitals. The bond-length grid is 0.01 Å apart near each minimum, and the equilibrium is the vertex of a parabola through the five points around the lowest one. The reference is the exact ground-state energy of the same qubit Hamiltonian, checked against PySCF's FCI.
| Quantity | H₂, 4 qubits | LiH, frozen core, 10 qubits |
|---|---|---|
| Bond lengths on the grid | 36 | 40 |
| Pauli terms in the qubit Hamiltonian, largest | 14 | 275 |
| UCCSD parameters | 5 | 44 |
| Largest VQE error against exact, Hartree-Fock start | 0.00000004 mHa | 0.00008 mHa |
| VQE points within 1.6 mHa | 36 of 36 | 40 of 40 |
| Largest Hartree-Fock error | 233.1 mHa | 159.0 mHa |
| Hartree-Fock points within 1.6 mHa | 0 of 36 | 0 of 40 |
| Largest CCSD(T) error against exact | 0.00023 mHa | 0.00002 mHa |
| Equilibrium bond length, exact | 0.7351 Å | 1.5475 Å |
| Equilibrium bond length, VQE | 0.7351 Å | 1.5475 Å |
| Equilibrium bond length, Hartree-Fock | 0.7126 Å | 1.5110 Å |
| Energy evaluations per point, mean | 5.0 | 11.3 ± 1.7 |
| VQE time per point | 0.019 s | 1.63 s ± 0.38 s |
| PySCF FCI time per point (LiH: all 12 qubits) | 0.0003 s | 0.011 s |
| Random start, runs within 1.6 mHa | 180 of 180 | 0 of 25 |
Run vqe-dissociation-curves of 2026-11-03, mean and spread over 5 seeds, on Molecular Hamiltonians of H2 and LiH in the STO-3G basis, integrals computed by PySCF. Errors are in millihartree (mHa); chemical accuracy is 1 kcal/mol, 1.6 mHa. Random starts: seeds 0 to 4 at every point and at five LiH points. Times are wall-clock on one shared Apple Silicon laptop and are indicative only.
Reading the run
From the Hartree-Fock state, VQE was exact for this setup. Hartree-Fock alone missed by 20.5 mHa at 0.74 Å in and by 19.5 mHa at 1.55 Å in LiH, and by up to 233 mHa at the most stretched bond. UCCSD started from that state recovered the rest in a few iterations at every point. That is less general than it looks: with two active electrons, one Trotter step of UCCSD can represent the exact ground state, and for two electrons CCSD is exact by construction, which is why CCSD(T) also matched. Molecules with more correlated electrons will not be this forgiving.
The bond length is right for the basis, not for the molecule. VQE, CCSD(T) and the exact solution agree on 1.5475 Å for LiH, while the measured equilibrium distance is 1.5957 Å[11]; for the run gives 0.7351 Å against 0.74144 Å[10]. The gap is the minimal STO-3G basis. Closing it takes a larger basis, so more orbitals, more qubits and far more Pauli terms; it is not something a better optimiser can fix.
Freezing the core was a small, honest approximation. Keeping the Li 1s orbital doubly occupied cut LiH from 12 to 10 qubits and moved the exact energy by 0.22 mHa to 0.44 mHa against full FCI, inside chemical accuracy. One point ran the full 12-qubit problem with 200 UCCSD parameters and 630 Pauli terms: VQE ended 0.010 mHa above exact after 29.5 s. eigenkit's dense diagonalisation of that Hamiltonian took 108 s and PySCF's FCI 0.010 s.
The starting point decided the answer. On LiH every run from random angles stopped in a local minimum above the ground state: by 136.4 mHa at 1.0 Å with one seed, by 8.4 mHa at 3.4 Å with another. The worst miss per seed averaged 128 mHa ± 4 mHa, after 107 ± 67 energy evaluations, against about 11 from the Hartree-Fock start. The eigenkit docs show the same trap on a two-site Fermi-Hubbard model; this run shows it on a real molecule. On , with only 5 parameters, random starts were harmless.
A hardware-efficient ansatz broke where chemistry gets hard. With the default 2 layers (20 parameters), 131 of 180 single runs were within chemical accuracy; with 4 layers (36), 168 of 180. The misses were at stretched bonds, where the ground state is furthest from a single determinant. Deeper generic circuits also run into barren plateaus, flat landscapes whose gradients shrink exponentially with the number of qubits[5].
Scan the H₂ bond and find the minimum with eigenkit
import numpy as np
from eigenkit import Circuit, minimize_expectation
from eigenkit.chemistry import exact_ground_state_energy, hydrogen_molecule, jordan_wigner, uccsd_ansatz
bonds = np.round(np.arange(0.71, 0.761, 0.01), 2) # 0.71 to 0.76 Angstrom
energies = []
for r in bonds:
molecule = hydrogen_molecule(bond_length=r, basis="sto-3g")
observable, offset = jordan_wigner(molecule.fermion_operator)
ansatz = uccsd_ansatz(molecule.n_qubits, molecule.n_electrons, reps=1)
# Start at the Hartree-Fock state: all UCCSD angles zero.
circuit = Circuit(ansatz, observables=observable)
result = minimize_expectation(circuit, initial_parameters=np.zeros(ansatz.n_weights))
energy = result.optimal_value + offset
exact = exact_ground_state_energy(observable, molecule.n_qubits, offset)
energies.append(energy)
print(f"{r:.2f} VQE {energy:.6f} VQE-exact {1000 * (energy - exact):.4f} mHa HF-exact {1000 * (molecule.hf_energy - exact):.1f} mHa")
a, b, _ = np.polyfit(bonds, energies, 2)
print(f"equilibrium bond length {-b / (2 * a):.3f} Angstrom")
# 0.71 VQE -1.136750 VQE-exact 0.0000 mHa HF-exact 19.2 mHa
# ...
# 0.76 VQE -1.136796 VQE-exact 0.0000 mHa HF-exact 21.4 mHa
# equilibrium bond length 0.735 AngstromRuns in about a second with eigenkit 1.1.0 and pip install eigenkit[chemistry] (PySCF and OpenFermion), on the built-in NumPy simulator. It prints the VQE energy in hartree, its gap to the exact energy (zero to four decimals) and the Hartree-Fock gap at each bond length, then the vertex of a parabola through the six points. VQE(random_state=0).solve(observable, molecule.n_qubits, offset=offset, ansatz=ansatz) gives the same energies for from a random start; for LiH, use the Hartree-Fock start shown here.
VQE against the classical methods for the same curve
Every point on this page is a problem classical quantum chemistry solves routinely. is the number of basis functions, or of spin orbitals for the qubit methods, and the target precision of the energy.
| Method | How the cost grows | On this run |
|---|---|---|
| Hartree-Fock | About , polynomial | Never within chemical accuracy; off by up to 159 mHa on LiH |
| CCSD(T) | , the usual reference method | Within 0.00002 mHa of exact on LiH, in 0.032 s per point |
| Full configuration interaction (FCI) | Combinatorial in orbitals and electrons, so exponential | Exact; 0.011 s per point for all 12 LiH qubits |
| DMRG and other tensor network methods | Polynomial at a fixed bond dimension; accurate when entanglement is limited | Not run here; the classical tool for larger active spaces |
| VQE with UCCSD | About circuit parameters and Pauli terms, and on hardware shots growing as | Exact from the Hartree-Fock start, 1.63 s ± 0.38 s per LiH point on a simulator |
The case for VQE is the last row's cost on a device large and accurate enough to need no simulator, for molecules where FCI is out of reach and CCSD(T) is unreliable. That case has not been demonstrated; the review by Tilly and colleagues sets out which pre-factors still stand in the way[7].
What would change this result
This run asks whether VQE reproduces exact chemistry where exact chemistry is cheap, and from the right start it does. The question that matters runs the other way: molecules where FCI is out of reach, because its cost is combinatorial in orbitals and electrons, and where CCSD(T) is unreliable, because the electrons are strongly correlated. A qubit register grows with the number of spin orbitals rather than combinatorially, and that is the case for chemistry on a quantum computer as the review by Tilly and colleagues sets it out, together with the pre-factors that still stand in its way[7]. Three conditions decide whether VQE gets there, and each can be tested before it is assumed.
More correlated electrons. With two active electrons, one Trotter step of UCCSD can represent the exact ground state and CCSD is exact by construction, which is why every method agreed here. The comparison becomes informative when they stop being exact: grow the active space and the electron count on a molecule your classical reference still solves, follow the curve out to stretched bonds, and watch where VQE and CCSD(T) part from the exact energy. Past FCI, the bar is DMRG and the other tensor network methods, not FCI.
An optimiser that finds the ground state. Random starts failed on LiH, and deeper generic circuits meet barren plateaus[5]. The Hartree-Fock start and a chemistry-aware ansatz are what made this run exact, and a larger molecule needs the same discipline, checked against a reference at every point it can be.
Hardware with fewer errors and cheaper measurement. On a device every energy comes from shots, and the measurement count alone keeps VQE short of an advantage for small organic molecules in Gonthier and colleagues' analysis[6]; chemical accuracy needs gate errors far below today's typical values, or error mitigation[8]. Those are properties of the device, so they can be checked: which QPUs could run a circuit of this size within their error budget, and how far a real run lands from the simulator. Phase estimation on error-corrected hardware is the other route, and where quantum computing will help first collects its resource estimates for the molecules that matter. Our guide to quantum computing for chemistry sets the largest hardware runs so far against the classical methods for the same molecules.
Running a bond scan with VQE that you can trust
The order that kept our run honest, and the eigenkit calls for each step.
Build one Hamiltonian per bond length
molecular_hamiltonian(geometry, basis="sto-3g")runs PySCF and returns the fermionic operator, the electron count and the Hartree-Fock energy;hydrogen_molecule(bond_length)is the shortcut for . A scan is a loop you write over these calls, as in the sample above. The chemistry guide has the details.Choose the active space before the ansatz
Freezing core orbitals cuts qubits and Pauli terms at a small, measurable cost: here a fraction of a millihartree. eigenkit's chemistry module builds the full orbital space, so the run built the frozen-core operator with OpenFermion's
get_molecular_hamiltonian(occupied_indices=..., active_indices=...)and passed it in withfermion_operator_from_openfermion.Start UCCSD at the Hartree-Fock state
With all UCCSD angles at zero the circuit prepares the Hartree-Fock state. Pass
initial_parameters=np.zeros(ansatz.n_weights)tominimize_expectation, the loopVQE.solveruns; theVQEclass itself draws random starting angles and keeps the best ofrestartsruns. The ansatz section of the guide compares UCCSD with the hardware-efficient default.Check every point against a reference
success=Truemeans the optimiser stopped, not that the energy is right. Compare withexact_ground_state_energywhile the system fits in memory (about 14 qubits, per the docs on checking the answer), and with PySCF's FCI or CCSD(T) beyond that.Read the minimum from a fine grid
A coarse grid misplaces the minimum by more than any method error on this page. Use points 0.01 Å apart around the lowest energy and fit a parabola through the nearest five, as the run did.
Treat hardware as a separate experiment
On a device every energy is estimated from shots per group of Pauli terms, and a parameter-shift gradient costs two energy estimates per parameter (gradients on hardware). Dalton and colleagues found that the best VQEs need gate-error probabilities between and [8], or and [8] with error mitigation, to reach chemical accuracy on molecules with 4–14 orbitals[8]. A practical first run trains the angles on the simulator and evaluates the energy at those fixed angles on a QPU (recommended workflow), so the gap to the simulator measures the device.
Run it on a real QPU with EigenOrbit RouterThe H₂ circuit at one bond length, with angles trained on the simulator, evaluated on a real QPU to measure how far shots and gate noise move the energy from the exact value.In eigenkit: pip install "eigenkit[router]", then provider=RouterConfig(device=...) (docs).
Questions
Can VQE find the equilibrium bond length of a molecule?
Yes, by computing the energy on a grid of bond lengths and taking the minimum. In our simulator run on H₂ and LiH in the STO-3G basis, VQE found the same equilibrium bond length as the exact solution of that basis. That bond length differs from experiment because of the small basis, not because of VQE.
How accurate is VQE for LiH?
On a noiseless simulator, with the Li 1s orbital frozen and a UCCSD ansatz started from the Hartree-Fock state, it stayed within chemical accuracy of the exact energy at every bond length we ran. From random starting angles none of the LiH runs reached chemical accuracy: each stopped in a local minimum. With shots and gate noise on real hardware the error would be larger.
Is VQE faster than classical quantum chemistry?
Not for any molecule that has been run so far. For LiH in a minimal basis, PySCF's full configuration interaction solves each geometry exactly in a small fraction of the time VQE needs on a simulator, and CCSD(T) is just as accurate. Published resource analyses find that the number of measurements alone keeps VQE short of a practical advantage for small organic molecules.
Why does VQE converge to the wrong energy?
Because the optimiser can stop at a local minimum or at an excited state the ansatz can represent, and a stopped optimiser looks the same either way. In our LiH runs a random start converged to states far above chemical accuracy, while the Hartree-Fock start reached the exact energy. Always compare against an exact or classical reference while the system is small enough.
Can VQE run on real quantum hardware for chemistry?
Yes, for small molecules: hydrogen, lithium hydride and beryllium hydride have been run on devices of a few qubits. Reaching chemical accuracy needs gate errors far below today's typical values, or error mitigation and many shots. A sensible first hardware run evaluates the energy at angles trained on a simulator and compares the two.
Sources
- A. Peruzzo, J. McClean, P. Shadbolt, M.-H. Yung, X.-Q. Zhou, P. J. Love, A. Aspuru-Guzik, J. L. O'Brien. A variational eigenvalue solver on a photonic quantum processor. Nature Communications 5, 4213, 2014. arXiv:1304.3061.
- P. J. J. O'Malley, R. Babbush, I. D. Kivlichan, J. Romero, J. R. McClean, R. Barends, J. Kelly, P. Roushan et al. Scalable quantum simulation of molecular energies. Physical Review X 6, 031007, 2016. arXiv:1512.06860.
- A. Kandala, A. Mezzacapo, K. Temme, M. Takita, M. Brink, J. M. Chow, J. M. Gambetta. Hardware-efficient variational quantum eigensolver for small molecules and quantum magnets. Nature 549, 242–246, 2017. arXiv:1704.05018.
- F. Arute, K. Arya, R. Babbush, D. Bacon, J. C. Bardin, R. Barends, S. Boixo, M. Broughton et al. Hartree-Fock on a superconducting qubit quantum computer. Science 369, 1084–1089, 2020. arXiv:2004.04174.
- J. R. McClean, S. Boixo, V. N. Smelyanskiy, R. Babbush, H. Neven. Barren plateaus in quantum neural network training landscapes. Nature Communications 9, 4812, 2018. arXiv:1803.11173.
- J. F. Gonthier, M. D. Radin, C. Buda, E. J. Doskocil, C. M. Abuan, J. Romero. Measurements as a roadblock to near-term practical quantum advantage in chemistry: resource analysis. Physical Review Research 4, 033154, 2022. arXiv:2012.04001.
- J. Tilly, H. Chen, S. Cao, D. Picozzi, K. Setia, Y. Li, E. Grant, L. Wossnig, I. Rungger, G. H. Booth, J. Tennyson. The variational quantum eigensolver: a review of methods and best practices. Physics Reports 986, 1–128, 2022. arXiv:2111.05176.
- K. Dalton, C. K. Long, Y. S. Yordanov, C. G. Smith, C. H. W. Barnes, N. Mertig, D. R. M. Arvidsson-Shukur. Quantifying the effect of gate errors on variational quantum eigensolvers for quantum chemistry. npj Quantum Information 10, 18, 2024. arXiv:2211.04505.
- Q. Sun, X. Zhang, S. Banerjee, P. Bao, M. Barbry, N. S. Blunt, N. A. Bogdanov, G. H. Booth et al. Recent developments in the PySCF program package. Journal of Chemical Physics 153, 024109, 2020. arXiv:2002.12531.
- K. P. Huber, G. H. Herzberg. Constants of diatomic molecules: hydrogen. NIST Chemistry WebBook, NIST Standard Reference Database 69, 1979.
- K. P. Huber, G. H. Herzberg. Constants of diatomic molecules: lithium hydride. NIST Chemistry WebBook, NIST Standard Reference Database 69, 1979.
Run it yourself with eigenkit
eigenkit is EigenOrbit's open-source Python library: write a circuit once, run it on any simulator or QPU, and test it against a classical baseline on your own data before you invest in it or rule it out.
$ pip install eigenkit