UCCSD Ansatz
What You'll Learn: How the gold-standard quantum chemistry ansatz encodes electron correlation into a parameterised quantum circuit, using coupled-cluster theory translated through the Jordan-Wigner transformation.
- Map fermionic excitation operators to qubit gates via Jordan-Wigner
- Build a variational circuit that captures single and double electron excitations
- Understand why UCCSD is the default ansatz for VQE-based molecular simulation
Level: Advanced | Time: 60 minutes | Qubits: 4 | Framework: Cirq
Prerequisites
- Familiarity with single-qubit gates (RY, RZ) and CNOT
- Understanding of the Variational Quantum Eigensolver (VQE) loop
- Basic quantum chemistry concepts: orbitals, electrons, Hartree-Fock
- Comfort with second-quantised notation (creation/annihilation operators)
Recommended prior circuits: Hardware-Efficient Ansatz | VQE H2 Ground State
The Idea
Classical computational chemistry has a workhorse method called Coupled Cluster (CC). It works by "exciting" electrons from occupied orbitals into virtual (unoccupied) orbitals, building up correlations that the simple Hartree-Fock picture misses. The standard CCSD (singles and doubles) truncation captures the vast majority of correlation energy for most molecules.
The problem is that classical CC uses a non-unitary exponential operator, which is fine for a classical computer but impossible to implement directly on a quantum processor (all quantum operations must be unitary). The fix is simple in principle: replace the cluster operator T with the anti-Hermitian combination T - T†. Exponentiating an anti-Hermitian operator always gives a unitary. This is the Unitary Coupled Cluster (UCC) ansatz.
On a classical computer, UCC is exponentially expensive because the Baker- Campbell-Hausdorff expansion does not truncate. But on a quantum computer the unitary can be implemented directly as a sequence of gates — this is precisely the quantum advantage that VQE exploits.
UCCSD is often called the "gold standard" ansatz because it is physically motivated (it respects the structure of electronic excitations), systematically improvable (add triples for UCCSDT), and provides a good balance between accuracy and circuit depth for small molecules.
How It Works
The Circuit
The UCCSD circuit has three layers:
CODESection 1: Hartree-Fock preparation q_0: ──X── (occupied) q_1: ──X── (occupied) q_2: ───── (virtual) q_3: ───── (virtual) Section 2: Single excitations (one block per occupied→virtual pair) q_i: ──●──RY(θ)──●── │ │ q_a: ──X──────────X── Section 3: Double excitations (compact 4-qubit blocks) q_0: ──●─────────────────●── │ │ q_1: ──X──●───────────●──X── │ │ q_2: ─────X──RZ(θ/4)──X────── │ │ q_3: ─────●───────────●──────
Step 1: Hartree-Fock Reference
PYTHONfor i in range(n_electrons): circuit.append(cirq.X(qubits[i]))
X gates flip the first n_electrons qubits from |0> to |1>, encoding the
occupation pattern |1100> — two electrons in the lowest-energy orbitals. This
is the mean-field starting point that UCCSD will improve upon.
Step 2: Single Excitations
Each occupied-virtual pair (i, a) gets a Givens rotation block: two CNOTs bracketing an RY gate. The angle theta_ia controls how much amplitude is "moved" from orbital i to orbital a. For 2 occupied and 2 virtual orbitals there are 2 x 2 = 4 single excitation parameters.
Step 3: Double Excitations
Double excitations promote two electrons simultaneously. The compact block uses a CNOT staircase with an RZ rotation (scaled by 1/4 for Trotterization). These capture the crucial pair correlation that single excitations miss.
The Math
The Cluster Operator
The UCC ansatz state is:
|psi(theta)> = exp(T - T†) |HF>
The cluster operator T is truncated at singles and doubles:
CODET_1 = sum_{i in occ, a in virt} theta_ia a†_a a_i T_2 = sum_{i<j in occ, a<b in virt} theta_ijab a†_a a†_b a_j a_i
where a† and a are fermionic creation and annihilation operators.
Jordan-Wigner Transformation
To implement fermionic operators on qubits, the Jordan-Wigner mapping encodes occupation numbers directly:
CODEa†_p = (1/2)(X_p - iY_p) Z_{p-1} Z_{p-2} ... Z_0 a_p = (1/2)(X_p + iY_p) Z_{p-1} Z_{p-2} ... Z_0
The Z-string ensures the correct fermionic anti-commutation relations. A single excitation a†_a a_i - h.c. becomes a sum of Pauli tensor products acting on qubits i through a.
Trotterization
The full unitary exp(T - T†) cannot be implemented as a single gate. Instead we use a first-order Trotter-Suzuki decomposition:
exp(T_1 + T_2 - T_1† - T_2†) ≈ prod_k exp(theta_k G_k)
where each G_k is a single- or double-excitation generator mapped to Pauli strings. Each Pauli exponential exp(i theta P_1 P_2 ... P_n) is compiled into a CNOT ladder + single-qubit rotation + reverse CNOT ladder.
Parameter Scaling
| System | Qubits | Singles | Doubles | Total Params |
|---|---|---|---|---|
| H2 (minimal basis) | 4 | 4 | 4 | 8 |
| LiH (STO-3G) | 12 | 18 | ~80 | ~98 |
| H2O (STO-3G) | 14 | 25 | ~150 | ~175 |
The parameter count grows as O(n_occ * n_virt) for singles and O(n_occ^2 * n_virt^2) for doubles.
Expected Output
With 4 qubits, 2 electrons, and random initial parameters (seed=42):
| Property | Value |
|---|---|
| Single excitations | 4 |
| Double excitations | 4 |
| Total parameters | 8 |
| Circuit depth | ~20-30 moments |
Measurement outcomes will be distributed across computational basis states. With zero parameters (theta=0) the circuit produces only the Hartree-Fock state |1100> with 100% probability, confirming that the ansatz correctly reduces to the reference when no excitations are applied.
Note: Unlike the hardware-efficient ansatz, UCCSD outcomes have physical meaning — the bitstrings represent electronic configurations in the orbital basis.
Running the Circuit
PYTHONfrom circuit import create_uccsd_ansatz, run_circuit, verify_uccsd # Basic execution with random parameters result = run_circuit(n_qubits=4, n_electrons=2, shots=1024) print(f"Parameters: {result['n_params']}") print(f"Depth: {result['depth']}") print(f"Top outcomes: {result['top_outcomes']}") # Build a custom ansatz with specific amplitudes params = [0.0] * 8 # All zeros = Hartree-Fock state circuit = create_uccsd_ansatz(n_qubits=4, n_electrons=2, params=params) print(circuit) # Verification suite verification = verify_uccsd() print(f"All checks passed: {verification['passed']}") for check in verification['checks']: print(f" {check['name']}: {check['detail']}")
Try It Yourself
-
Zero-parameter limit: Set all parameters to 0.0 and verify that you recover the Hartree-Fock state |1100> with 100% probability. This confirms the ansatz correctly encodes the reference.
-
Single excitation only: Set all double-excitation parameters to zero and vary one single-excitation amplitude from 0 to pi. Watch how population transfers from an occupied to a virtual orbital.
-
Compare with HEA: Build a hardware-efficient ansatz of the same depth and compare the measurement distributions. Which produces more physically meaningful states?
-
Scale to 6 qubits: Try
create_uccsd_ansatz(n_qubits=6, n_electrons=2). How does the parameter count change? How does the circuit depth grow? -
Symmetry check: For H2, the UCCSD state should preserve total spin (S^2) and particle number. Measure the expectation values of the number operator (sum of Z_i) across multiple parameter settings.
What's Next
- VQE H2 Ground State — Use this UCCSD ansatz inside a full VQE loop to find the ground-state energy of H2
- Hardware-Efficient Ansatz — Compare UCCSD with a physics-agnostic ansatz and understand the tradeoffs
- Barren Plateaus — Investigate whether UCCSD suffers from vanishing gradients as the system size grows
- VQD Algorithm — Extend beyond the ground state to find excited-state energies using UCCSD
Applications
| Application | How UCCSD Is Used |
|---|---|
| Molecular ground states | VQE + UCCSD finds the lowest energy of small molecules (H2, LiH, H2O) on near-term hardware |
| Bond dissociation curves | Vary internuclear distance and compute energy at each point to map reaction pathways |
| Excited states | Combined with VQD or SSVQE to access excited electronic states beyond the ground state |
| Benchmarking quantum hardware | UCCSD circuits of known accuracy serve as benchmarks for assessing hardware fidelity |
| Drug discovery | Accurate molecular energies feed into computational pipelines for molecular property prediction |
References
- Peruzzo, A. et al. (2014). "A variational eigenvalue solver on a photonic quantum processor." Nature Communications 5, 4213. DOI: 10.1038/ncomms5213
- Romero, J. et al. (2018). "Strategies for quantum computing molecular energies using the unitary coupled cluster ansatz." Quantum Science and Technology 3(1), 014008. DOI: 10.1088/2058-9565/aad3e4
- Whitfield, J.D., Biamonte, J., Aspuru-Guzik, A. (2011). "Simulation of electronic structure Hamiltonians using quantum computers." Molecular Physics 109(5), 735-750. DOI: 10.1080/00268976.2011.552441
- Anand, A. et al. (2022). "A quantum computing view on unitary coupled cluster theory." Chemical Society Reviews 51, 1659-1684. DOI: 10.1039/D1CS00932J
- Nielsen, M.A. & Chuang, I.L. Quantum Computation and Quantum Information, Chapter 9 (Quantum simulation).
- Helgaker, T., Jorgensen, P., Olsen, J. Molecular Electronic-Structure Theory, Chapter 11 (Coupled-cluster theory).