|q⟩ Bad Qubits

advanced · Programming · Advanced Hamiltonian Simulation

Simulating the Heisenberg Model

The Heisenberg model is the canonical testbed for quantum simulation of many-body dynamics. Its spins interact through all three Pauli components, so the terms do not commute — exactly the regime where Trotterization is both necessary and interesting.

The Heisenberg Hamiltonian

For a chain of spin-12\tfrac12 particles the (isotropic) Heisenberg Hamiltonian couples neighbours by

H=Ji,j(XiXj+YiYj+ZiZj).H = J \sum_{\langle i, j\rangle} \bigl(X_i X_j + Y_i Y_j + Z_i Z_j\bigr).

The XX+YYX X + Y Y part is a hopping (exchange) term that swaps spin excitations between sites; the ZZZ Z part is an Ising energy. Because [XX,YY]0[X X, Y Y] \ne 0 and [XX,ZZ]0[X X, Z Z] \ne 0, we cannot exponentiate HH in closed form on hardware — we Trotterize each bond into three two-qubit rotations.

One bond, three rotations

Focus on a single bond (J=1J = 1). The exact one-step evolution factorises (to first order) into the three commuting-on-paper pieces:

eiHteitXXeitYYeitZZ.e^{-iHt} \approx e^{-i t\, X X}\,e^{-i t\, Y Y}\,e^{-i t\, Z Z}.

Each factor is a two-qubit Pauli rotation eiθ2PPe^{-i\frac{\theta}{2} P\otimes P} with θ=2Jt\theta = 2 J t. The base case is the ZZZZ rotation, which has a clean CNOT decomposition:

eiθ2ZZ=CNOT01  (IRZ(θ))  CNOT01.e^{-i\frac{\theta}{2} Z\otimes Z} = \text{CNOT}_{0\to1}\;\bigl(I\otimes R_Z(\theta)\bigr)\;\text{CNOT}_{0\to1}.

The CNOT maps the joint parity of the two qubits into qubit 1, an RZ(θ)R_Z(\theta) phases by that parity, and the second CNOT uncomputes it.

Changing basis for XXXX and YYYY

XXX X and YYY Y are just ZZZ Z in a rotated single-qubit basis:

So all three Pauli rotations reuse the same CNOT–RZR_Z–CNOT core, wrapped in a different single-qubit basis change.

Starting state: the Néel state

We initialise the two spins in the Néel (antiferromagnetic) state 01|01\rangle — one spin up, one down — by flipping qubit 1 with an XX gate. Under the Heisenberg dynamics the XX+YYXX + YY exchange term makes the excitation hop, so amplitude leaks from 01|01\rangle into 10|10\rangle; this spin transport is the physics the circuit is meant to capture.

Try it

Prepare 01|01\rangle, then apply one first-order Trotter step of the 2-spin Heisenberg interaction at J=1J = 1, t=0.5t = 0.5 (so θ=2Jt=1\theta = 2Jt = 1). Build the ZZZZ, XXXX, and YYYY rotation blocks as described. The grader checks the final state vector.

Run your code to see the quantum state.

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