|q⟩ Bad Qubits

advanced · Programming · Quantum Chemistry on Quantum Computers

Checkpoint: Ground-State Energy

This checkpoint ties the module together: starting from a molecular qubit Hamiltonian, you compute the electronic ground-state energy of molecular hydrogen — the quantity a VQE run on real hardware is designed to estimate.

The full pipeline, recalled

Everything in this module feeds one number:

  1. Electronic structure problem — the Born–Oppenheimer electronic Hamiltonian.
  2. Second quantization — rewrite it in fermionic creation/annihilation operators with molecular integrals.
  3. Jordan–Wigner — map fermions to qubits; the Hamiltonian becomes a weighted sum of Pauli strings.
  4. Tapering — symmetries reduce H2\text{H}_2 to two qubits: H^=g1Z0+g2Z1+g3Z0Z1+g4Y0Y1+g5X0X1\hat H = g_1 Z_0 + g_2 Z_1 + g_3 Z_0 Z_1 + g_4 Y_0 Y_1 + g_5 X_0 X_1.
  5. Hartree–Fock — the reference state 01|01\rangle and its (uncorrelated) energy.
  6. VQE / UCC — a particle-preserving ansatz that mixes 01|01\rangle and 10|10\rangle to find the true ground state.

Reducing to a 2×2 eigenproblem

Because the Hamiltonian conserves particle number and spin, its ground state is confined to the single-excitation subspace {01,10}\{|01\rangle, |10\rangle\}. There H^\hat H is the 2×22\times2 matrix

H^sub=(accb),a=01H^01=g1g2g3,b=10H^10=g1+g2g3,c=g4+g5,\hat H_{\text{sub}} = \begin{pmatrix} a & c \\ c & b \end{pmatrix}, \qquad \begin{aligned} a &= \langle 01|\hat H|01\rangle = g_1 - g_2 - g_3,\\ b &= \langle 10|\hat H|10\rangle = -g_1 + g_2 - g_3,\\ c &= g_4 + g_5, \end{aligned}

where aa and bb come from the diagonal ZZ terms (using Z0=+0Z|0\rangle = +|0\rangle, Z1=1Z|1\rangle = -|1\rangle) and cc from the off-diagonal X0X1+Y0Y1X_0X_1 + Y_0Y_1 terms, both of which map 1001|10\rangle \to |01\rangle with coefficient +1+1. The electronic ground-state energy is the lower eigenvalue,

E0=a+b2(ab2)2+c2.E_0 = \frac{a+b}{2} - \sqrt{\left(\frac{a-b}{2}\right)^2 + c^2}.

This is exactly the energy the one-parameter VQE ansatz from the earlier lesson converges to — diagonalizing the 2×22\times2 block analytically here gives the same answer VQE finds variationally.

Try it

Using the equilibrium H2\text{H}_2 coefficients g1=0.3435g_1 = 0.3435, g2=0.4347g_2 = -0.4347, g3=0.5716g_3 = 0.5716, g4=g5=0.0910g_4 = g_5 = 0.0910 (Hartree), build the 2×22\times2 subspace block and return the lower eigenvalue — the electronic ground-state energy. The grader also checks that your answer lies below the Hartree–Fock energy aa, confirming you captured the correlation energy.

Run your code to see the quantum state.

You have now carried a molecule from its electronic Hamiltonian all the way to a ground-state energy — the complete quantum-chemistry workflow in miniature.

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