Rocket Science · Open Research Platform · Breakwater Layer

Code Documentation

Simulation engine reference · v0.8

Source: F. Hasse, D. Palani, R. Thomm, U. Warring, T. Schaetz · Phys. Rev. A 109, 053105 (2024)

Endorsement Marker: Local candidate framework (no parity implied with externally validated laws)

Implementation: Python/scipy sweep engine (scripts/stroboscopic_sweep.py, Float64). Browser JavaScript engine is part of the architecture but not included in this packaged snapshot (see REBUILD.md).

1. Hilbert Space

The simulation works in the tensor-product space spin ⊗ motion, with basis ordering:

|↓,0⟩, |↓,1⟩, …, |↓,Nmax−1⟩, |↑,0⟩, |↑,1⟩, …, |↑,Nmax−1⟩

The total Hilbert space dimension is 2 × Nmax. All operators are represented as complex matrices of this dimension. Complex numbers are stored as pairs of Float64 values [re, im] in a flat array of length 2 × (2Nmax)².

Fock truncation

The truncation at Nmax is the primary source of systematic error. After each simulation run, the population in the top 3 Fock states (both spin components) is measured:

Convergence criterion

Green (OK): boundary population < 0.01% — results converged.

Amber (Marginal): 0.01–1% — possible truncation artefacts.

Red (Unreliable): > 1% — results not converged. Recommended Nmax ≥ ⟨n⟩ + 5√⟨n⟩ + 10.

2. Hamiltonian

In the rotating frame at the laser frequency, the effective Hamiltonian for one stroboscopic pulse at detuning δ₀ is:

Heff(δ₀) = −(δ₀/2) σz ⊗ Im + (Ω/2) [ C ⊗ σ₋ + C† ⊗ σ₊ ]

where:

C = exp(iη(a + a†))

The operator C is computed exactly in the Fock basis via matrix exponentiation of the position quadrature operator X = a + a†. No Lamb–Dicke approximation or sideband truncation is applied. The matrix exponential uses a Taylor(12) series with scaling and squaring.

Coupling structure

In the 2Nmax × 2Nmax matrix:

BlockRowsColsContent
↓↓0…N−10…N−1−δ₀/2 on diagonal
↑↑N…2N−1N…2N−1+δ₀/2 on diagonal
↓↑ (σ₋)0…N−1N…2N−1(Ω/2) · C
↑↓ (σ₊)N…2N−10…N−1(Ω/2) · C†

3. Stroboscopic Protocol

Pulse timing

The protocol applies Np pulses, each separated by one motional period Tm = 2π/ωm. The per-pulse unitary is:

U = exp(−i Heff δt)

The pulse duration δt is derived from the requirement that the total accumulated rotation equals π/2:

Np × Ωeff × δt = π/2  →  δt = π / (2 Np Ωeff)

where Ωeff = Ω · exp(−η²/2) is the Debye–Waller suppressed carrier Rabi rate.

Key identity

Changing Np does not change the total rotation — it changes the per-pulse rotation angle θ = π/(2Np) and the duty cycle δt/Tm. The total sequence duration is Np × Tm.

Free evolution between pulses

Between pulses, the ion evolves freely for one motional period. In the Fock basis:

exp(−iωm a†a · Tm) = exp(−i 2π n̂) = I

This is exact for integer Fock states: exp(−i2πn) = 1 for all n ∈ {0, 1, 2, …}. The stroboscopic condition is therefore built into the Fock-basis representation — the inter-pulse free evolution is the identity operator. The full Np-pulse propagator is simply UNp.

Derived timing table

For the default parameters (η = 0.397, Ω/(2π) = 0.300 MHz, ωm/(2π) = 1.30 MHz):

Npθ/pulseδt [ns]Duty cycleTseq [μs]
109.0°9011.7%7.7
224.1°415.3%16.9
501.8°182.3%38.5

4. Initial State

|ψ₀⟩ = |↓⟩ ⊗ D(α)|0⟩

The displaced coherent state D(α)|0⟩ is computed in the Fock basis as:

