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.
TWISS, SEQUENCE=seq_name, LINE=line_name, RANGE=range,
DELTAP=real{,real}||initial:final:step,
CHROM=logical,
CENTRE=logical, TOLERANCE=real,
FILE=filename,
TABLE=table_name, NOTABLE=logical,
RMATRIX=logical,
SECTORMAP=logical, SECTORTABLE=tablename, SECTORFILE=filename,
KEEPORBIT=name, USEORBIT=name,
COUPLE=logical,
RIPKEN=logical;
The attributes of the TWISS command are:
- SEQUENCE =sequence_name (Default: sequence or beam line defined
in the latest USE command)
sequence_name is the name of a valid sequence
for which the calculation of optical functions should be performed.
SEQUENCE and LINE are mutually exclusive.
- LINE =line_name (Default: sequence or beam line defined
in the latest USE command)
line_name is the name of a valid beamline
for which the calculation of optical functions should be performed.
SEQUENCE and LINE are mutually exclusive.
- RANGE =range (Default: #S/#E)
The TWISS calculation can be restricted to the specified range.
See \href{../Introduction/ranges.html#range}{RANGE}.
- DELTAP =real{,real} or =initial:final:step (Default: 0.0)
The relative energy error DELTAP may be entered in one of the two
forms above.
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.
For example, DELTAP=0.001 defines a single value,
DELTAP=0.001,0.005 defines two values, and
DELTAP=0.001:0.007:0.002 defines four values.
- CHROM {=logical} (Default: false,
CHROM alone is equivalent to CHROM=true)
Flag to trigger the computation of the
chromatic functions,
as well as the radiation synchrotron integrals.
Please note that this option is needed
for a proper calculation of the chromaticities in the
presence of coupling!
Please note that this option also changes the way that the
chromaticities are calculated: The chromaticities are normally
calculated from the analysis of the first and second order
matrices. With CHROM, the chromaticities are recalculated by
explicitely calculating the tunes for the case of the specified momentum
deviation DELTAP and for the case of a momentum deviation equal
to DELTAP+1.e-6. The tune differences divided by 1.e-6 yield the
chromaticities.
- CENTRE =logical (Default: false,
CENTRE alone is equivalent to CENTRE=true)
Logical flag to trigger the calculation of the
linear lattice functions
at the center of the element instead of at the end.
The values in the tables and in the output files are affected by this flag.
Since the lattice functions are then calculated inside the element,
the closed orbit coordinates in the output also include the misalignment
of the element.
- TOLERANCE =real (Default: 1.e-6)
The maximum closed orbit error, for all six orbit components,
that can be tolerated during the closed orbit search.
The value given in the TWISS command is only valid for the current calculation;
the COGUESS command allows to
change the default value for all subsequent closed orbit search calculations.
- FILE =string (Default:"twiss")
causes MAD-X to writes a TFS Twiss table
to the file specified.
The columns of the table can be selected using the
SELECT command with the flag="twiss" attribute.
- TABLE (overrides SAVE):
MAD-X creates a full Twiss
table in memory and gives it the name TWISS, unless
TABLE="table_name" appears on the command, then it is called table_name.
This table includes linear lattice functions as well as the chromatic
functions for all positions. An important new feature of MAD-X is the
possibility to access entries of tables and in particular the twiss
table (see table access).
If the TABLE option is given the selection of column names via the SELECT
command is ignored. Hence if both TABLE and FILE options are given,
the table written to file is the full twiss table, containing
all elements as rows and all known twiss parameters as columns.
- NOTABLE {=logical} (Default: false,
NOTABLE alone is equivalent to NOTABLE=true)
flag to prevent the creation of the internal Twiss table.
Consequently no output file can be created either.
- RMATRIX {=logical} (Default: false)
RMATRIX alone is equivalent to RMATRIX=true)
flag to trigger the calculation of the one-turn map at the location
of every element and subsequent storage in the TWISS table.
Using the SELECT
command and using the column RE, RE11...RE16...RE61...RE66 these
components will be added to the TWISS table, i.e. with "column, RE"
and "column, REij" one gets all or the component "ij" respectively.
- SECTORMAP {=logical} (Default: false)
SECTORMAP alone is equivalent to SECTORMAP=true)
flag to trigger the calculation of a sector map as described at: SECTORMAP.
- SECTORTABLE {=string} (Default:"sectortable")
The name of the table containing the sectormap values can be specified.
The elements (lines) and parameters (columns)
of the table can be tailored using the SELECT command as specified in
SECTORMAP
- SECTORFILE {=string} (Default: "sectormap")
The sectormap table output is written to the filename given as argument.
The format of the output can be adjusted as specified in
SECTORMAP
Default: SECTORFILE="sectormap".
- KEEPORBIT {=label} (Default: none)
The keeporbit attribute (with an optional name, keeporbit="name")
stores the orbit under this name at the start, and at all monitors.
- USEORBIT {=label} (Default: none)
The useorbit attribute (with an optional name, useorbit="name") uses
the start value provided for the closed orbit search; the values at
the monitors are used by the threader.
- RIPKEN {=logical} (Default: false,
RIPKEN alone is equivalent to RIPKEN=true)
This flag triggers the translation of the Edwards-Teng twiss parameters
(betx, bety, alfx, alfy, gamax, gamay, R11, R12, R21 and R22)
into the corresponding Ripken-Mais TWISS parameters and the output
of the corresponding columns in the twiss table:
beta11, beta12, beta21, beta22,
alfa11, alfa12, alfa21, alfa22,
gama11, gama12, gama21 and gama22.
The phases advances are not translated,
and mu1, mu2 and mu3 are not available in TWISS output.
Coupled Functions
TWISS in MAD-X is always calculated in coupled mode.
MAD-X computes the coupled functions in the sense of
[Edwards and Teng].
For the uncoupled cases they reduce to the C and S functions.
The COUPLE option of MAD8 is therefore obsolete.
Please note that the
chrom option
is needed for a proper calculation of the chromaticities in the
presence of coupling!
Twiss calculation is 4D only!
The Twiss command calculates an approximate 6D closed orbit when
the accelerator structure includes an active
cavity.
However, the calculation of the Twiss parameters are 4D only.
This may result in apparently non-closure of the beta values
in the plane with non-zero dispersion.
The full 6D Twiss parameters can be calculated with the
ptc_twiss command.
Tables
The tables produced by TWISS 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.
versus the selected values of DELTAP.
The summary parameters can be accessed via the
table access
function using the aforementionned implicit table named "summ".
There is no way to change the name of the summary table.
Momentum derivatives
MAD-X uses PT as longitudinal variable, instead of the common
DELTAP used in the litterature.
Dispersive and chromatic functions are hence derivatives with respect
to PT( see table).
The simplest form of the TWISS command is
TWISS;
which calculates the periodic solution for the last USE'd beamline or sequence,
with DELTAP = 0. Chromatic functions are not calculated.
Standard tables (TWISS and SUMM) are created in memory but no file is written to disk.
The slighltly more elaborate version
TWISS, DELTAP=real{,real}, CHROM, TABLE=table_name;
computes the periodic solution, including chromatic functions, for the last USE'd beam
line or sequence, for all values of DELTAP entered
(or for DELTAP = 0, if none is entered).
The tables "table_name" and SUMM are created in memory and no file is written to disk.
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);
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.
Initial lattice parameters can be transfered for later commands, in
particular for twiss or the match module,
by using
the savebeta command
sequence.
Parameters in tables can
also be accessed
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 tracks 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).
Initial lattice parameters can be set 'manually' for later commands, in
particular for twiss or the match module,
by using the BETA0 command attached to a label.
Example 3:
INITIAL: BETA0, BETX=BX0, ALFX=0.0, MUX=0.0, BETY=BY0, ALFY=0.0, DX=DX0, DPX=0.0;
TWISS, BETA0=INITIAL;
Example 4:
INITIAL: BETA0, BETX=BX0, ALFX=0.0, MUX=0.0, BETY=BY0,A LFY=0.0, DX=DX0, DPX=0.0;
TWISS, BETX=INITIAL->BETY, BETY=INITIAL->BETX;
frs,
06-Apr-2003. Revised in February 2007.
Revised by Ghislain Roy, 1 July 2014.