The Magnet Input and Output File
The magnet description file is in ASCII format and contains the explicit profile of all magnetic components or a subset of it. After processing the file GENESIS 1.3 recalculates the undulator length and adjusts the number of integration steps. Field errors and tapering is always enforced, when the corresponding parameters in the main input file are set. This allows that different sets of field errors or taper gradients can be simulated while using only a single input file. The output of the magnetic lattice, if requested, includes the field lattice, seen by particle of the simulation. Even if field error and taper is disabled the output file might differ from the input file in the format, but not in the content.
If any line of the input file starts with a space the content of the entire line is treated as a comment. Also any character beyond the 30th position is ignored. These two restrictions does not apply for the C++ version. In general the processing of the file is case insensitive.
Each line is categorized either as
The content line actually holds information about the magnetic structure. The format of each line depends on the version of the input file. There is a difference between the current version 1.0 and earlier versions (<1.0). The version number is defined by an information line in the header of the file. If omitted GENESIS 1.3 assumes a version prior to 1.0.
Each line hast four elements, where the first two are version independent. The first element is a two-character string, indicating the type of structure. Following types are supported
Next the strength/offset value of that structure is specified.
For earlier version the next two numbers define the length of the structure. The first of those is a unit length, common for all structure. Typically it is the undulator period length. The second number is the length of the structure in measure of the unit length. As an example the following lines descibe a 1 m long undulator with an rms strength of 1.30:
Note that for a file version < 1.0 the absence of any structure must be included in the input file as well. The strength/offset value is zero. Thus a two cell FODO lattice with a 4 cm quadrupole length and a drift length of 8 cm is defined by
For the latest version the unit length is declared once in the header of the file and is mandatory. The third number is the length of the structure in measure of the unit length, while the last number is the distance to the previous element of the same kind, again inmeasure of the unit length. The definition of the FODO cell becomes now
The usage of the lines, starting with the question marks, are explainded below.
A comment line is indicated by a -sign as its first character. The remaining content of the line is ignored. Similar lines, which do not contain any printable characters (spaces excluded) are treated as comment lines.
A command line starts with an exclamation mark. For the magnetic field only two commands are recognized. The first command !LOOP = x marks the beginning of a loop where x is the number of loops to be performed. Note that there can be an arbitrary number of spaces on both sides of the equal sign as long as the entire line is no longer than 30 characters. The end of the loop is indicated by !ENDLOOP. Loops cannot be nested and starting a new loop before the current loop is not closed will cause an error and the termination of GENESIS 1.3. The following lines define the same FODO lattice as above but this time with 10 cells
The last class of input lines is information lines, which helps GENESIS 1.3 to process the file correctly. These lines have to start with a question mark. One example is to set the version number with ?VERSION = n.m for compatibility reason, where m.n is the version number. Currently only versions below 1.0 and below are supported. The remaining other option is setting the unitlength with ? UNITLENGTH = x, where x is the numeric value of the length in meter. As for the command line spaces can seperate keyword, equal sign and value.
Note that GENESIS 1.3 stops processing a line, once it obtained all needed information. This allows, also not recommended, to add comments at the end of each line.