EUROPEAN ORGANIZATION FOR NUCLEAR RESEARCH MAD-X Logo

PTC_TWISS Module
(Ripken Optics Parameters)

The PTC_TWISS module of MAD-X [a] is based on the PTC code. It is a supplementary to the TWISS module. The Twiss parameters are calculated in  Ripken's style (invented by G. Ripken in 1970 [31] and most accessible in Ref. [b]). These parameters were available in MAD8 using the TWISS3 command. This module is a typical example of the advantages when using PTC and its Normal Form technique (and of course the object-oriented Fortran90 coding): once the rather modest programming has been performed the Twiss calculation will always be automatically correct for all machine conditions like closed orbit, coupling or after a new element has been introduced into the code. In a traditional coding like in MAD8 this depends on reprogramming and modifying the code at various places which is inherently error-prone.

The PTC_TWISS tracks a special representation of the beam in three degrees of freedom. It works on the coupled lattice functions defined in Ref.[b], which are essentially the projections of the lattice functions for the eigen-modes on the three planes. The PTC_TWISS lists the projections of the ellipses of motion onto the three planes (x, px), (y, py), (t, pt) expressed them via the Ripken's parameters bk,j, ak,j, gk,j along with the phase advances   mj in selected positions, where index k=1...3 refers to the plane (x, y,...), and the index j=1...3 denotes the eigen-mode. The PTC_TWISS also calculates the dispersion values D1,...,D4. In the MAD-X commands and tables, these parameters are denoted as beta11,...,beta33, alfa11,...,alfa33, gama11,...,gama33, mu1,...,mu3, disp1,...,disp4, respectively.

The Ripken parametrization can be transformed into the Edwards-Teng parametrization (used in twiss proper) using the formulae of Ref. [d]. The parameters are noted as betx, bety, alfx, alfy and the coupling matrix: R11, R12, R21 and R22. In absence of coupling it holds: betx=beta11, bety=beta22, alfx=alfa11 and alfy=alfa22.

PTC_TWISS can also compute the deltap/p-dependency of the Twiss parameters. The column names beta11p,...,beta33p, alfa11p...,alfa33p, gama11p,...,gama33p denote the derivatives of the optics parameters w.r.t. deltap/p. If one is interested in evaluating deltap/p-dependency of the Twiss parameters, one must ensure that the order (no) of the map is set to 2 at least.. The derivatives of the dispersion w.r.t. deltap/p have column names: disp1p,...,disp4p. Second and third order derivatives have respective column names: disp1p2,...,disp4p2 for the second order, and disp1p3,...,disp4p3 for the third order.

In addition, we compute momentum compaction factor ac up to 1st order (for icase=5) or 3rd order (for icase=56). The values appear in the header of the ptc_twiss output file (zero means the value has not been computed). This feature is currently only available in the development version.

For clarification: in the 4-D case, there is the following correspondence between MAD-X and the Ripken's notations: beta11®bxI, beta12®bxII, beta21®byI, beta22®byII, while in the uncoupled 4-D case beta11 is the same as the classical bx (betx) and  beta22 is by (bety), while  beta12 and  beta21 are zero. When there is coupling all betaNN are non-zero and beta11 , beta22 are distinctively different from  bx , by, respectively.

PTC_TWISS also tracks the eigenvectors and prints them to Twiss table according to the SELECT command (flag=ptc_twiss). Either all 36 components or  particular components of the eigenvectors can be selected with eign or eignij, respectively  (j = number of eigenvector, i = number of coordinate {x, px, y, py, t, pt}).

For ring lattices, PTC_TWISS computes momentum compaction, transition energy, as well as other one-turn characteristics such as the tunes (Q1,Q2 and if icase=6 with cavity Qs) and chromaticities (for no>=2).


Synopsis
PTC_CREATE_UNIVERSE;
PTC_CREATE_LAYOUT, model=integer,method=integer, nst=integer, [exact];
..............................
SELECT, flag=ptc_twiss, clear;
SELECT, flag=ptc_twiss, column=name, s,
beta11,...,beta33,alfa11,..., alfa33,gama11,...,gama33,
beta11p,...,beta33p,alfa11p,...,alfa33p,gama11p,...,gama33p,
mu1,...,mu3,
disp1,...,disp4,
disp1p,...,disp4p,
disp1p2,...,disp4p2,
disp1p3,...,disp4p3,
[eign], eign11, ...,eign16,...,eign61,...,eign66;
..............................
PTC_TWISS;
..............................
PTC_END;
Commands
PTC_TWISS,
    icase=
integer,
deltap=double, closed_orbit, slice_magnets,
    range=
