QuantumPulse.jl is a high-performance computational physics library in Julia for the simulation of open quantum systems, density matrix dynamics, and dissipative quantum state evolution governed by the Gorini-Kossakowski-Sudarshan-Lindblad (GKSL) master equation.
Designed for quantum optics, cavity quantum electrodynamics (QED), and qubit decoherence modeling, QuantumPulse.jl implements both exact analytical matrix-exponential propagators on vectorized Liouville space and adaptive high-order numerical ODE integrators, alongside exact steady-state solvers and quantum information metrics.
-
Exact Liouvillian Superoperator Vectorization:
Transforms the Lindblad master equation into an isomorphic linear dynamical system
$\frac{d}{dt}|\rho\rangle!\rangle = \mathcal{K} |\rho\rangle!\rangle$ on$\mathbb{C}^{N^2 \times N^2}$ , enabling exact analytical matrix exponential evolution and spectral decomposition. -
Multiple Time-Evolution Engines:
-
mesolve_analytic: Analytical matrix exponential propagator$\exp(\mathcal{K} t)$ with eigensystem caching ($O(N^4)$ per time step). -
mesolve_rk4: Classical 4th-order Runge-Kutta integrator for arbitrary time-dependent driving Hamiltonians$H(t)$ . -
mesolve_adaptive: Embedded 5(4) Dormand-Prince (DP54) adaptive step-size integrator with continuous local truncation error control.
-
-
Exact Null-Space Steady-State Solver:
Directly determines the stationary density matrix
$\rho_{\mathrm{ss}}$ satisfying$\mathcal{K}|\rho_{\mathrm{ss}}\rangle!\rangle = 0$ and$\mathrm{Tr}(\rho_{\mathrm{ss}}) = 1$ via singular value decomposition (SVD) and QR factorizations, achieving machine-precision agreement with analytical optical Bloch solutions ($< 10^{-15}$ trace distance). -
Comprehensive Quantum Information Diagnostics:
State purity
$\gamma = \mathrm{Tr}(\rho^2)$ , von Neumann entropy$S(\rho) = -\mathrm{Tr}(\rho \ln \rho)$ , Uhlmann quantum fidelity$F(\rho, \sigma)$ , trace distance$D(\rho, \sigma)$ , expectation values$\langle A \rangle = \mathrm{Tr}(\rho A)$ , and geometric Bloch sphere vector mapping$(u, v, w)$ with radius$r \le 1$ . -
Zero External Dependencies:
Built purely on Julia's standard library (
LinearAlgebra,Printf,Random,Test), guaranteeing minimal compile latency and maximum cross-platform reproducibility.
graph TD
subgraph HilbertSpace ["Hilbert Space Operators"]
H["Hamiltonian H(t)"]
C["Collapse Ops {L_k, γ_k}"]
State["State |ψ⟩ / ρ0"]
end
subgraph Superoperators ["Liouville Space Superoperators"]
Unitary["-i (I ⊗ H - H^T ⊗ I)"]
Dissipator["∑_k γ_k [ L_k* ⊗ L_k - 0.5 (I ⊗ L_k†L_k + (L_k†L_k)^T ⊗ I) ]"]
K["Liouvillian Generator Matrix K ∈ ℂ^(N² × N²)"]
end
subgraph Solvers ["Evolution Engines"]
Exp["mesolve_analytic: exp(K t)"]
RK4["mesolve_rk4: 4th-Order Runge-Kutta"]
DP54["mesolve_adaptive: Dormand-Prince 5(4)"]
SS["steadystate: Augmented SVD / QR Kernel"]
end
subgraph Observables ["Information-Theoretic Diagnostics"]
Purity["Purity Tr(ρ²)"]
Entropy["von Neumann Entropy S(ρ)"]
Fid["Uhlmann Fidelity F(ρ, σ)"]
Dist["Trace Distance D(ρ, σ)"]
Bloch["Bloch Sphere Trajectory (u, v, w)"]
end
H --> Unitary
C --> Dissipator
Unitary --> K
Dissipator --> K
State --> Exp
State --> RK4
State --> DP54
K --> Exp
K --> SS
Exp --> Observables
RK4 --> Observables
DP54 --> Observables
SS --> Observables
For an open quantum system coupled to a Markovian thermal reservoir, the reduced density operator
where the Lindblad dissipator
Here:
-
$H(t)$ is the system Hamiltonian. -
$L_k$ are system collapse/jump operators describing environmental interaction channels (e.g. spontaneous emission$\sigma_-$ , pure dephasing$\sigma_z$ , cavity photon annihilation$a$ ). -
$\gamma_k \ge 0$ are the corresponding dissipation rates. -
$\mathcal{D}[L_k]$ is completely positive and trace-preserving (CPTP), ensuring$\mathrm{Tr}(\rho(t)) = 1$ and$\rho(t) \ge 0$ for all$t \ge 0$ .
Using the column-major vectorization isomorphism
The Liouvillian generator matrix
For time-independent
When
The steady-state density operator
where
| Observable | Mathematical Definition | Physical Interpretation |
|---|---|---|
| Expectation Value | Macroscopic measurement expectation | |
| Purity |
|
|
| von Neumann Entropy | Information entropy in natural units (nats) | |
| Uhlmann Fidelity | State overlap metric ( |
|
| Trace Distance | Distinguishability metric ( |
|
| Bloch Vector (Qubit) | Coordinates on/inside the unit Bloch sphere ( |
Benchmarks executed on AMD x86_64 CPU under WSL Ubuntu (Julia 1.13.3):
=================================================================
QuantumPulse.jl — High-Performance Lindblad Solver Benchmark
=================================================================
[Benchmark 1] Two-Level Damped Rabi System (N = 2, Liouvillian N² = 4)
Analytic (matrix exp): 2.443 ms (201 steps)
Numerical RK4: 5.653 ms (201 steps)
Max trajectory error: 1.47e-06 (Trace distance)
[Benchmark 2] Jaynes-Cummings Cavity QED (N = 20, Liouvillian N² = 400)
Analytic (matrix exp): 272.588 ms (101 steps)
Final state purity: 0.5014
Final state entropy: 0.6917 nats
[Benchmark 3] Steady-State Solver Accuracy & Convergence
Steady-State Trace Distance: 4.06e-16 (vs Analytical Optical Bloch)
Steady-State Quantum Fidelity: 1.0000000000
- Julia 1.9 or newer (tested on Julia 1.13.3)
Clone the repository and instantiate the package environment:
git clone https://github.com/ZengLLQ/quantum-pulse.git
cd quantum-pulse
julia --project=. -e "using Pkg; Pkg.instantiate()"To run the full automated test suite:
julia --project=. -e "using Pkg; Pkg.test()"using QuantumPulse
# Define a driven two-level system with relaxation (γ1) and dephasing (γ_phi)
model = TwoLevelRabi(Δ = 0.0, Ω = 1.0, γ1 = 0.1, γ_phi = 0.05)
H = hamiltonian(model)
c_ops = collapse_operators(model)
r = rates(model)
# Initial pure state: Excited state |e⟩
rho0 = basis_state(2, 0)
tlist = collect(range(0.0, stop=25.0, length=51))
# Track Pauli observables
e_ops = Dict("sx" => sigma_x(), "sy" => sigma_y(), "sz" => sigma_z())
# Evolve system analytically via matrix exponential
res = mesolve_analytic(H, rho0, tlist; c_ops=c_ops, rates=r, e_ops=e_ops)
# Print final purity and Bloch coordinates
bvec, r_bloch = bloch_vector(res.states[end])
println("Final Bloch vector: ", bvec)
println("Final Purity: ", purity(res.states[end]))using QuantumPulse
using LinearAlgebra
dim_cavity = 6
jc = JaynesCummings(ω_a = 1.0, ω_c = 1.0, g = 0.15, γ_a = 0.01, κ_c = 0.02, dim_cavity = dim_cavity)
H = hamiltonian(jc)
c_ops = collapse_operators(jc)
r = rates(jc)
# Initial state: Excited atom |e⟩ ⊗ Cavity vacuum |0⟩
atom_e = basis_state(2, 0)
cav_0 = basis_state(dim_cavity, 0)
rho0 = QuantumState(Matrix{ComplexF64}(kron(atom_e.data, cav_0.data)))
tlist = collect(range(0.0, stop=30.0, length=61))
e_ops = Dict(
"sz" => kron(sigma_z(), identity_op(dim_cavity)),
"n" => kron(identity_op(2), number_op(dim_cavity))
)
result = mesolve_analytic(H, rho0, tlist; c_ops=c_ops, rates=r, e_ops=e_ops)The package includes a built-in command-line interface for running benchmarks and simulations:
# Run performance and accuracy benchmarks
julia --project=. src/cli.jl benchmark
# Run Rabi oscillation trajectory demo with ASCII table
julia --project=. src/cli.jl rabi
# Execute standalone example scripts
julia --project=. examples/rabi_decay.jl
julia --project=. examples/cavity_decay.jl
julia --project=. examples/jaynes_cummings_dynamics.jl-
Dense vs Sparse Liouvillian Scaling:
The vectorized Liouvillian superoperator matrix
$\mathcal{K}$ scales as$N^2 \times N^2$ for an$N$ -dimensional Hilbert space. While exact matrix exponential propagation is optimal for$N \le 40$ (e.g. qubit arrays, cavity QED with moderate Fock truncation), macroscopic Hilbert spaces ($N > 100$ ) require sparse Krylov subspace or quantum trajectory Monte Carlo wave-function (MCWF) methods. - Markovian Approximation: The GKSL master equation assumes weak system-bath coupling and Markovian memoryless reservoirs. Non-Markovian structured environments with spectral memory require hierarchical equations of motion (HEOM) or pseudo-mode expansions.
-
Truncated Fock Spaces:
Infinite-dimensional bosonic operators (
$a, a^\dagger$ ) are represented in finite truncated Fock bases. The highest Fock state$|N_{\mathrm{fock}}-1\rangle$ experiences artificial truncation effects if populations reach the boundary.
This project is licensed under the MIT License.