38 Spin Tracking
This section describes how OPALX evolves the per-particle spin polarization vector along the trajectory. The model is the Thomas-BMT equation [1], [2]. Each step turns \(\vec P\) with Rodrigues’ rotation formula, so the length \(|\vec P|\) changes only due to floating-point roundoff.
38.1 Polarization vector
OPALX stores, for each tracked particle, a three-component polarization vector \[ \vec P = \big(\langle\hat\sigma_x\rangle,\; \langle\hat\sigma_y\rangle,\; \langle\hat\sigma_z\rangle\big), \tag{38.1}\] where each component is the expectation value of the corresponding Pauli operator. The expectation is evaluated in the particle’s instantaneous (Lorentz) rest frame, while the three Cartesian axes along which it is projected are not boosted: they are the same axes as the particle’s momentum. This hybrid convention is the one the BMT equation is naturally written in: the spin state lives in the rest frame, but the rotation rate \(\vec\Omega\) is expressed using the lab-frame fields \(\vec E, \vec B\) at the particle’s position, so no boost rotation is needed inside the integrator.
In the tracker those axes are the axes of the bunch frame. The bunch frame follows the reference particle: its origin sits on the reference particle and its \(z\) axis points along the reference momentum. Each time the tracker moves and turns this frame, it rotates \(\vec P\) together with the momentum and the fields. Because \(\vec\Omega\) is built only from dot and cross products of \(\vec\beta\), \(\vec E\) and \(\vec B\), turning all of them and \(\vec P\) by the same rotation gives the same precession; the choice of axes changes only the components that are written out. The spin columns of the .stat file and the polx, poly, polz data of the phase-space file are therefore along the bunch-frame axes, like the momentum. A MONITOR with TYPE=SPATIAL writes the spin in its own frame, like position and momentum. A MONITOR with TYPE=TEMPORAL writes the spin along the bunch-frame axes, like its momentum.
Each particle container with spin adds these columns to the .stat file:
| Column | Meaning |
|---|---|
mean_polx, mean_poly, mean_polz |
Mean of each component of \(\vec P\) over the particles. |
mean_pol_mag |
Length of the mean vector, \(\lvert\langle\vec P\rangle\rvert\). |
rms_polx, rms_poly, rms_polz |
Standard deviation of each component, \(\sqrt{\langle P_i^2\rangle - \langle P_i\rangle^2}\). |
The magnitude \(|\vec P|\) is bounded by the spin-\(\tfrac{1}{2}\) Bloch sphere, \[ 0 \le |\vec P| \le 1 , \tag{38.2}\] with \(|\vec P|=1\) corresponding to a fully polarized state and \(|\vec P|=0\) to an unpolarized state.
38.2 The Thomas-BMT equation
In the lab frame, with \(t\) the lab-frame time, \(\vec P\) evolves as \[ \frac{d\vec P}{dt} = \vec\Omega \times \vec P, \tag{38.3}\] where the angular velocity \(\vec\Omega\) for a particle of charge \(q\), rest mass \(m\), and gyromagnetic anomaly \(G = (g-2)/2\) in electromagnetic fields \(\vec E, \vec B\) is \[ \vec\Omega = -\frac{q}{m}\Bigg[ \Big(G + \frac{1}{\gamma}\Big)\,\vec B - \frac{G\,\gamma}{\gamma + 1}\, \big(\vec\beta \cdot \vec B\big)\,\vec\beta - \Big(G + \frac{1}{\gamma + 1}\Big)\, \frac{\vec\beta \times \vec E}{c} \Bigg]. \tag{38.4}\] Here \(\vec\beta = \vec v / c\) is the lab-frame velocity in units of \(c\) and \(\gamma = (1 - \beta^2)^{-1/2}\) is the corresponding Lorentz factor. The derivation is given in [2, Sec. 11.11]; we use the standard sign convention for \(\vec\Omega\) such that Equation 38.3 describes the time evolution of \(\vec P\) rather than that of a rotating frame.
Term-by-term, Equation 38.4 separates into three physically distinct contributions:
Cyclotron-Larmor term, \(-\tfrac{q}{m}\,(G + \tfrac{1}{\gamma})\vec B\). The \(1/\gamma\) piece is the relativistic Larmor precession at the cyclotron frequency \(\omega_c = qB/(\gamma m)\), common to any charged particle in a magnetic field. The \(G\) piece is the additional precession driven by the anomalous magnetic moment — it is the part the BMT equation contributes beyond the Dirac result \(g = 2\).
Longitudinal-\(B\) correction, \(+\tfrac{q}{m}\,\tfrac{G\gamma}{\gamma+1}\,(\vec\beta\cdot\vec B)\vec\beta\). Split \(\vec B\) into \(\vec B_\perp\) and \(\vec B_\parallel = (\hat\beta\cdot\vec B)\,\hat\beta\). With \(\gamma^2\beta^2 = \gamma^2 - 1\), the first two terms combine to \[ \vec\Omega_B = -\frac{q}{m}\Bigg[\Big(G + \frac{1}{\gamma}\Big)\,\vec B_\perp + \frac{1 + G}{\gamma}\,\vec B_\parallel\Bigg]. \] The correction changes the coefficient of \(\vec B_\parallel\) from \(G + 1/\gamma\) to \((1 + G)/\gamma\); it does not remove \(\vec B_\parallel\). In a solenoid, \(\vec B_\parallel\) does not deflect the momentum but rotates the spin about \(\hat\beta\) at \((1 + G)\,|q|B_\parallel/(\gamma m)\). The correction is zero when \(\vec\beta \perp \vec B\), as in the canonical storage ring geometry.
Motional-electric term, \(+\tfrac{q}{m}\,(G + \tfrac{1}{\gamma+1})\,(\vec\beta\times\vec E)/c\). This is the BMT response to electric fields. Even at \(G = 0\) (Dirac) it does not vanish — the residual \(1/(\gamma+1)\) is the Thomas-precession piece, which is a kinematic effect of the successive Lorentz boosts and survives in the absence of anomalous moments.
Setting \(G = 0\) in Equation 38.4 gives \[ \vec\Omega = -\frac{q}{m}\Bigg[\frac{\vec B}{\gamma} - \frac{\vec\beta \times \vec E}{c\,(\gamma + 1)}\Bigg]. \] With \(\vec E = 0\) and \(\vec\beta \perp \vec B\), \(\vec\Omega\) equals the cyclotron angular velocity of the momentum, so the spin keeps a fixed angle to the momentum. For \(G \neq 0\) the spin turns relative to the momentum at \(G\gamma\,\omega_c\), which gives the spin tune \(G\gamma\). A nonzero \(G\) also enters the longitudinal and electric terms.
OPALX currently tabulates \(G\) for the species that have a well-defined classical anomaly:
| Species | \(G = (g-2)/2\) | Source |
|---|---|---|
| Electron, positron | \(1.15965218128 \times 10^{-3}\) | QED [2] |
| Muon (\(\mu^\pm\)) | \(1.16592061 \times 10^{-3}\) | [3] |
| Proton, antiproton | \(1.792847386\) | [2] |
Species not listed default to \(G = 0\). Only beams with PARTICLE=MUON may set POLARIZATION; BEAM rejects it for every other species. The electron, positron, proton and antiproton values are therefore tabulated but not used yet. The sign of the muon charge comes from the beam’s CHARGE.
38.3 OPALX unit conventions
OPALX stores rest mass as the rest energy in eV (numerically \(m\,c^2\)), and charge in proton-charge units (dimensionless, e.g. \(-1\) for \(\mu^-\), \(+1\) for \(\mu^+\)). With these conventions, the SI ratio \(q/m\) that appears in Equation 38.4 becomes \[ \frac{q}{m}\bigg|_{\text{SI}} \;=\; \frac{\text{charge}\,\cdot\,c^{2}}{\text{mass}_{\text{eV}}} , \tag{38.5}\] because the elementary-charge factor cancels between numerator (units of \(e\)) and denominator (units of eV). This is the same idiom used by the Boris pusher [4] in OPALX; the spin and momentum updates therefore consume \(q, m\) in identical internal forms with no separate unit conversion needed.
38.4 Numerical integration: Rodrigues rotation
A naive explicit ODE solver applied to Equation 38.3 (e.g. RK4) does not preserve \(|\vec P|\) and accumulates a slow magnitude drift over time. OPALX therefore integrates Equation 38.3 as a closed-form rotation.
For a single step of duration \(\Delta t\) during which \(\vec\Omega\) is held constant, the exact solution is a rotation of \(\vec P\) about \(\hat n \equiv \vec\Omega / |\vec\Omega|\) by angle \[
\phi = |\vec\Omega|\,\Delta t .
\tag{38.6}\] The rotation is evaluated through Rodrigues’ formula, \[
\vec P' = \cos\phi\;\vec P
+ \sin\phi\,(\hat n \times \vec P)
+ (1 - \cos\phi)\,(\hat n \cdot \vec P)\,\hat n .
\tag{38.7}\] Equation 38.7 is an orthogonal transformation, so it conserves \(|\vec P|\) exactly for any \(\phi\). In floating-point arithmetic, rounding in the evaluation of Equation 38.7 changes \(|\vec P|\) at the level of machine precision in each step, and these errors can add up. OPALX does not renormalize \(\vec P\). The unit test PreservesMagnitudeOverManySteps checks that \(|\vec P|\) stays within \(10^{-12}\) of \(1\) after \(1000\) steps.
The rotation is exact for a fixed \(\vec\Omega\) at any angle, so no sub-steps are taken. The error comes from how much \(\vec\Omega\) changes during the step, through the change of the momentum and of the fields along the trajectory. If the spin turns by a large angle per step, reduce DT. \(\vec P\) is stored in double precision, like the momentum.
38.5 Placement in the tracker step
Each time step rotates \(\vec P\) twice, each time by half the particle’s own time step, \(\Delta t/2\):
- The first half drift moves the particle for \(\Delta t/2\). The external fields are evaluated at the new position; with the default
SCFIELDUPDATE=MIDPOINT, the space-charge fields are solved there too. \(\vec P\) is turned by \(\Delta t/2\) with the momentum before the Boris kick. - The Boris kick updates the momentum with the same fields.
- \(\vec P\) is turned by another \(\Delta t/2\) with the same \(\vec E\) and \(\vec B\) and the momentum after the kick.
- The second half drift moves the particle.
With SCFIELDUPDATE=PRESTEP, the space-charge fields are solved before the first half drift, at the start-of-step positions.
Both halves use the fields the kick uses, so momentum and spin see the same fields. \(\vec\beta\) and \(\gamma\) in Equation 38.4 are computed from the momentum that each half uses. The two half rotations are placed symmetrically around the kick. If the fields are smooth along the trajectory and evaluated at the midpoint, the local error is \(O(\Delta t^3)\) per step, and the spin error after a fixed length of tracking falls as \(\Delta t^2\). This order is not guaranteed with SCFIELDUPDATE=PRESTEP, where the space-charge part of \(\vec\Omega\) comes from the start-of-step positions, or when a hard-edge field boundary falls inside the step.
The rotation is skipped when \(\phi < 10^{-14}\). Since \(\phi = |\vec\Omega|\,\Delta t\), this also skips every step with \(\Delta t < 0\), so the spin update works for forward tracking only.