Status: Development & Testing Phase This project is currently under active development. APIs and features may change without notice.
ISOMORPH is a scientific software suite for simulating and analyzing nonlinear beam dynamics in particle accelerators using advanced mathematical techniques from Hamiltonian mechanics, Lie algebra, and normal form theory.
The project implements a complete computational pipeline for:
- Symplectic tracking of particles through magnetic lattice elements
- Truncated Power Series Algebra (TPSA) for automatic differentiation
- Lie algebraic methods for Hamiltonian map factorization
- Baker-Campbell-Hausdorff (BCH) formula for map compilation
- Normal form analysis for extracting nonlinear dynamics invariants
- Resonance driving term (RDT) computation
- Dynamic aperture and chaos indicators via tune diffusion
Particle motion in a circular accelerator is governed by Hamilton's equations. The 6D phase space coordinates are:
z = (x, px, y, py, z, delta)
where:
(x, px): horizontal position and momentum(y, py): vertical position and momentum(z, delta): longitudinal position and relative momentum deviation
The evolution is described by a symplectic map M satisfying:
M^T J M = J
where J is the standard symplectic matrix (block-diagonal with 2x2 blocks [[0,1],[-1,0]]).
TPSA enables exact computation of Taylor maps to arbitrary order. Each phase space variable becomes a polynomial:
f(z) = sum_{|alpha| <= N} c_alpha * z^alpha
Operations (+, -, *, composition) propagate coefficients automatically, providing:
- Transfer maps through magnetic elements
- Jacobians at any phase space point
- Higher-order aberrations and chromaticity
The one-turn map is factorized using Lie operators:
M = exp(:F_1:) exp(:F_2:) ... exp(:F_n:)
where :F: denotes the Lie operator associated with Hamiltonian generator F:
:F: g = {g, F} = Poisson bracket
The exponential is computed via the series:
exp(:F:) g = g + {g,F} + (1/2!){{g,F},F} + ...
Multiple Lie factors can be combined into a single generator using BCH:
exp(:A:) exp(:B:) = exp(:C:)
where C is computed via nested commutators:
C = A + B + (1/2)[A,B] + (1/12)[A,[A,B]] + (1/12)[B,[B,A]] - ...
This enables map compilation - converting element-by-element tracking into a single polynomial transformation.
Given a one-turn map M, normal form theory seeks a near-identity transformation A such that:
A^{-1} M A = R + (resonant terms only)
where R is a pure rotation (linear dynamics). The transformation removes all non-resonant terms, leaving:
- Detuning coefficients: Amplitude-dependent tune shifts
- Resonance Driving Terms (RDTs): Coupling and nonlinear resonance strengths
The normal coordinates are action-angle variables (J_i, phi_i) where:
nu_i(J) = nu_i0 + sum_j (dnu_i/dJ_j) * J_j
| File | Description |
|---|---|
tpsa_tracker.py |
TPSA class implementation with 6D element maps (drift, quadrupole, sextupole, RF cavity) |
lie_tpsa_tracker.py |
Lie algebraic formulation: Poisson brackets, exp(:F:) operator, Lie generators |
bch_tpsa_tracker.py |
BCH formula implementation (4th order), map compilation via fold strategies |
symplectic_tracker.py |
Numerical tracking engine with multipole kicks, RF cavities, aperture limits |
| File | Description |
|---|---|
s0_2_coupled_normal_form.py |
4D coupled linear normal form, eigenvalue normalization, homological equation solver |
normal_form_tracker.py |
6D normal form via numerical tracking + FFT tune estimation |
s0_3_preset_verification.py |
Integration test: preset lattice through full normal form pipeline |
| File | Description |
|---|---|
unstable_preset.py |
Dynamic aperture scanner with NAFF-style tune diffusion analysis |
isomorph_wormhole.py |
Educational visualization of network routing with physics metaphors |
-
Drift: Free propagation
x' = x + L*px/(1+delta) y' = y + L*py/(1+delta) -
Quadrupole Kick: Linear focusing
px' = px - k1*x py' = py + k1*y -
Sextupole Kick: Nonlinear chromatic correction
px' = px - (k2/2)(x^2 - y^2) py' = py + k2*x*y -
Skew Quadrupole: Coupling element
px' = px - ks*y py' = py - ks*x -
RF Cavity: Longitudinal focusing
delta' = delta + V*sin(phi0 + k_rf*z)
python bch_tpsa_tracker.pypython normal_form_tracker.pypython unstable_preset.pypython s0_2_coupled_normal_form.pyThe software computes and reports:
- Symplectic Error: Deviation from M^T J M = J (should be < 1e-10 for exact maps)
- Tunes: Fractional oscillation frequencies nu_x, nu_y, nu_s
- Detuning Coefficients: dnu/dJ matrix (amplitude-dependent tune shifts)
- Resonance Driving Terms: Non-zero coefficients at resonant frequencies
- Dynamic Aperture: Maximum stable amplitude before particle loss
- Tune Diffusion: Chaos indicator via NAFF algorithm
pip install -r requirements.txtRequirements:
- Python 3.10+
- NumPy >= 1.21.0
- SymPy >= 1.10.0
- Matplotlib >= 3.5.0
- Dragt, A.J. - "Lie Methods for Nonlinear Dynamics with Applications to Accelerator Physics"
- Forest, E. - "Beam Dynamics: A New Attitude and Framework"
- Bengtsson, J. - "The Sextupole Scheme for the Swiss Light Source"
- Laskar, J. - "Frequency Analysis for Multi-dimensional Systems" (NAFF method)
We successfully stabilized a chaotic edge regime using an octupole sculptor (
High-Res Poincaré Plot (x=1.70mm): The visualization below shows the last stable island chain trapped just before the chaotic cliff. The particle survives 50,000 turns with zero diffusion, protected by the resonance island, while particles at 1.80mm are lost immediately.
Resonance Atlas (Tune Footprint): The frequency map analysis shows the extensive tune shift driven by the sextupoles and "sculpted" by the octupoles to maintain dynamic aperture.
This project is in active development. Contributions, bug reports, and feature requests are welcome via GitHub Issues.
We successfully "reverse engineered" the underlying chaotic structure of the "Chaotic Edge" preset (
Initially, the Fourier fingerprint of the Poincaré section at 
After normalizing the coordinates 
Finally, by applying a full 4D Symplectic Normal Form transformation (eigen-decomposition of the one-turn matrix), we decoupled the 
Our goal was to transform the "Cliff" (immediate loss) into a "Beach" (long-lived chaotic sticking) to enable safe particle extraction.
We introduced a quasi-periodic modulation
- Protocol: Agile-But-Robust (ABR) scan (50k turns, 4 random phases).
-
Result: Beach confirmed (
$p_{beach}=10.2%$ , Width$\approx 56\mu m$ ). - Verdict: Real effect, but narrow.
We performed a parameter sweep on
-
Optimal
$\epsilon$ : 0.10. -
Result: Beach fraction maximized (6.3% single-freq) with monotonically decreasing stability (
$p_0$ dropped to 23%).
To thicken the Cantori barrier, we added a second incommensurate frequency:
- Physical Mechanism: The secondary drive breaks the outer resonant layers that form the "semi-stable" harbor, converting them into sticky chaos.
- Result:
- Beach Fraction: 11.8% (Doubled vs Single Freq).
- Wall Loss: Reduced from 69% to 64%.
- Stability: Preserved at ~24%.
To ensure the "Beach" wasn't just a delayed loss (Wall) or misclassified stability, we ran a 200,000 turn Deep Scan. We computed the Transition Matrix from 50k classification to 200k classification.
Transition Matrix (50k
| Class (50k) | Fate @ 200k | Fraction | Interpretation |
|---|---|---|---|
| Alive | Beach (Long) | 6.3% | HIDDEN STICKY TAIL |
| Alive (>50k) | Harbor (Stable) | 23.6% | TRUE CORE |
Conclusion: The Dual-Frequency drive creates a massive, genuine sticky layer (Total Beach 13.2%) verified by deep-time statistics and rigorous frequency sweeping (S1.4e).

A rigorous "Red Team" protocol (5 replicas, fixed domain) revealed that the 13% peak was an artifact of specific seeding/domain choices. Final Validated Performance:
-
Total Beach: 9.0%
$\pm$ 0.5% (Robust) - Harbor Stability: 26%
- Physics: The effect is real and stable, but parameter tuning in 4D has reached saturation. Next step: 6D Physics.
The survival statistic
-
$p_0$ (Cure Fraction): The Stable Harbor ($\approx 27%$ ). -
$S_{sticky}(t)$ : The heavy-tail transient (Power Law, slope$\approx -0.13$ ). -
$S_{fast}(t)$ : The exponential wall loss.
This confirms we are manipulating the proportions (
Moving to full 6D tracking (
- Uncorrected 6D: Harbor 22.5% (Stable).
-
Chromatic Correction (
$C=6.3$ ): Harbor 27.5% (Matches 4D Perfect Baseline).
We have achieved S1.5 Stabilization: A dual-frequency chaotic drive that maintains a large, stable storage core (~27%) in full 6D phase space.
The early finite-difference Jacobian check (symplectic_tracker.py toy test) reports an error of ~7e-3. This is a known limitation of the FD method conditioning and is superseded by the negligible error (~1e-12) and long-term boundedness verified in the production TurboTracker (S1.4/S1.5).
-
Beach (Chaos): Particles lost in
$t < 50k$ turns. -
Sticky Halo: Particles surviving
$50k \le t < 200k$ turns (Transient). -
Harbor (Core): Particles surviving
$t \ge 200k$ turns (Topologically Protected).
To demonstrate "CERN on PC" capability, we implemented a Slow Extraction Prototype (run_controlled_extraction_s1_6).
-
Septum: Particles beyond
$4mm$ are extracted to a beamline. - Control Knob: PID-controlled Drive Ramp ($\epsilon(t)$).
- Prototype Result: The system exhibits Nuclear Stability. It takes >30% Overdrive to initiate diffusion.
Licensed under the Apache License, Version 2.0. See LICENSE for details.
The isomorph_wormhole.py module implements a conceptual network routing model using gravitational physics metaphors:
- Kerr nodes: Simulated massive/spinning objects creating "spacetime curvature".
- Frame dragging: Rotational effects from spinning nodes.
- Quantum tunneling: Dynamic topology changes when "stress" exceeds threshold.
Note: This is a visualization/educational model, distinct from the symplectic physics engine.
Daniele Cangi GitHub: https://github.com/Daniele-Cangi/Isomorph
