The corresponding sequence of statements defining a sequence is
name: SEQUENCE,REFER=keyword,REFPOS=name,LENGTH=real,ADD_PASS=integer,NEXT_SEQU='seq_name' 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.
The ADD_PASS=integer option specifies a number of additionnal passes (max. 5)
through the structure; in case of an RBEND the angle will be overwritten in
survey using the i-th component (1 <= i <= add_pass <= 5) of its array_of_angles
(see RBEND).
The NEXT_SEQU='seq_name' concatenates the sequence with name 'seq_name'
to the end of the specified sequence.
Inside the sequence ... endsequence bracket three types of commands
may be placed:
When the sequence is expanded in a
USE command,
MAD generates the missing drift spaces. At this moment, overlapping elements
will cause "negative drift length" errors.
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