This repository contains code to simulate a 1D XXZ quantum spin chain. The project uses the Suzuki-Trotter method to turn continuous physics equations (the Schrödinger equation) into discrete, step-by-step quantum circuits.
The code includes an exact classical simulation to use as a baseline, and a manual Qiskit implementation designed to run on actual IBM Quantum hardware while managing device noise.
Read the full project report:
docs/Project_Report.pdf
While this was a group project, I was responsible for writing the core quantum simulation logic:
- Writing the Trotter Algorithm: I coded the sequence that breaks the complex Hamiltonian math into Even and Odd bond groups so it can actually run on a computer. I implemented both the standard 1st-order method and the more accurate 2nd-order symmetric method.
- Building the Circuits by Hand: Instead of letting Qiskit build the circuit automatically, I hard-coded it using native rotation gates (
RXX,RYY,RZZ). This ensures the hardware runs the independent bonds at the exact same time, which cuts down on physical device errors. - Testing and Error Analysis: I wrote the code to compare our quantum circuits against the exact classical math to measure the error. This helped us find the "sweet spot" time step (dt = 0.1) that balances mathematical error against the physical noise of the IBM chips.
├── assets/ # Images for the README
├── docs/
│ └── Project_Report.pdf # Full physics derivations and results
├── notebooks/
│ └── xxz_spin_chain_simulation.ipynb # Main code and data visualization
├── README.md
└── requirements.txt # List of python packages needed
- Quantum: Qiskit, Qiskit Aer (for local simulation), Qiskit IBM Runtime (for running on IBM chips)
- Classical Math: NumPy, SciPy
- Graphing: Matplotlib
To run the Jupyter notebook on your own machine:
-
Clone the repository:
git clone https://github.com/yourusername/xxz-quantum-simulation.git cd xxz-quantum-simulation
-
Install the required Python packages:
pip install -r requirements.txt
-
Open the notebook:
jupyter notebook notebooks/xxz_spin_chain_simulation.ipynb