Author: Tilock Sadhukhan
LinkedIn: https://www.linkedin.com/in/tilock-sadhukhan/
License: MIT
This project is a reproducible pipeline for simulating 1D quantum dynamics on an
- discretizing continuous space on a uniform grid with
$N = 2^n$ points - encoding the sampled wavefunction on qubits using computational basis states
$|j\rangle$ - building finite difference Hamiltonians for the infinite well and the harmonic oscillator
- expanding the discretized Hamiltonian in the
$n$ qubit Pauli basis - implementing real time evolution with a first order (Lie) product formula
- validating against a reference evolution computed in the same discretized Hilbert space
- connecting accuracy to circuit resources such as Pauli term statistics, CNOT counts, and depth proxies
The main entrypoint is run_all.py. It generates figures, tables, and reference data in one run.
GitHub renders LaTeX math in Markdown. Use $...$ for inline math and either $$...$$ or a fenced math code block for block math.
For time independent
Choose
Here
Infinite well uses interior points (Dirichlet walls enforced by construction):
Harmonic oscillator uses an equally spaced grid on
Inside the well, the Hamiltonian is purely kinetic:
In the dimensionless units used in the code (
Reference trajectories are computed via eigen decomposition of the discretized Hamiltonian and phase evolution in that basis.
If
The discretized Hamiltonian matrix is expanded in the
A single Trotter step is:
The total time is
Each term
- basis changes mapping
$X$ or$Y$ to$Z$ - a parity gadget built from CNOTs onto a target qubit
- a single
$R_z(2\theta)$ on the target - uncompute parity and undo basis changes
Define the basis change maps:
Let
The parity gadget
python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS or Linux:
source .venv/bin/activatepip install -r requirements.txtpython run_all.pyOptional flags:
--use-aerruns the repeated Trotter circuit on Aer statevector snapshots. Default uses Operator(step) propagation but follows the same circuit construction.--no-pauli-testsskips the Pauli block verification tests.
After python run_all.py, outputs are written to:
-
figures/(densities, fidelities, overlays, resource plots, and$\langle x\rangle(t)$ for the harmonic oscillator) -
tables/(LaTeX resource tables) -
data/(reference trajectories saved as NPZ files)
Infidelity:
For each Pauli term
-
$m_k$ is the number of non identity letters in$P_k$ (active qubits) -
$s_k$ is the number of letters in${X,Y}$ in$P_k$ (basis changes required)
CNOT count for one parity gadget:
Single qubit rotation proxy:
Depth proxy (as implemented in this repo). Define
For one Trotter step:
Total resources scale linearly with
The pipeline reads a JSON config (default: config/default_config.json) with top level keys well and ho.
For each system, the required keys are:
-
n_discretize(must be a power of two, at least 4) -
n_steps(Trotter step count$r$ ) -
total_time(final time$t$ )
System specific keys:
- Infinite well:
L,x0,sigma,k0, and optionalenforce_walls - Harmonic oscillator:
x_max,x0,sigma,k0
.
├── run_all.py
├── requirements.txt
├── trotter_sim/
│ ├── __init__.py
│ ├── utils.py
│ ├── systems.py
│ ├── reference.py
│ ├── pauli_blocks.py
│ ├── trotter.py
│ ├── resources.py
│ └── plotting.py
├── config/
│ └── default_config.json
├── figures/
├── tables/
└── data/
MIT License. See LICENSE.
Tilock Sadhukhan
https://www.linkedin.com/in/tilock-sadhukhan/