|q⟩ Bad Qubits

advanced · Programming · Capstone Projects

Project: Molecular Ground State

Computing molecular ground-state energies is the application most often cited as a near-term payoff for quantum computers. This capstone walks the smallest real example — the hydrogen molecule H2\mathrm{H}_2 — from its electronic Hamiltonian down to a two-qubit state you can prepare and check.

From molecule to qubits

The electronic structure problem asks for the lowest eigenvalue E0E_0 of the molecular Hamiltonian in a chosen basis. For H2\mathrm{H}_2 in a minimal (STO-3G) basis, the second-quantized Hamiltonian maps — via the Jordan–Wigner or Bravyi–Kitaev transform — to a sum of Pauli strings on four qubits. Exploiting particle-number and parity symmetries reduces this to an effective two-qubit Hamiltonian of the form

H=g0I+g1Z0+g2Z1+g3Z0Z1+g4X0X1+g5Y0Y1,H = g_0 I + g_1 Z_0 + g_2 Z_1 + g_3 Z_0 Z_1 + g_4 X_0 X_1 + g_5 Y_0 Y_1,

with real coefficients gig_i that depend on the bond length RR. This is the model used by O'Malley et al. (2016) in the first VQE measurement of an H2\mathrm{H}_2 curve.

The relevant subspace

Number conservation confines the ground state to the single-excitation sector spanned by 01|01\rangle and 10|10\rangle. The ansatz

ψ(θ)=cosθ201sinθ210|\psi(\theta)\rangle = \cos\tfrac{\theta}{2}\,|01\rangle - \sin\tfrac{\theta}{2}\,|10\rangle

is therefore expressive enough to reach the true ground state with a single parameter θ\theta. The classical optimizer varies θ\theta to minimize ψ(θ)Hψ(θ)\langle\psi(\theta)|H|\psi(\theta)\rangle.

The converged state

At the equilibrium bond length the X0X1X_0X_1 and Y0Y1Y_0Y_1 coupling drives the optimizer to the symmetric mixing angle θ=π/2\theta = \pi/2, producing the singlet-like state

ψ=12(0110).|\psi\rangle = \frac{1}{\sqrt{2}}\bigl(|01\rangle - |10\rangle\bigr).

This is the lowest-energy combination of the two configurations: the antisymmetric superposition maximizes the favorable exchange term, exactly as the variational principle predicts.

Try it

Prepare the converged ground state (0110)/2(|01\rangle - |10\rangle)/\sqrt{2} with the supplied gate recipe. The grader checks the two-qubit statevector.

Run your code to see the quantum state.

Sign in on the full site to ask questions and join the discussion.