string, file[=string], table[=string],
    initial_matrix_table, initial_matrix_manual, initial_map_manual, beta0=
string,
    betx=
double, alfx=double, mux=double,
    bety=
double, alfy=double, muy=double,
    dx=
double, dpx=double, dy=double, dpy=double,
   
x=double, px=double, y=double, py=double, t=double, pt=double,
    re11=double, re12=double, ... ,re16=double,
    ................................................................
    re61=double, re62=double, ... ,re66=double;                     
 
Description
The PTC_TWISS command causes computation of the Twiss parameters in the Ripken's style. It operates on the working beam line defined in the latest USE command. Several options can be specified, the most important being icase, deltap, closed_orbit, slice_magnets, no, and file, table. (see the table below). Other options should be specified for particular tasks. Applications for the PTC_TWISS command are similar to the TWISS-command. The PTC_TWISS can be applied to two basic tasks. It can calculate either a periodical solution or a solution with initial conditions.
Options
Option Meaning Default Value Value Type
ICASE the user-defined dimensionality of the phase-space (4, 5 or 6). Note that the value is internally set to 56 when attempting to set icase=6 with no cavity. 4 integer
NO the order of the map, which is often supplied as 1 but must be at least set to 2 to retrieve chromaticities for instance. For evaluating the Twiss parameters derivatives w.r.t. deltap/p, one must pass order 2 at least. 1 integer
DELTAP

relative momentum offset for reference closed orbit.

0.0 double
CLOSED_ORBIT the switch to turn on the closed orbit calculation (periodical solution ONLY). .FALSE. logical
DELTAP_DEPENDENCY the switch to turn on computation of the Twiss and dispersion derivatives w.r.t. deltap/p. Derivation formula assume that icase=5, so that deltap/p is supplied as a parameter. .FALSE. logical
SLICE_MAGNETS the switch to turn on the evaluation of Twiss parameters at each thin slice inside successive magnets, instead of at the middle of each magnet. Slices are located at the so-called 'integration nodes' determined by the number of steps (nst) selected when creating the PTC layout. Note that extremities and fringes are skipped, whereas only the inner slices are kept. .FALSE. logical
CENTER_MAGNETS the switch to turn on the evaluation of Twiss parameters at the middle of each magnet. This relies on internal slicing and 'integration nodes' as determined by the number of steps (nst) selected when creating the PTC layout. This number is assumed to be even otherwise the program issues a warning. .FALSE. logical
FILE omitted no output written to a file    
present the name of the file for printing the PTC_TWISS output. ptc_twiss string
TABLE omitted no output written to a internal table    
present the name of the internal PTC_TWISS table ptc_twiss string
SUMMARY_FILE omitted no output written to a file    
present the name of the file for printing the PTC_TWISS_SUMMARY table output. ptc_twiss_summary string
SUMMARY_TABLE omitted no output written to a internal table    
present the name of the internal PTC_TWISS_SUMMARY table ptc_twiss_summary string
RANGE specifies a segment of beam-line for
the PTC_TWISS calculation
#s/#e string
INITIAL_MATRIX_TABLE Reading the transfer matrix from the map-table in memory (preceding PTC_NORMAL command needed). .FALSE. logical
INITIAL_MATRIX_MANUAL Using the input variables RE11,...,RE66 (see next entry) as the transfer matrix. .FALSE. logical
INITIAL_MAP_MANUAL Using the input map stored beforehand in file fort.18 (e.g. by some initial run of PTC_NORMAL). .FALSE. logical
RE11,..., RE66 Values of the 6x6 transfer matrix. unit matrix double
BETA0 The name of the BETA0-block, which contains the Twiss parameters for the input. When icase=6, this information must be complemented by supplying a value for 'betz' on the ptc_twiss command line. beta0 string
betx, alfx, mux, bety, alfy, muy, dx,dpx,dy, dpy   Twiss and dispersion parameters bx,y, ax,y, gx,y, Dx, Dpx, Dy, Dpy (Edwards and Teng). 0 double
x, px, y, py, t, pt The canonical coordinates of the initial orbit. 0 double
Remarks
ICASE:   It can be internally corrected by the code. For example, if RF cavity has the voltage set to zero and for icase=6, the code sets icase=4.
 
Periodical Solution
PTC_TWISS,
    icase=
integer,
deltap=double, closed_orbit,
    range=
string, file[=string], table[=string];
Description
This is the simplest form of the PTC_TWISS command, which computes the periodic solution for a specified beam line. It may accept  all basic options described in the above table.
Evaluation of Twiss parameters inside magnets
PTC_TWISS,
    icase=
integer,
deltap=double, closed_orbit, slice_magnets
    range=
