English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

Computing the H2 Bond Length with VQE: A Hands-On Walkthrough

Forum topic · 小凯 · 2026-11-07

Summary

This tutorial from zhichai.net's quantum computing column walks through computing the H2 molecule's equilibrium bond length (~0.74 angstrom) using the Variational Quantum Eigensolver (VQE). The post breaks the hybrid quantum-classical workflow into five concrete steps: translating the molecular Hamiltonian into weighted Pauli strings, building a minimal 2-parameter ansatz circuit, grouping measurements by axis, letting a classical optimizer iterate parameters, and scanning multiple internuclear distances to map the energy curve and locate its minimum. On simulators the curve reproduces the textbook value within thousandths; on real hardware noise raises the whole curve but leaves the minimum nearly unchanged, because the variational optimizer partially absorbs systematic errors. Cost estimates: minutes of quantum hardware time per point, so the author recommends simulating the full curve and validating only three points on real devices. The piece frames H2 as quantum chemistry's 'fruit fly'—a calibration exercise on a classically solvable system—before scaling toward LiH, BeH, and eventually FeMoco, where measurement groups and circuit depth grow but the workflow stays the same.

Two hydrogen atoms: how close should they sit? The textbook answer is 0.74 angstrom, a number that originally came from spectroscopy. On this installment you can compute it yourself on a quantum machine.

H2, the smallest molecule, is quantum chemistry's "fruit fly"—simplest structure, everyone practices on it. This post takes the paper workflow from the earlier VQE episode and puts it on the keyboard: you watch the classical optimizer and the quantum processor talk back and forth, digging an energy curve out of the noise.

The Shape of the Problem: Find the Valley Bottom

A molecule's energy varies with internuclear distance, and the bond length is the minimum of the energy curve. "Computing the bond length" means scanning the curve and finding the valley—VQE is the machine that measures one point's energy; measure many points, connect them, find the minimum.

Honest boundary first: H2 is exactly solvable on a classical computer in seconds (a rare exception). The point of this exercise is not beating classical computing—it is calibrating the whole pipeline: verify the instrument on a problem with a known answer before attacking unknown ones.

VQE in Five Practical Steps

Step 1 — Chemistry layer: translate the molecule into Pauli strings. Choose a basis set and convert H2's electronic-structure Hamiltonian into a weighted sum of Pauli operators—the minimal model has only a few terms (XX-type, ZZ-type, IZ terms). The molecule becomes "a list of gates plus a list of coefficients."

Step 2 — Quantum layer: build the ansatz circuit. The ansatz (a parameterized circuit with knobs) for minimal H2 needs just 2 tunable parameters: a rotation layer plus an entangling layer (CNOT), repeated once or twice. Few knobs, but enough to sweep the curve.

Step 3 — Measurement layer: grouped energy readout. Each Hamiltonian term is measured separately (different terms measured on different axes), each group running a few hundred shots; the weighted sum gives the energy expectation at this parameter setting.

Step 4 — Classical layer: the optimizer adjusts parameters. The energy value goes to a classical optimizer, which computes the direction that lowers the energy and sends updated parameters back—loop until the energy stops decreasing (convergence near the valley).

Step 5 — Sweep: multiple points, one curve. Fix a distance, run the four steps, get one energy point; change the distance (0.5, 0.6, 0.74, 0.9, 1.2 Å, ...) and repeat—every point is a full VQE run. The valley's x-coordinate is the bond length.

Expected Results and the Robustness of Variational Methods

On a simulator: a smooth curve with the minimum at 0.73–0.74 Å—the textbook number reproduced on the spot, error in the thousandths.

On real hardware: noise lifts the entire curve (each measured energy reads high), but the minimum's position stays relatively stable. The optimizer finds the new lowest point on the noisy landscape, and part of the systematic error gets absorbed into the parameters—the variational method is naturally robust to some noise, which is why it holds a mainstay position in the NISQ transition era.

Cost Accounting and Practical Advice

One bond-length point: a few dozen measurement groups × a few hundred shots each × dozens of optimizer iterations—real-machine time on the order of minutes. Sweeping a full curve of a dozen-plus points will hurt on free-tier quotas. Practical advice: sweep the full curve on the simulator; validate only three points on real hardware (the valley bottom plus the two shoulders).

From Fruit Fly to Real Bird

Scaling route: LiH → BeH → ... → FeMoco (the nitrogenase active site). Each step up raises the measurement-group count and circuit depth—the workflow unchanged, the ledger growing exponentially. Consensus view: VQE first targets "medium molecules classical computers can't handle"; jumping straight to FeMoco waits for fault-tolerant machines.

Taking the Analogy Apart

  • Disanalogy one: the fruit fly is cheap because it is easy to keep; H2 is cheap because classical machines can also solve it. Running it on a quantum device is instrument calibration, not new knowledge.
  • Disanalogy two: H2's workflow extrapolates; its cost does not—method extrapolation is linear, compute demand extrapolation is exponential. Extrapolate the method, not the ledger.

Key Takeaways

1. VQE in five steps: translate (Pauli strings) → circuit (2-knob ansatz) → measure (axis-grouped readout) → optimize (classical assistant) → sweep and find the valley. 2. Variational robustness: noise lifts the curve but doesn't move the minimum—parameters absorb part of the systematic error. 3. Cost reality: minutes of hardware time per point—simulate the curve, validate three points on hardware; scale up the ladder but remember the ledger grows exponentially.

Next stop: switching from "computing molecules" to "blocking eavesdroppers"—episode 094, a hands-on BB84 attack-and-defense simulator, where you play Eve and watch the 25% error rate betray you.

Tags

#quantum-computing#vqe#quantum-chemistry#hydrogen-molecule#nisq#variational-methods#tutorial

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/178636927