Next: expressions, Up: Lattice
A GMAD program consists of a sequence of element definitions and control commands. For example, tracking a 1 GeV electron beam through a FODO cell will require a file like this:
for example
qf: quadrupole, l=0.5*m, k1=0.1
;qd: quadrupole, l=0.5*m, k1=-0.1
;d: drift, l=0.5*m
;fodo : line=(qf,d,qd,d)
;use,period=fodo
;beam, particle="e-",energy=1*GeV
;
Generally, the user has to define a sequence of elements (with drift
, quadrupole
,line
etc.),
then select the beamline with the use
command and specify beam parameters and other options with
beam
and option
commands. The sample
command controls what sort of information will be recorded
during the execution.
The parser is case sensitive. However, for convenience of porting lattice descriptions from MAD the keywords can be both lower and upper case. The GMAD language is discussed in more detail in this section.