9 Accelerator and Element Description

As mentioned in the introduction, elegant uses a variant of the MAD input format for describing accelerators. With some exceptions, the accelerator description for one program can be read by the other with no modification. Among the differences:

elegant’s lattice parser translates all input into upper case, except where the input is protected by double quotes. However, various commands (such as vary_element or link_elements) that accept element names as input do not perform any translation. Hence, when referring to element names in commands, the user must enter the names in upper case unless they are protected by double quotes in the lattice file.

When the lattice file is very complex, it is sometimes convenient to separate it into several files. These can then be imported into a main lattice file using the #INCLUDE directive, as in

#INCLUDE: part1.lte  
#INCLUDE: part2.lte

The rules for naming elements and beamlines are as follows:

If using unusual characters in a name, it is a good idea to enclose the name in double quotes. This is required if : is in the name.

elegant’s print_dictionary command allows the user to obtain a list of names and short descriptions of all accelerator elements recognized by the program, along with the names, units, types, and default values of all parameters of each element. The present output of this command is listed in the next section. The reader is referred to the MAD manual[2] for details on sign conventions for angles, focusing strength, and so forth.

Comments may be embedded in the lattice file by starting a line with an exclamation point (“!”). Rpn expressions may be embedded separately from an element definition by starting a line with a percent sign (“%”). For example

! Define Pi (actually "pi" is already defined, but this is just an example)  
% 1 atan 4 * sto Pi  
% Pi 40 / sto myAngle  
! Define a rectangular bend for a ring with 80 equal bends  
B1: SBEN,L=1.0,ANGLE="myAngle",E1="myAngle 2 /",E2="myAngle 2 /"

Note that to use an RPN expression the value of a parameter, one must enclose the expression in double quotes.

 9.1 Magnet Strength