We start with programming the Ising model on a 3 qubit chain.
Prepare the python environment
Run Python where Python path equals to the SimuQ folder.
from simuq import QSystem, Qubit
Here QSystem
is the class for quantum systems, and Qubit
is the class for qubit sites.
Define the evolution
First we create a quantum system and a list of qubit sites.
qs = QSystem()
q = [Qubit(qs) for i in range(n)]
Our target is a short evolution governed by an Ising Hamiltonian \(H=X_1X_2+X_2X_3+Z_1+Z_2+Z_3\) over the list of qubits, which can be programmed by
h = q[0].X * q[1].X + q[1].X * q[2].X + q[0].Z + q[1].Z + q[2].Z
We add a \(T=1\) time evolution under \(H\) to the quantum system.
T = 1
qs.add_evolution(h, T)
Then qs
contains the evolution of \(H\) for time \(T\). To add next segment of evolution, we only need to call the method add_evolution
again.