Hamiltonians#
This is an example of plotting hamiltonians in phase space distributions. First, create a simple line, a tracker and a particle set:
Kobayashi Hamiltonian#
The Kobayashi Hamiltonian describes the particle dynamics in the vicinity of a driven 3rd order resonance:
\[\begin{equation*}
H = 3\pi d \left(X^2 + X'^2\right) + \frac{S}{4} \left(3 X X'^2 - X^3\right)
\end{equation*}\]
with the tune distance d=q-r to the third integer resonance r=n/3 and the normalized sextupole strength:
\[\begin{equation*}
S = -\frac{1}{2} \beta_x^{3/2} k_2 l
\end{equation*}\]
Phase space plot with separatrix and equipotential lines:
plot = xplt.PhaseSpacePlot(
particles,
mask=particles.state > 0,
kind="X,x",
# plot='scatter',
twiss=tw,
hist_kwargs=dict(gridsize=50),
)
# determine the virtual sextupole
S, mu = xplt.util.virtual_sextupole(line, verbose=True)
# plot the hamiltonian
plot.plot_hamiltonian_kobayashi(0, S=S, mu=mu, extend=5)
plot.plot_hamiltonian_kobayashi(1, S=S, mu=mu, equipotentials=False)
plot.plot_hamiltonian_kobayashi(
1,
S=S,
mu=mu,
equipotentials=False,
delta=3e-4,
separatrix_kwargs=dict(alpha=0.3),
)
plot.axis(0).legend();
Sextupoles
name k2l betx mux dx S_abs S_deg
S2SX 0.43301 0.53530 0.45590 1.36368 0.08479 -47.62808
S3SX 0.43301 3.05592 0.78793 -0.21368 1.15660 -49.03026
S4SX 0.00000 0.53530 1.23339 1.36368 0.00000 72.05980
S5SX -0.43301 3.05592 1.56542 -0.21368 1.15660 -109.34238
S6SX -0.43301 0.53530 2.01088 1.36368 0.08479 11.74769
---------------------------------------------------------------
Virtual sextupole: S = 2.07503 m^(-1/2) at mu = -0.0700163 rad/2pi
See also