7.40 momentum_aperture

    STRING output = NULL;  
    double x_initial = 0;  
    double y_initial = 0;  
    double delta_negative_start = 0.0;  
    double delta_positive_start = 0.0;  
    double delta_negative_limit = -0.10;  
    double delta_positive_limit = 0.10;  
    double delta_step_size = 0.01;  
    long steps_back = 1;  
    long splits = 2;  
    long split_step_divisor = 10;  
    long skip_elements = 0;  
    long process_elements = 2147483647;  
    double s_start = 0;  
    double s_end = DBL_MAX;  
    STRING include_name_pattern = NULL;  
    STRING include_type_pattern = NULL;  
    long fiducialize = 0;  
    long verbosity = 1;  
    long soft_failure = 0;  
    long output_mode = 0;  
    long forbid_resonance_crossing = 0;  

The idea for this command is from M. Belgroune et al., “Refined Tracking Procedure for the SOLEIL Energy Acceptance Calculation,” Proceedings of PAC 2003, p 896, as implemented for TRACYII. In particular, the energy aperture as a function of position around the ring is determined by tracking. Starting at the beginning of the lattice and working downstream, particles are tracked starting from the exit of each selected element. The betatron coordinates are initially zero (or very small), while the momentum deviation is gradually increased until loss of the particle is observed. This defines the momentum aperture at that location.

In elegant version 19.0 and later, the algorithm is as follows. For simplicity in wording, we’ll assume the momentum deviations are positive values, although the method is applied separately for negative values as well:

  1. Start with δ = 0, i.e., zero momentum offset.
  2. Track a particle to see if it gets lost. If so, proceed to step 4.
  3. Increase δ by step size Δδ and return to step 2.
  4. If no splitting steps remain, proceed to the next step. Otherwise:
    1. Change δ to δs -sbΔδ., where δs is the largest δ for which the particle survived, and sb is the steps_back parameter.
    2. Divide the step size by split_step_divisor to get a new step size Δδ.
    3. Set δ = δ + Δδ.
    4. Decrement the “splits remaining” counter by 1.
    5. Continue from step 2.
  5. Stop. The momentum aperture is δs

This command can be used for both rings and transport lines. For rings it is most appropriate to have an rf cavity (i.e., an RFCA element) in the lattice. One should also include radiation loss using either of two methods:

  1. SREFFECTS element, with QEXCITATION=0. To set up this element more easily, one can include a twiss_output command with radiation_integrals=1.
  2. Use CSBEND and KQUAD elements with SYNCH_RAD=1 and ISR=0.

When including radiation loss, one must be certain to set the frequency and phase of the rf cavity correctly. The rf_setup command can be used for this purpose. It is also a good idea to track for several synchrotron oscillation periods.

Note for Pelegant: Unlike for elegant, the data in the output file will not be sorted by s. To sort the data, simply use sddssort from the commandline, e.g.,

sddssort -column=s output.mmap

Also, if it is desirable for the output from Pelegant to have exactly the same form as that from elegant, then the script reorganizeMmap should be used. This script is provided with elegant and Pelegant distributions.