EUROPEAN ORGANIZATION FOR NUCLEAR RESEARCH

Twiss Module

The TWISS command causes computation of the [Courant and Snyder] linear lattice functions, and optionally of the chromatic functions. The coupled functions are calculated in the sense of [Edwards and Teng]. For the uncoupled cases they reduce to the C and S functions. It operates on the working beam line defined in the latest USE command. One can also specify either a SEQUENCE="sequence_name" or a LINE="line_name" on the TWISS command. Moreover, one can restrict the TWISS calculation to a desired RANGE.

The relative energy error DELTAP may be entered in one of the 2 forms

DELTAP=real{,real}
DELTAP=initial:final:step
The first form lists several numbers, which may be general expressions, separated by commas. The second form specifies an initial value, a final value, and a step, which must be constant expressions, separated by colons.

Examples:

DELTAP=0.001                    ! a single value
DELTAP=0.001,0.005 ! two values
DELTAP=0.001:0.007:0.002 ! four values
If DELTAP is missing, MAD-X uses the value 0.0.

Further attributes of the TWISS statements are:

The tables are suitable for plot. After a successful TWISS run MAD-X creates an implicit table of summary parameters named "summ" which includes tunes, chromaticities etc (Please note that the chrom option is needed for a proper calculation of the chromaticities in the presence of coupling!) versus the selected values of DELTAP. Notice that in MAD-X DELTAP is converted in PT, which is used as longitudinal variable. Dispersive and chromatic functions are hence derivatives with respects to PT( see table). These summary parameters can later be accessed via the table access function using the aforementionned implicit table named "summ". There is no way to change the name of this summary table.

Twiss Parameters for a Period

The simplest form of the TWISS command is
TWISS, DELTAP=real{,value},CHROM,
TABLE=table_name;
It computes the periodic solution for the specified beam line for all values of DELTAP entered (or for DELTAP = 0, if none is entered).

Example:

USE,period=OCT;
TWISS,DELTAP=0.001,CHROM;
This example computes the periodic solution for the linear lattice and chromatic functions for the beam line OCT. The DELTAP value used is 0.001. Apart from saving computing time, it is equivalent to the command sequence
RING: LINE=(4*(OCT,-OCT));
USE,period=RING;
TWISS,DELTAP=0.001,CHROM;

Initial Values from a Periodic Line

It is possible to track the lattice functions starting with the periodic solution for another beam line. If this is desired the TWISS command takes the form
TWISS, DELTAP=real{,value},LINE=beam-line,
MUX=real,MUY=real,
TABLE=table_name;
No other attributes should appear in the command. For each value of DELTAP MAD-X first searches for the periodic solution for the beam line mentioned in LINE=beam-line: The result is used as an initial condition for the lattice function tracking.

Example:

CELL:   LINE=(...);
INSERT: LINE=(...);
USE,period=INSERT;
TWISS,LINE=CELL,DELTAP=0.0:0.003:0.001,CHROM,FILE;
For four values of DELTAP the following happens: First MAD-X finds the periodic solution for the beam line CELL: Then it uses this solution as initial conditions for tracking the lattice functions of the beam line CELL: Output is also written on the file TWISS:

If any of the beam lines was defined with formal arguments, actual arguments must be provided:

CELL(SF,SD): LINE=(...);
INSERT(X): LINE=(...);
USE,period=INSERT;
TWISS,LINE=CELL(SF1,SD1);

Given Initial Values

Initial values for linear lattice functions and chromatic functions may also be numerical. Initial values can be specified on the TWISS command:

TWISS,   BETX=real,ALFX=real,MUX=real,
BETY=real,ALFY=real,MUY=real,
DX=real,DPX=real,DY=real,DPY=real,
X=real,PX=real,Y=real,PY=real,
T=real,PT=real,
WX=real,PHIX=real,DMUX=real,
WY=real,PHIY=real,DMUY=real,
DDX=real,DDY=real,DDPX=real,DDPY=real,
R11=real,R12=real,R21=real,R22=real, !coupling matrix
TABLE=table_name,
TOLERANCE=real,
DELTAP=real:real:real;
All initial values for linear lattice functions and chromatic functions are permitted, but BETX and BETY are required. Moreover, a beta0 block can be added as filled by the savebeta command or see below. The lattice parameters are taken from this block, but will be overwritten by explicitly stated lattice parameters. As entered, the initial conditions cannot depend on DELTAP, and can thus be correct only for one such value.

Tolerance

This value defines the maximum closed orbit error of all six orbit components during the closed orbit search. The default value is 1.e-6. The value is only valid for the current twiss command; a permanent value can be entered via the COGUESS command.

SAVEBETA: Save Lattice Parameters

Initial lattice parameters can be transfered for later commands, in particular for twiss or the match module, by using the savebeta command sequence.

It should be mentioned that parameters can be also accessed from tables using the table access function.

USE,period=...;
SAVEBETA,LABEL=name,PLACE=place,SEQUENCE=s_name;
TWISS,...;
When reaching the place in the sequence "s_name" during execution of TWISS, MAD-X will save a beta0 block with the label name: This block is filled with the values of all lattice parameters in place. Example 1:
USE,period=CELL;
SAVEBETA,LABEL=END,PLACE=#E,SEQUENCE=CELL;
TWISS;
USE,period=INSERT;
TWISS,BETA0=END;
This first example calculates the periodic solution of the line CELL, and then track lattice parameters through INSERT, using all end conditions (including orbit) in CELL to start.

Example 2:

USE,period=CELL;
SAVEBETA,LABEL=END,PLACE=#E,SEQUENCE=CELL;
TWISS;
USE,period=INSERT;
TWISS,BETX=END->BETY,BETY=END->BETX;
This is similar to the first example,
but the beta functions are interchanged (overwritten).

frs, 06-Apr-2003. Revised in February 2007.