string, file[=string], table[=string];
Description
This computes the periodic solution for a specified beam line and evaluates the Twiss parameters at each thin-slice (a.k.a "integration-node") inside magnets. The number of such integration-nodes is given by the number of steps (nst) selected when creating the PTC layout. All other basic options described in the above table may be selected .
Example
An example is found in the PTC_TWISS Examples' repository. .
Solution with Initial Conditions
Code Logic:  
 

IF ("initial_matrix_table"=ON .AND.
&    {the map-table exists})   THEN
   (
from a Map-Table)

ELSEIF("initial_map_manual"=ON) THEN
   (
from a Given Map File)

ELSEIF("initial_matrix_manual"=ON) THEN
   (
from a Given Matrix)

ELSEIF(BETA0 block =ON) THEN
   (
from Twiss Parameters via BETA0-block)

ELSE
   (
from Given Twiss Parameters)

ENDIF

Initial Values from a Map-Table
(obtainable by a preceding
PTC_NORMAL command):
    PTC_TWISS,
        icase=
integer,
deltap=double, closed_orbit
        range=string, file[=
string], table[=string],
        initial_matrix_table
;                     
 
Description
PTC_TWISS calculates a solution with initial conditions given as a map-table of preceding ring or beam-line. It requires the input option initial_matrix_table and an existence of the map-table in memory, which was generated by a  preceding PTC_NORMAL command.
Example
An example is found in the PTC_TWISS Examples in the folder "Example3".
Initial Values from a Map-File
(obtainable by a preceding
PTC_NORMAL command):
    PTC_TWISS,
        icase=
integer,
deltap=double, closed_orbit
        range=string, file[=
string], table[=string],
        initial_map_manual
;                     
 
Description
PTC_TWISS calculates a solution with initial conditions given as a map-file fort.18 obtained from a preceding ring or beam-line. It requires the input option initial_map_manual and an existence of the map-file named a fort.18 file, which was generated by a  preceding PTC_NORMAL command.
Example
An example is found in the PTC_TWISS Examples in the folder "Example3".
Initial Values from a Given Matrix:
    PTC_TWISS,
        icase=
integer,
deltap=double, closed_orbit,
        range=string, file=
string, table=string,
        initial_matrix_manual,
        re11
=double, re12=double, ... ,re16=double,
        ................................................................
        re61=double, re62=double, ... ,re66=double;
Description
PTC_TWISS calculates a solution with initial conditions given by the matrix, which is "manually" entered on the command-line. It requires the option initial_matrix_manual. MAD-X expects a symplectic 6x6 transfer matrix as input. 
Example
An example is found in the PTC_TWISS Examples in the folder "Example4".
Initial Values from Twiss Parameters via BETA0-block:
    PTC_TWISS,
        icase=
integer,
deltap=double, closed_orbit,
        range=string, file[=
string], table[=string],
        beta0=
string;
Description
PTC_TWISS calculates a solution with initial conditions given by Twiss parameters, which are transferred from  the BETA0-block.  The data in the the BETA0-block have to be filled by a combination of the SAVEBETA and TWISS commands of a preceding ring or beam-line. Note, that this case is limited to uncoupled motion of the preceding machine.
Example
An example is found in the PTC_TWISS Examples in the folder "Example1".
Initial Values from the Given Twiss Parameters:
    PTC_TWISS,
        icase=
integer,
deltap=double, closed_orbit,
        range=string, file[=
string], table[=string],
       
betx=double, alfx=double, mux=double,
        bety=
double, alfy=double, muy=double,
        dx=
double, dpx=double, dy=double, dpy=double,
   
    x=double, px=double, y=double, py=double,
        t
=double, pt=double;
Description
PTC_TWISS calculates a solution with initial conditions given by the Twiss parameters, which are explicitly typed  on the command line. Note, that this case is also limited to uncoupled motion of the preceding ring or beam-line.
Example
An example is found in the PTC_TWISS Examples in the folder "Example2".
References for PTC_TWISS
  1. F. Schmidt, "`MAD-X PTC Integration'', Proc. of the 2005 PAC Conference in Knoxville, USA, pp.1272.
  2. G. Ripken and F. Willeke, "Methods of Beam Optics", DESY 88–114, 1988.
  3. K. Zhang, "PTC twiss with initial TWISS parameters", MAD-X Meeting 13 (04.07.2005)slides in ppt.
  4. V.A. Lebedev and S.A. Bogacsz, "Betatron motion with coupling of horizontal and vertical degrees of motion", Thomas Jefferson National Accelerator Facility 2010.
See Also
TWISS, PTC_TWISS Examples.

V. Kapin (ITEP) and F. Schmidt, March 2006