| Crates.io | trotter_qsim |
| lib.rs | trotter_qsim |
| version | 0.1.1 |
| created_at | 2025-10-06 15:07:55.725747+00 |
| updated_at | 2025-10-06 15:17:32.671084+00 |
| description | Sparse, persistent XXZ quantum simulator using second-order Trotter decomposition with optional GPU acceleration. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1870292 |
| size | 58,541 |
trotter_qsim)A sparse, persistent quantum state simulator for the two-excitation XXZ spin chain, featuring:
trotter_qsim simulates the time evolution of a 1D spin chain under the XXZ Hamiltonian:
[ H = \sum_i J (X_i X_{i+1} + Y_i Y_{i+1}) + \Delta Z_i Z_{i+1} ]
The simulator uses second-order symmetric Trotter decomposition to approximate the unitary evolution operator:
[ U(\Delta t) \approx e^{-i H_{\text{even}} \Delta t / 2} e^{-i H_{\text{odd}} \Delta t} e^{-i H_{\text{even}} \Delta t / 2} ]
This achieves cubic order accuracy in the timestep ((O(\Delta t^3))) while maintaining numerical stability and normalization through periodic renormalization.
|ψ| > threshold) are kept in memory.quantum_state.bin, allowing resumption from checkpoints.J, Δ, dt, steps) via command-line.observables.csv.curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
git clone https://github.com/<yourname>/trotter_qsim.git
cd trotter_qsim
cargo build --release
cargo run --release -- --num-qubits 60 --delta -1.5 --dt 0.05 --steps 600 --j 1.0 --threshold 1e-8
The program will output progress logs and write observables to observables.csv.
| File | Description |
|---|---|
quantum_state.bin |
Serialized quantum amplitudes (sparse state). Enables resumable simulation. |
observables.csv |
CSV log of time-dependent observables (occupation, correlation, normalization). |
untitled1.pdb |
Debug symbol file (only needed for debugging). |
Example output snippet from observables.csv:
Time,P_Q29,P_Q30,C_Q30_Q29,Total_Prob
0.000,0.000000,1.000000,0.000000,1.000000
0.500,0.012532,0.987468,0.002300,0.999998
| Flag | Description | Default |
|---|---|---|
-n, --num-qubits |
Number of qubits in the chain | 60 |
-d, --delta |
ZZ interaction strength (Δ) | -1.5 |
--dt |
Time step size | 0.05 |
-s, --steps |
Total number of time steps | 600 |
-j, --j |
XY coupling strength (J) | 1.0 |
--threshold |
Minimum amplitude magnitude retained in memory | 1e-8 |
trotter_qsim/
├── Cargo.toml
├── README.md
├── src/
│ └── main.rs # Core simulation logic and CLI entry point
├── target/release/
│ └── trotter_qsim.exe # Compiled binary
└── observables.csv # Output log (generated after run)
The system evolves according to: [ |\psi(t + \Delta t)\rangle = U(\Delta t)|\psi(t)\rangle ] with each Trotter layer applying alternating even/odd two-site unitaries: [ U_{i,i+1} = e^{-i J \Delta t (X_i X_{i+1} + Y_i Y_{i+1})} e^{-i \Delta \Delta t Z_i Z_{i+1}} ]
For large systems, only amplitudes above a configurable threshold are tracked, enabling simulations beyond 30–40 qubits on standard hardware.
To resume a simulation:
cargo run --release
If quantum_state.bin exists, it will be automatically loaded; otherwise, a fresh initial state will be created.
MIT License © 2025 Angry Beaver