Closed Alfven17 closed 2 years ago
What is the issue?
For free space start, t is the same for all particles. This is not an issue itself but ParticleGroup uses t when writing to Bmad's ASCII file, and all the "z"s will be zeros.
So it's really about making the two interfaces compatible. Maybe one can force a coordinate conversion from t to s?
Bmad uses so-called s-coordinates that define all particles z=0
, and uses the time (z_bmad = -beta*c*(t - t_ref)
) as the longitudinal phase space coordinate. ParticleGroup
provides some conveniences for converting these:
https://github.com/ChristopherMayes/openPMD-beamphysics/blob/c7beed293330353cc1b25c534ba5b2360f5d79f1/pmd_beamphysics/particles.py#L122
Currently the write_bmad
function does not do this conversion, but rather expects that you know what you are doing.
https://github.com/ChristopherMayes/openPMD-beamphysics/blob/c7beed293330353cc1b25c534ba5b2360f5d79f1/pmd_beamphysics/interfaces/bmad.py#L3
Perhaps it could raise a warning?
Yes, that's probably sufficient.
https://github.com/ChristopherMayes/openPMD-beamphysics/blob/master/pmd_beamphysics/interfaces/impact.py#L92