⟨n|α⟩ = exp(−|α|²/2) · αn / √(n!)

For real α (convention used throughout), all coefficients are real.

5. Observables

After the pulse sequence, the reduced spin density matrix is obtained by tracing over the motional degrees of freedom:

ρ↓↓ = Σn |⟨↓,n|ψ⟩|²    ρ↓↑ = Σn ⟨↓,n|ψ⟩ ⟨ψ|↑,n⟩

From the 2×2 spin density matrix:

ObservableFormula
⟨σx2 Re(ρ↓↑)
⟨σy−2 Im(ρ↓↑)
⟨σzρ↑↑ − ρ↓↓
Coherence√(⟨σx⟩² + ⟨σy⟩² + ⟨σz⟩²)
Entropy S−λ₊ log₂ λ₊ − λ₋ log₂ λ₋

where λ± = (1 ± r)/2 and r is the Bloch vector length.

6. Decoherence

When any decoherence parameter is non-zero, the simulation switches from pure unitary evolution to the quantum trajectory (Monte Carlo wavefunction) method. Three Lindblad channels act during the inter-pulse free evolution periods:

ChannelCollapse operatorRate
Spin decayL₁ = √γ₁ · σ₋ ⊗ Iγ₁ = 1/T₁
Pure dephasingL₂ = √(γφ/2) · σz ⊗ Iγφ = 1/T₂ − 1/(2T₁)
Motional heatingL₃ = √γh · I ⊗ a†γh = (dn/dt) / 1000 μs⁻¹

For each inter-pulse interval Tm, the jump probabilities are:

dp₁ = γ₁ Tm ⟨↑|ρ|↑⟩   dp₂ = (γφ/2) Tm   dp₃ = γh Tm ⟨a a†⟩

A random number selects which (if any) jump occurs. If no jump: the non-Hermitian correction (I − Σ L†L/2 · Tm)|ψ⟩ is applied and renormalised. Results are averaged over Ntraj trajectories.

T₂ constraint

The pure dephasing rate γφ = 1/T₂ − 1/(2T₁) is clamped to ≥ 0. If T₂ > 2T₁, the pure dephasing contribution is zero — all decoherence comes from population decay.

7. Quantum Projection Noise

When Nrep > 0, each spin expectation value is sampled as a Bernoulli experiment:

p = (1 + ⟨σ⟩) / 2    successes ~ Binomial(Nrep, p)    ⟨σ⟩noisy = 2 · successes/Nrep − 1

The ±1σ error bar is 2√(p(1−p)/Nrep). This models the quantum projection noise of a real single-ion experiment.

8. GPU Acceleration

On browsers with WebGPU support (Chrome 113+, Edge 113+), the complex matrix multiplication — the bottleneck of the Taylor-series matrix exponential — is offloaded to a GPU compute shader. The WGSL kernel dispatches 8×8 workgroups for tiled complex GEMM.

Precision note

The GPU path converts Float64 → Float32 for the shader and back. This provides ~7 significant digits, which is adequate for η ≈ 0.4 physics (where the coupling matrix elements span ~3 orders of magnitude). The CPU fallback uses Float64 throughout. The provenance manifest records which engine was used.

9. Provenance

Every simulation result carries a SHA-256 hash computed over a JSON payload containing:

FieldContent
code_versionSemantic version of the simulation engine
repoGitHub repository URL
paramsAll input parameters (including decoherence and noise settings)
timestampISO 8601 timestamp of the run
data_fingerprintArray sums for σx,y,z, entropy, coherence; point count; max Fock leakage

Manifest schema v2.0 supports three modes: single_run, sweep_1d, state_comparison. See ARCHITECTURE.md and schemas/manifest_v2.schema.json.

10. File Formats

JSON output

Structure: { manifest: {...}, data: {...} } (v1.2) or { schema_version: "2.0", payload: {...} } (v2.0)

Python script

The downloadable stroboscopic_sweep.py is a self-contained Python/scipy engine that reproduces the browser simulation with identical physics. It supports three modes: single run, 1D parameter sweep, and state comparison. See Getting Started for usage.