VQE H2 Ground State — Peruzzo et al. 2014
Known limitation (October 2026): This demo's Hamiltonian counts the exchange term twice (it adds Y0Y1 with the same coefficient as X0X1), so its lowest energy is -1.9153 Ha instead of the correct -1.8573 Ha (electronic energy of H2 at 0.735 Å; -1.1373 Ha once nuclear repulsion is added), and its "chemical accuracy" check measures against that wrong value. Away from 0.74 Å it rescales the coefficients by 0.74/R instead of computing them, so its energy keeps falling as R shrinks (about -4.7 Ha at 0.3 Å) and the curve has no minimum. The page still shows the one-parameter ansatz, the energy landscape E(θ) and a grid-search VQE loop. A corrected version is planned.
- First-ever experimental VQE on a photonic quantum processor
- Applies VQE to H2 in simulation; the original Peruzzo experiment computed the helium hydride ion (HeH+), and H2 was later computed with VQE on superconducting qubits by O'Malley et al. (2016)
- Scans bond lengths with a toy model (the paper's dissociation curve, its Figure 4, is for HeH+)
- Demonstrates the hybrid classical-quantum optimization paradigm that underpins all modern variational quantum algorithms
| Property | Value |
|---|---|
| Level | Advanced |
| Estimated Time | 60-90 minutes |
| Qubits | 2 |
| Framework | Qiskit |
| Category | Research Reproduction |
| Gates | X, RY, CX |
| Circuit Depth | 3 |
Prerequisites
Before tackling this circuit, you should be comfortable with:
- VQE fundamentals: Complete the H2 Ground State (intermediate VQE) circuit first
- Quantum chemistry basics: Hamiltonian mapping, Jordan-Wigner transformation, basis sets
- Variational algorithms: Cost function landscapes, parameter optimization, barren plateaus
- Linear algebra: Pauli operators, expectation values, tensor products
The Idea
In 2014, Alberto Peruzzo and collaborators at the University of Bristol ran the first VQE experiment, on a photonic chip, computing the ground-state energy of the helium hydride ion (HeH+). This was not just a toy demonstration; it introduced the Variational Quantum Eigensolver (VQE), an algorithm specifically designed for the noisy, limited quantum hardware available today.
The key insight was elegantly simple: instead of requiring deep quantum circuits that would accumulate too many errors, use a shallow parameterized circuit and let a classical optimizer tune the parameters. The quantum processor only needs to prepare trial states and measure energies — the hard optimization work happens classically. This hybrid approach sidesteps the coherence-time limitations that make fault-tolerant algorithms impractical on near-term devices.
The original experiment used a custom silicon photonic chip with two photonic qubits, encoding quantum information in the path degree of freedom of single photons. Phase shifters controlled rotations, and a directional coupler provided the entangling interaction. The chip was reconfigurable (8 phase shifters and one CNOT gate) and could prepare an arbitrary two-qubit state. With it, the experiment reached chemical accuracy for HeH+, an error below about 1.6 milliHartree (1 kcal/mol): more than 96% of its data points were within that threshold of the theoretical values.
How It Works
The reproduction follows the same four-step VQE protocol as the original paper:
-
Map the molecule to qubits: The H2 electronic Hamiltonian in the minimal STO-3G basis has 4 spin orbitals, so the Jordan-Wigner (or parity) mapping gives a 4-qubit operator; particle-number and spin symmetries then remove two qubits, leaving a 2-qubit Hamiltonian with the terms II, Z0, Z1, Z0Z1 and X0X1. (This demo's code also adds a Y0Y1 term; see The Math.)
-
Prepare a trial state: The UCCSD (Unitary Coupled-Cluster Singles and Doubles) ansatz creates a parameterized quantum state. For H2 in minimal basis, the entire ansatz reduces to a single parameter theta:
- Start with the Hartree-Fock reference state |01> (X gate on qubit 0)
- Apply RY(theta) on qubit 1 to create a superposition
- Entangle with a CNOT gate
CODE+---+ q_0: | X |──────────X─── +---+ +-------+| q_1: ─────-| RY(θ) |X─── +-------+ -
Measure the energy: Evaluate the expectation value <psi(theta)|H|psi(theta)> by measuring each Pauli term of the Hamiltonian. In simulation, this is done via exact statevector computation; on hardware, it requires multiple measurement bases.
-
Optimize classically: Sweep theta across [-pi, pi] to find the angle that minimizes the energy. The original paper used a Nelder-Mead simplex optimizer; this reproduction uses a grid search for transparency and reproducibility.
Away from 0.74 angstrom, this demo's code does not compute new Hamiltonian coefficients: it rescales the equilibrium set by 0.74/R (the ZZ term by (0.74/R)²). That toy model does not produce a binding curve (its energy keeps falling as R shrinks); a real dissociation curve needs coefficients computed at each geometry, for example with PySCF.
The Math
The standard 2-qubit form of the H2 Hamiltonian (after the mapping and symmetry reduction described above) is:
H = g_0 * I + g_1 * Z_0 + g_2 * Z_1 + g_3 * Z_0 Z_1 + g_4 * X_0 X_1
This demo's code instead uses g_4 * (X_0 X_1 + Y_0 Y_1) with the same g_4. On the states the ansatz can reach, Y_0 Y_1 acts exactly like X_0 X_1, so the code doubles the exchange coupling: its lowest eigenvalue is -1.9153 Ha instead of -1.8572 Ha. (Equivalently, the correct Hamiltonian can be written with 0.0905 on each of X_0 X_1 and Y_0 Y_1.)
Coefficients near equilibrium (STO-3G basis; these are the standard values for R = 0.735 angstrom, which the code applies at 0.74 angstrom):
| Coefficient | Value (Ha) | Physical meaning |
|---|---|---|
| g_0 | -1.0523 | Constant electronic term (excludes the nuclear repulsion, 0.7200 Ha at 0.735 Å) |
| g_1 | +0.3979 | Orbital energy (qubit 0) |
| g_2 | -0.3979 | Orbital energy (qubit 1) |
| g_3 | -0.0112 | Electron-electron correlation (ZZ) |
| g_4 | +0.1809 | Exchange coupling (X_0 X_1; the code applies it to both XX and YY) |
The UCCSD ansatz prepares the state:
|psi(theta)> = cos(theta/2) |01> + sin(theta/2) |10>
The energy as a function of theta is:
E(theta) = (g_0 - g_3) + (g_2 - g_1) * cos(theta) + g_4 * sin(theta)
With the code's XX + YY term, the last coefficient is 2 * g_4 instead of g_4.
Minimizing E(theta) yields the ground-state energy. The variational principle guarantees E(theta_opt) >= E_exact, with equality when the ansatz is expressive enough (which it is for this 2-qubit system).
Expected Output
Dissociation Curve
What the quick start below prints (n_steps = 50), next to reference STO-3G full configuration interaction (FCI) energies computed with PySCF. The code's values exclude nuclear repulsion, so compare them with the electronic column. They are not a dissociation curve.
| Bond Length (angstrom) | This code's output (Ha, toy model) | STO-3G FCI, electronic (Ha) | STO-3G FCI, total (Ha) |
|---|---|---|---|
| 0.30 | -4.6833 | -2.3657 | -0.6018 |
| 0.50 | -2.8263 | -2.1135 | -1.0552 |
| 0.74 | -1.9151 | -1.8524 | -1.1373 |
| 1.00 | -1.4193 | -1.6303 | -1.1012 |
| 1.50 | -0.9476 | -1.3509 | -0.9981 |
| 2.00 | -0.7112 | -1.2132 | -0.9486 |
Key Metrics
- Equilibrium energy: the code returns -1.9108 Ha at the default n_steps=30 and -1.9151 Ha at n_steps=50 (its model Hamiltonian, no nuclear repulsion). The true STO-3G FCI energy near equilibrium is -1.1373 Ha total (-1.8573 Ha electronic at 0.735 Å).
- "Chemical accuracy" flag: compares the grid-search result with -1.9153 Ha, the minimum of the code's own Hamiltonian, so it only checks the optimizer against that model. At the default n_steps=30 the error is 4.5 mHa and the flag is False; at n_steps=50 it is 0.2 mHa. It is not a chemical-accuracy result against the true H2 energy, which is 58 mHa away in electronic energy.
- Optimal theta: about -0.43 rad for the code's Hamiltonian (the grid finds -0.325 at n_steps=30 and -0.449 at n_steps=50) and about -0.22 rad for the correct one. Both mean the Hartree-Fock state |01> with a small admixture of |10>; theta = pi gives |10> alone, at -0.245 Ha, near the top of the landscape.
- Verification: 4 automated checks (chemical accuracy, variational bound, dissociation shape, parameter physicality). All 4 pass at n_steps=30 and 50, but the first two measure against the code's own -1.9153 Ha (the first allows 5 times the 1.6 mHa threshold), and the dissociation check passes only because the lowest energy of the falling toy curve (at 0.3 Å) lies inside its 0.2 to 1.2 Å window.
Note: Away from 0.74 Å the code rescales the coefficients by 0.74/R, which is not a physical model of H2. At 0.74 Å it uses the standard 2-qubit coefficients, but with the doubled exchange term described above. The paper itself did not compute H2.
Running the Circuit
Quick Start
PYTHONfrom circuit import run_circuit # Scan bond lengths (toy model away from 0.74 angstrom; see Expected Output) result = run_circuit( bond_lengths=[0.3, 0.5, 0.74, 1.0, 1.5, 2.0, 2.5, 3.0], n_steps=50 ) # Print results for r, data in result["bond_length_scan"].items(): print(f"R = {r:.2f} angstrom: E = {data['energy']:.6f} Ha") print(f"\nChemical accuracy: {result['chemical_accuracy']}")
Run Verification
PYTHONfrom circuit import run_circuit result = run_circuit(n_steps=50) verification = result["verification"] print(verification["summary"]) for name, check in verification["checks"].items(): status = "PASS" if check["passed"] else "FAIL" print(f" [{status}] {name}: {check['detail']}")
From the Command Line
BASHcd circuits/advanced/research_reproductions/vqe_h2_peruzzo/ python circuit.py
On QubitHub
BASHqubithub execute qubithub/vqe-h2-peruzzo
Try It Yourself
-
Increase grid resolution: Change
n_stepsfrom 30 to 200 and observe how the energy converges to the minimum of this model Hamiltonian (-1.9153 Ha). Plot E(theta) to visualize the energy landscape: it should have a single clear minimum. -
Compare basis sets: The STO-3G minimal basis used here is the simplest possible. Research how the Hamiltonian coefficients change with larger basis sets (6-31G, cc-pVDZ) and how many more qubits would be needed.
-
Add shot noise: The current implementation uses exact statevector simulation. Modify
compute_expectation()to use finite shots (e.g., 1024, 4096, 8192) and observe how statistical noise affects the energy estimate and chemical accuracy. -
Implement a real optimizer: Replace the grid search with
scipy.optimize.minimizeusing Nelder-Mead (as in the original paper) or COBYLA. Compare the number of circuit evaluations needed vs. the grid search approach. -
Extend to LiH or HeH+: Molecular hydrogen is the simplest case. Research how VQE scales to 4-qubit molecules like lithium hydride (LiH) — what changes in the ansatz, Hamiltonian, and classical optimization?
What's Next
After mastering this reproduction, explore these related circuits:
- LiH Ground State — Extend VQE to a 4-qubit molecular system
- QAOA MaxCut (Farhi 2014) — Another landmark variational algorithm paper
- Hardware-Efficient Ansatz — Modern ansatz designs that go beyond UCCSD
Applications
The VQE algorithm introduced in this paper has become foundational across quantum computing:
- Drug discovery: Simulating molecular interactions for pharmaceutical design (estimating binding energies, reaction barriers)
- Materials science: Predicting properties of novel materials (band gaps, magnetic ordering, superconductivity)
- Catalyst design: Optimizing catalytic reaction pathways by computing transition state energies
- Quantum chemistry benchmarking: VQE serves as the standard benchmark for comparing quantum hardware capabilities
- Algorithm development: The hybrid classical-quantum paradigm inspired QAOA, VQC, quantum kernel methods, and the entire field of variational quantum algorithms
References
-
Peruzzo, A. et al. "A variational eigenvalue solver on a photonic quantum processor." Nature Communications 5, 4213 (2014). DOI: 10.1038/ncomms5213 | arXiv: 1304.3061
-
McClean, J. R. et al. "The theory of variational hybrid quantum-classical algorithms." New Journal of Physics 18, 023023 (2016). DOI: 10.1088/1367-2630/18/2/023023 | arXiv: 1509.04279
-
O'Malley, P. J. J. et al. "Scalable quantum simulation of molecular energies on a superconducting qubit processor." Physical Review X 6, 031007 (2016). DOI: 10.1103/PhysRevX.6.031007 | arXiv: 1512.06860
-
Tilly, J. et al. "The Variational Quantum Eigensolver: a review of methods and best practices." Physics Reports 986, 1-128 (2022). DOI: 10.1016/j.physrep.2022.08.003 | arXiv: 2111.05176