Next: , Up: Lattice


3.1 Program structure

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:

     
     mk: marker;
     qf: quadrupole, l=0.5*m, k1=0.1*m^-2;
     qd: quadrupole, l=0.5*m, k1=-0.1*m^-2;
     d: drift, l=0.5*m;
     fodo : line=(qf,d,qd,d,mk);
     use, period=fodo;
     beam, particle="e-",energy=1*GeV;
     option, beampipeRadius=5*cm, beampipeThickness=5*mm;
     sample, range=mk;
     

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 and csample commands control 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.