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
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
Note that to use an RPN expression the value of a parameter, one must enclose the expression in double quotes.