As of version 25.3, certain elements in elegant can operate under the assumption that the beam is organized into bunches.
This includes the LRWAKE, WAKE, TRWAKE, ZLONGIT, and ZTRANSVERSE elements.
At present, this behavior is only available when loading a beam from an external file using the
A typical sequence is to run elegant once to generate a beam file using
bunched_beam, then load that beam into a subsequent run.
In the beam-generation run,
run_control command must be used to specify both the number of bunches (using
n_steps) and the bunch frequency (using
The beamline for this run would typically consist simply of a zero-length drift space, so that the
output file from the
contains the coordinates for each bunch as generated, with no modifications.
Once the beam is generated, it can be used as the input file for
For those who prepare beams using other programs, it may be helpful to understand how the organization of the beam into bunches is specified.
The relevant data from the beam file are the values in the
IDSlotsPerBunch parameter and
particleID is generally a unique positive integer for each particle.
IDSlotsPerBunch is non-zero, the bunch index is computed as
, where is the particle ID.
For example, with
IDSlotsPerBunch=1000, particle IDs from 1 to 1000 would be in bunch 0, from 2001-3000 would be bunch 1, and so on.
This mechanism allows specifying the bunch structure without adding columns to the beam file, and also handles particle loss automatically.
Note that although in the case of beams generated with
bunched_beam the individual bunches appear in separate pages of the beam file, this is not