The corresponding sequence of statements defining a sequence is
name: SEQUENCE,REFER=keyword,REFPOS=name,LENGTH=real label: class,AT=real{,attributes} | class,AT=real | sequ_name, AT=real ... ENDSEQUENCEwhere "real" means a real number, variable, or expression.
The first line gives the sequence name, a REFER flag (entry, centre, or exit) which specifies at which part of the element its position along the beam line will be given (default: centre), a REFPOS argument used for sequence insertion, and the total length.
Inside the sequence ... endsequence bracket three types of commands may be placed:
For efficiency reasons MAD-X imposes an important restriction on element lengths and positions: once a sequence is expanded, the element positions and lengths are considered as fixed; in order to vary a position or element length, a re-expansion of the sequence becomes necessary. The MATCH command contains a special flag "vlength" to match element lengths.
! define a default beam (otherwise fatal error) beam; ! Define element classes for a simple cell: b: sbend,l=35.09, angle = 0.011306116; qf: quadrupole,l=1.6,k1=-0.02268553; qd: quadrupole,l=1.6,k1=0.022683642; sf: sextupole,l=0.4,k2=-0.13129; sd: sextupole,l=0.76,k2=0.26328; ! define the cell as a sequence: sequ: sequence,l=79; b1: b, at=19.115; sf1: sf, at=37.42; qf1: qf, at=38.70; b2: b, at=58.255,angle=b1->angle; sd1: sd, at=76.74; qd1: qd, at=78.20; endm: marker, at=79.0; endsequence;hansg, June 17, 2002