{'fraction_non_alphanumeric': 0.045536869340232856, 'fraction_numerical': 0.011384217335058214, 'mean_word_length': 4.553879310344827, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Beam Dynamics with Covariant Hamiltonians

We demonstrate covariant beam-physics simulation through multipole magnets using Hamiltonians relying on canonical momentum. Space-charge interaction using the Lienard-Wiechert potentials is also discussed. This method is compared with conventional nonlinear Lie-operator tracking and the TraceWin software package.


Theory
Simulating particle beams in accelerators typically involves paraxial (small-angle) approximations limited to cylindrical symmetry, or Lie-operator transformations capable of modeling nonlinear effects, but still inherently relying on a series-expanded exponential about the origin in position-momentum phase space. The former is often useful in control-room software for realtime diagnostics; the latter is typically much slower and reserved for design work or other offline tasks requiring best-possible accuracy.
In either case, Hamiltonians for relativistic beams are typically renormalized in terms of longitudinal momentum [1] which can be problematic for cases such as longitudinal tracking in the ultra-relativistic limit [2].
As an alternative, we construct an integrator based on Jackson's derivations for charged particles reacting to external potentials [3], with complementary notes from Barut [4]. We begin with Jackson's covariant expression for relativistic Hamiltonians (Gaussian units, four-vectors summed over α) with the resulting equations of motion where A α is the external electromagnetic potential; τ is the proper time, which binds the dynamics to the rest frame of a reference particle; and P α is the canonical momentum, which eliminates velocity from the Hamiltonian: Then, using dτ → ∆t/γ (and noting that since P z is constant, these equations are positionmomentum separable) we can adopt the symplectic Euler method [5]: and likewise for the remaining expressions in Eqs. (4). This can be evaluated iteratively with fewer operations than the Lie-operator method, whose Taylor-expanded exponential requires recursive Poisson brackets [6], typically to fourth or fifth order, for multipole-magnet tracking. This outperforms Lie-operator tracking in terms of computational speed by at least a factor of three for fully analytic solutions -and upwards of a factor of ten when using truncated Taylor series polynomials as an optimization method. In the latter case, the Lie polynomials forx i+n andP i+n become fully dense, whereas the covariant trajectories remain sparse.

H with n/2 dependence
The Hamiltonians typically derived for multipolar magnetic potentials are linearly dependent on A z . Equation (1) shows that this is not the case when using conjugate momentum. We can then assert that the quadratic dependence of H on A z will shift the usual radial-coordinate dependence on number of dipoles A z ∝ r n to A z ∝ r n/2 .
To verify this, we use a version of Wolski's contour-integral approach [2] where the B-field for a single pole of a multipole magnet is only nonzero in the radial direction, and is solenoid-like: which can be used to solve for C n 2 . Evaluating over all poles (i.e. introducing θ-dependence) and converting to the customary Cartesian system yields where N is number of turns per magnet coil, R is the effective coil radius (which we have introduced), and r 0 is the pole-tip aperture radius. Using B r = ∇×Ā → B r = 1 r ∂Az ∂θ , integrating, and again converting to Cartesian coordinates, we have where the non-canceling units are current per c, which is consistent with energy in Gaussian units. It is then trivial to check that the trajectories for dP x /dt and dP y /dt by Eqs. (4) have the same leading-order dependence on x and y as those found by the Lie-operator method. For a more thorough check, we compare Lorentz forces, using an octupole (n = 4) as a test case. Beginning with v i =ẋ i = ∂H/∂p i in the nonrelativistic case: which matches the first-order Lie-operator result forṗ/m. For the covariant case, Eq. (1) can be expanded Then, usingẋ i = ∂H ∂P i , the remaining non-canceling terms are Again, the x and y dependencies are proportional (see Fig. 1). The required n/2 dependence for a covariant H is thus clarified a consequence of shifting to canonical momentum.

Benchmarks
As a baseline, Eqs. (4 and 7) were tested against TraceWin using identical initial distributions and zero beam current. This relied on TraceWin's gradient definition-using a field-on-pole (B 0 ) approximation-to equal that of Wolski [2,7], as well as Eq. (5). We note that neither reference includes the effective coil radius R, and that covariant results were consistent with TraceWin for R ∼30 mm over a wide range of magnet types (n) and energies (MeV through TeV scale). Figure 2 illustrates two such cases.

Nonlinear behavior
A cursory analysis in terms of relativistic velocities helps to clarify the Hamiltonian's nonlinear dependence on A z . To start, Eq. (9) can be reverted to velocity dependence via Eq. (3), where we shift to the bunch frame: The quadratic A z term here is clearly dominant for low-β z particles; for medium-to high-β z , a linear-quadratic threshold is now defined as where the maximumβ/γ ≈ 1/2 occurs for 400 MeV protons. By Eqs. (5) and (7), at the magnetic pole-tip limit (r = r 0 ), we have indicating (in Gaussian units) that this threshold falls in the multi-GV per meter regime of interest to wakefield acceleration [8,9].

Space charge
Equation (2) can be populated using the Lienard-Wiechert potentials [3,10] A where R = |R| = |x − r(τ 0 )| = x 0 − r 0 (τ 0 ) is source to test-particle distance defined by the light-cone condition;n is the unit vector in the same direction; and all quantities are taken at the retarded time.  The dependence onβ cannot be overstated: velocity dependent space-charge contributions are maximized for parallel velocities, and attenuated for antiparallel velocities. Figure 3 illustrates this concept qualitatively, suggesting that a hollowed distribution represents a lowest-energy configuration for a charged-particle bunch. We now have a toolset capable of studying more complicated cases, such as an alternatingcurrent 4n-poles (octupoles and similar), which were shown in a previous work to effectively freeze individual particles transverse motion beyond a certain radius while inducing a circulatory trajectory with small longitudinal boost in the positive z direction [11].
Starting with the full expression for A z in polar coordinates (see [2], Eq. [1.145]).
A z = |C n 2 |r n 2 e i n 2 θẑ , then, for alternating current in an octupole (n = 4), θ effectively fluctuates as ±π/n. Thus, solving the force in terms of Eqs. (10) (first line) the only nonzero contribution is We can expect this force to cause a shift in velocity such that Thus despite space charge having predominantly being parallel-β, it now has an artificial antiparallel restraint inr. Using this shifted beta in Eq. (13), and assuming that F r ∆t/m << −1, we have for space charge which, again using Eq. (10) with R ≡ (r − r s ) 2 + (z − z s ) 2 (s subscript denotes source particle) yields a force offset to the usual drift-space result: β 2 r r 6 cos 4 (2θ) (1 + β rn ) 2 R 3ẑ − 4q 2 (z − z s )C 2 n 2 β 2 r r 6 sin(4θ) cos 2 (2θ) (1 + β rn ) 2 Rθ , where theθ component accounts for the circulatory motion, and theẑ component is solely positive, accounting for the forward bias.

Conclusion
Manifestly covariant Hamiltonians are demonstrated to be a viable alternative to conventional non-linear tracking algorithms. With multipole magnetic potentials, particle trajectories can be calculated with fewer operations, and space-charge potentials are easily incorporated. Having avoided approximations in H allows for the study of longitudinal effects.