VQE for LiH Molecule Ground State
What You'll Learn:
- How to scale VQE from 2 qubits (H2) to 4 qubits (LiH)
- How hardware-efficient ansatze use layered RY-RZ-CX structures
- How Pauli string measurements work for multi-qubit Hamiltonians
- Why larger molecules are harder: barren plateaus, parameter space, and noise
Level: Intermediate | Time: 30 minutes | Qubits: 4 | Framework: Qiskit
Prerequisites
- H2 Ground State — VQE fundamentals on 2 qubits
- Bell State — CX entanglement basics
The Idea
Hydrogen (H2) was a warm-up: 2 qubits, 4 parameters, a tiny Hamiltonian you could diagonalize by hand. Now we scale up. Lithium hydride (LiH) has 4 electrons — 3 from lithium and 1 from hydrogen — requiring 4 qubits in the minimal basis. The Hamiltonian grows from 5 terms to dozens (we use a simplified 9-term version), and the ansatz needs 16 parameters across 2 layers.
This is where VQE starts to earn its keep. At 4 qubits, classical diagonalization is still easy (16x16 matrix). But the same approach applied to larger molecules (caffeine: ~160 electrons) would require matrices far too large for any classical computer. VQE's hybrid quantum-classical loop scales more gracefully.
The catch: more parameters mean a larger optimization landscape, more circuit depth, and increased sensitivity to noise. Welcome to the real challenges of quantum chemistry.
How It Works
The Ansatz: 2-Layer Hardware-Efficient
Each layer has: (1) RY+RZ rotations on every qubit, then (2) a linear CX chain.
CODELayer 1 Layer 2 ┌────────┐┌────────┐ ┌─────────┐┌─────────┐ q0: ┤ RY(θ₀)├┤ RZ(θ₁)├──■────────── ┤ RY(θ₈) ├┤ RZ(θ₉) ├──■── ├────────┤├────────┤┌─┴─┐ ├─────────┤├─────────┤┌─┴─┐ q1: ┤ RY(θ₂)├┤ RZ(θ₃)├┤ X ├──■── ┤ RY(θ₁₀)├┤ RZ(θ₁₁)├┤ X ├──■── ├────────┤├────────┤└───┘┌─┴─┐ ├─────────┤├─────────┤└───┘┌─┴─┐ q2: ┤ RY(θ₄)├┤ RZ(θ₅)├─────┤ X ├──■── ┤ RY(θ₁₂)├┤ RZ(θ₁₃)├─────┤ X ├──■── ├────────┤├────────┤ └───┘┌─┴─┐ ├─────────┤├─────────┤ └───┘┌─┴─┐ q3: ┤ RY(θ₆)├┤ RZ(θ₇)├──────────┤ X ├ ┤ RY(θ₁₄)├┤ RZ(θ₁₅)├──────────┤ X ├ └────────┘└────────┘ └───┘ └─────────┘└─────────┘ └───┘
- RY: Controls the polar angle on the Bloch sphere (amplitude mixing)
- RZ: Controls the azimuthal angle (phase control)
- CX chain: Creates nearest-neighbor entanglement (0→1→2→3)
- 16 parameters: 4 qubits × 2 rotations × 2 layers
The linear CX connectivity matches most superconducting hardware (IBM, Google), making this ansatz directly executable without transpilation overhead.
The Hamiltonian: 9 Dominant Pauli Terms
The full LiH Hamiltonian in STO-3G has 100+ Pauli terms. We use a simplified version with the 9 largest contributions:
| Term | Coefficient | Physical meaning |
|---|---|---|
| IIII | -7.2062 | Constant offset (calibrated to FCI) |
| ZZII | +0.1722 | Z-Z correlation, qubits 0-1 |
| IIZZ | +0.1209 | Z-Z correlation, qubits 2-3 |
| ZIZI | +0.1659 | Alternating Z correlation |
| IZIZ | +0.1659 | Alternating Z correlation |
| XXII | +0.0454 | Exchange (XX), qubits 0-1 |
| YYII | +0.0454 | Exchange (YY), qubits 0-1 |
| IIXX | +0.0505 | Exchange (XX), qubits 2-3 |
| IIYY | +0.0505 | Exchange (YY), qubits 2-3 |
Measuring Multi-Qubit Pauli Strings
Each 4-character Pauli string requires its own measurement circuit. Before measuring, rotate each qubit into the appropriate basis:
- I or Z: No rotation (computational basis)
- X: Apply H (Hadamard)
- Y: Apply S†H
For example, to measure XXII, apply H on qubits 0 and 1 (the X positions), leave qubits 2 and 3 unchanged, then measure all in the computational basis.
PYTHONfrom circuit import run_circuit, optimize_vqe # Quick evaluation with initial parameters result = run_circuit() print(f"Energy: {result['energy']:.4f} Ha") # Full optimization (takes longer — 16 parameters) opt = optimize_vqe(max_iterations=200, shots=2048, seed=42) print(f"Optimized: {opt['optimal_energy']:.4f} Ha")
The Math
Scaling from H2 to LiH
| Property | H2 | LiH | Growth |
|---|---|---|---|
| Electrons | 2 | 4 | 2× |
| Qubits | 2 | 4 | 2× |
| Parameters | 4 | 16 | 4× |
| Hamiltonian terms | 5 | 9 (simplified) | 1.8× |
| Matrix size | 4×4 | 16×16 | 4× |
| Measurement circuits | 2 | 8 | 4× |
The parameter count grows as O(qubits × layers), and measurement circuits grow with the number of unique Pauli bases. This is the fundamental scaling challenge of VQE.
Barren Plateaus
With 16 parameters and 2 layers, the optimization landscape becomes flatter:
∂E/∂θ_i → 0 as circuit depth → ∞
The gradient of the cost function vanishes exponentially with circuit depth, making optimization harder. This is the barren plateau problem. Strategies:
- Use few layers (we use 2)
- Initialize near identity (small angles)
- Use problem-informed ansatze instead of hardware-efficient ones
Expected Output
| Metric | Value |
|---|---|
| Exact ground state (FCI/STO-3G) | -7.8825 Ha |
| VQE with optimized parameters | -7.8 to -7.9 Ha |
| Initial guess energy | ~-7.5 Ha |
| Chemical accuracy threshold | ±1.6 mHa |
With a simplified 9-term Hamiltonian, VQE may not reach chemical accuracy. The full 100+ term Hamiltonian is needed for production-quality results.
Running the Circuit
PYTHONfrom circuit import run_circuit, optimize_vqe, verify_vqe # Quick evaluation result = run_circuit() print(f"Energy: {result['energy']:.4f} Ha (error: {result['error']:.4f})") # Full optimization opt = optimize_vqe(max_iterations=200, shots=2048, seed=42) print(f"Optimized: {opt['optimal_energy']:.4f} Ha") print(f"Chemical accuracy: {opt['chemical_accuracy']}") # Verification v = verify_vqe() for check in v["checks"]: status = "PASS" if check["passed"] else "FAIL" print(f"[{status}] {check['name']}: {check['detail']}")
Try It Yourself
-
Add a 3rd layer: Change
layers=3and use 24 parameters. Does the extra depth improve the energy, or does it hit a barren plateau? -
Reduce to 1 layer: Use only 8 parameters. How much accuracy is lost? This quantifies the expressibility vs. trainability trade-off.
-
Try full connectivity: Replace the linear CX chain with all-to-all CX (0→1, 0→2, 0→3, 1→2, 1→3, 2→3). Does this improve convergence?
-
Compare optimizers: Try
method="Nelder-Mead"ormethod="Powell". Which handles the 16-dimensional landscape best? -
Plot the potential energy surface: Run VQE at Li-H bond lengths from 1.0 to 3.0 A (adjust coefficients). Does VQE reproduce the Morse potential shape?
What's Next
- H2O Ground State — 4 qubits with active space reduction for water
- BeH2 Ground State — 6 qubits, the largest in the VQE progression
- QAOA MaxCut — Variational algorithms for optimization (not chemistry)
Applications
| Domain | Use case |
|---|---|
| Benchmark | Standard test for VQE implementations beyond H2 |
| Education | Stepping stone from 2-qubit to multi-qubit chemistry |
| Algorithm R&D | Testing ansatz designs, optimizer strategies, error mitigation |
| Materials | LiH is a precursor to lithium-ion battery materials |
References
- Kandala, A. et al. (2017). "Hardware-efficient variational quantum eigensolver for small molecules and quantum magnets." Nature 549, 242-246. DOI: 10.1038/nature23879
- Peruzzo, A. et al. (2014). "A variational eigenvalue solver on a photonic quantum processor." Nature Communications 5, 4213. DOI: 10.1038/ncomms5213
- McClean, J.R. et al. (2018). "Barren plateaus in quantum neural network training landscapes." Nature Communications 9, 4812. DOI: 10.1038/s41467-018-07090-4