**Technical Note,**

**Updated for version 3.7**

**March 29, 2007**

**TRACK -- a Code for Beam Dynamics Simulation in Accelerators and
Transport Lines with 3D Electric and Magnetic Fields**[^1]

P.N. Ostroumov, V.N. Aseev, B. Mustapha

Argonne National Laboratory, Physics Division

E-mail: ostroumov@phy.anl.gov

## 

## 

**Argonne National Laboratory, Argonne, IL, U.S.A.**

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

SOFTWARE COPYRIGHT NOTIFICATION

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

© COPYRIGHT 2007 UChicago Argonne, LLC

THIS SOFTWARE DISCLOSES MATERIAL PROTECTED UNDER COPYRIGHT LAW AND
FURTHER DISSEMINATION IS PROHIBITED WITHOUT PRIOR WRITTEN CONSENT OF THE
PATENT COUNSEL OF ARGONNE NATIONAL LABORATORY.

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ARGONNE NATIONAL LABORATORY, WITH A FACILITY IN THE STATE OF ILLINOIS,
IS OWNED BY THE UNITED STATES GOVERNMENT, AND OPERATED BY UCHICAGO
ARGONNE, LLC UNDER PROVISION OF A CONTRACT WITH THE DEPARTMENT OF
ENERGY.

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GOVERNMENT LICENSE AND DISCLAIMER

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

NOTICE: This data was produced by UChicago Argonne, LLC under Contract
No. DE-AC02-06CH11357 with the Department of Energy. For 5 years from
March, 2007, the Government is granted for itself and others acting on
its behalf a nonexclusive, paid-up, irrevocable worldwide license in
this data to reproduce, prepare derivative works, and perform publicly
and display publicly, by or on behalf of the Government. There is
provision for the possible extension of the term of this license.
Subsequent to that period or any extension granted, the Government is
granted for itself and others acting on its behalf a nonexclusive,
paid-up, irrevocable worldwide license in this ﻿data to reproduce,
prepare derivative works, distribute copies to the public, perform
publicly and display publicly, and to permit others to do so. The
specific term of the license can be identified by inquiry made to
UChicago Argonne, LLC or DOE.

THIS SOFTWARE IS SUPPLIED \"AS IS\" WITHOUT WARRANTY OF ANY KIND.

Neither the United States GOVERNMENT, nor the United States Department
of Energy, NOR uchicago argonne, LLC, nor any of their employees, makes
any warranty, express or implied, or assumes any legal liability or
responsibility for the accuracy, completeness, or usefulness of any
information, data, apparatus, product, or process disclosed, or
represents that its use would not infringe privately owned rights.

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

LICENSING INQUIRIES MAY BE DIRECTED TO THE OFFICE OF TECHNOLOGY TRANSFER
AT ARGONNE NATIONAL LABORATORY.

# 

**Table Of Content**

[1. Introduction 4](#introduction)

[2. Code verification 5](#code-verification)

[3. Three-dimensional electromagnetic field distribution
5](#three-dimensional-electromagnetic-field-distribution)

[4. Launching the code MWSread 6](#launching-the-code-mwsread)

[4.1 Input Data 6](#input-data)

[4.2 Output Data 9](#output-data)

[5. TRACK Input Files 10](#track-input-files)

[5.1 Track.dat 11](#track.dat)

[5.2 Sclinac.dat 15](#sclinac.dat)

[5.3 Fi_in.dat 15](#fi_in.dat)

[5.4 Solenoid.#01: Data file for 1D solenoid field profile
15](#solenoid.01-data-file-for-1d-solenoid-field-profile)

[5.5 Stripper.#01: Data file for stripper parameters
16](#stripper.01-data-file-for-stripper-parameters)

[5.6 RFQ.#01: Data file for RFQ parameters.
17](#rfq.01-data-file-for-rfq-parameters.)

[5.7 Graph.cfg: Data file for graphics output.
17](#graph.cfg-data-file-for-graphics-output.)

[5.8 Maximum size of arrays in the code.
18](#maximum-size-of-arrays-in-the-code.)

[6. Beam line elements supported by TRACK
19](#beam-line-elements-supported-by-track)

[6.1 RF devices 19](#rf-devices)

[6.2 Magnetostatic devices 21](#magnetostatic-devices)

[6.3 Electrostatic devices 27](#electrostatic-devices)

[6.4 Drift space and other elements of the beamline
29](#drift-space-and-other-elements-of-the-beamline)

[6.5 Misalignments, errors and beam steering correction
33](#misalignments-errors-and-beam-steering-correction)

[7. Launching the code TRACK 38](#launching-the-code-track)

[8. TRACK Output data 38](#track-output-data)

[9. Acknowledgements 42](#acknowledgements)

[10. References 43](#references)

[Appendix 1. Simulation of element misalignments and field errors
44](#appendix-1.-simulation-of-element-misalignments-and-field-errors)

[A1.1 Main Cycle for generation of different accelerator seeds
48](#a1.1-main-cycle-for-generation-of-different-accelerator-seeds)

[Appendix 2. Optimization of the corrector fileds
50](#appendix-2.-optimization-of-the-corrector-fileds)

[Appendix 3. Acceptance calculation
54](#appendix-3.-acceptance-calculation)

[Appendix 4. Potential expansion in a multi-cell RFQ
55](#appendix-4.-potential-expansion-in-a-multi-cell-rfq)

[A4.1 Regular accelerating cells 56](#a4.1-regular-accelerating-cells)

[A4.2 Transition cell 57](#a4.2-transition-cell)

[A4.3 Entrance and exit radial matchers
59](#a4.3-entrance-and-exit-radial-matchers)

[Appendix 5. Particle simulation in dipole magnets
63](#appendix-5.-particle-simulation-in-dipole-magnets)

[A5.1 Structure line for the element "rounded DIPOLE"
67](#a5.1-structure-line-for-the-element-rounded-dipole)

[Appendix 6. Creation of user defined initial distribution.
68](#appendix-6.-creation-of-user-defined-initial-distribution.)

[Appendix 7. A short manual for longitudinal corrections using TRACK
70](#appendix-7.-a-short-manual-for-longitudinal-corrections-using-track)

# 

# **1. Introduction**

The code TRACKv37[^2] for Windows PC simulates beam dynamics of
multi-component ion beams in linear accelerators and has the following
features:

-   multiparticle simulation of multiple component ion beams in 6D phase
    space;

-   3D electromagnetic fields in rf resonators are obtained with the CST
    MWS in rectangular mesh;

-   Fringing fields of magnets and multipoles are approximated using
    Enge coefficients as in the RAYTRACE code;

-   Realistic fields in solenoids;

-   Integration of equations of motion by 4th order Runge-Kutta method;

-   Misalignments and random errors;

-   Two-dimensional (for dc beams) and three-dimensional space charge
    calculation. The test runs indicate that the space charge routine
    works well.

-   Calcualtion of first and second order matrices of all elements.

Elements supported by TRACKv35:

-   Any type of accelerating resonator with realistic 3D fields.

-   Radio Frequency Quadrupole (RFQ) accelerators;

-   Soft&hard edge solenoids;

-   Bending magnets with the fringing fields;

-   Electrostatic and magnetic multipoles (quadrupoles, sextupoles etc.
    ) with fringing fields;

-   Hard edge quadrupoles;

-   Multi-harmonic bunchers;

-   Axial-symmetric electrostatic lenses;

-   Entrance and exit of the HV deck;

-   Transverse beam steering "thin" elements;

-   Stripping foils&films.(Currently the stripping elements are
    implememted for the RIA accelerators only.)

-   Horizontal & vertical slits.

-   Misalignment of bending magnets;

-   Automatic multi-component beam center steering in transverse phase
    space;

-   Automatic multi-component beam energy correction to compensate
    static errors of rf fields.

The following capabilities will be added soon:

-   Built-in optimization of envelope matching in transverse and
    longitudinal phase space in realistic fields of solenoids and rf
    cavities.

-   Combined SC magnet containing solenoid and dipole steering coils
    with realistic field distribution. This option existed in TRACKv21
    but has to be properly incorporated into TRACKv35;

-   Beam neutralization (This may be important in the LEBT);

The simulation includes two main steps:

1)  Preparation of field maps. This step requires extensive use of the
    code Microwave studio (MWS) and Electromagnetic studio (EMS). The
    field maps can be also prepared using other codes.

2)  Prior to the final multi-particle simulation, the elements of the
    transport system and accelerator must be defined by using first and
    higher order optimization codes. TRACK can also be used in some
    cases.

3)  Tracking of large amount of multi-particles.

## 2. Code verification

We have verified TRACKv35 calculations for common types of elements
against other simulation codes such as LANA, DYNAMION and ELEGANT. The
transport element calculations with fringing fields have been verified
using the codes COSY, GIOS and TRANSPORT.

Depending on the complexity of the task, TRACKv35 can compile up to a
total of 10^6^ particles on a regular desktop PC. For 10^4^ particles of
the 200 driver linacs of RIA, it takes about 70 hours using a 1.7GHz
processor speed. (This is more than 1200 elements including \~400 rf
resonators and 16 bending magnets.) The multiprocessor version of the
TRACKv35 simulates 10^6^ particles for \~360 linacs with randomly seeded
errors.

## 3. Three-dimensional electromagnetic field distribution

3D electromagnetic fields of resonators are extracted from CST MWS (or
any other electrodynamics code) as ASCII files **field_e.txt**,
**field_h.txt**. For example, MWS can extract 3D fields in the meshes of
the aperture area as a Microsoft EXCEL **\*.xls** files. The EXCEL file
should be saved as a MS DOS txt file **field_e.txt** or **field_h.txt**.
In TRACKv35, the transport of a charged particle is described by the
equation of motion:

> $d\frac{\overrightarrow{p}}{\text{dt}} = q(\overrightarrow{E} + \overrightarrow{v} \times \overrightarrow{B})$,
>
> \(1\)

where $\overrightarrow{p}$ is the particle momentum and *q* is its
charge,
$\overrightarrow{E} = {\overrightarrow{E}}_{\text{ext}} + {\overrightarrow{E}}_{\text{int}}$
and
$\overrightarrow{B} = {\overrightarrow{B}}_{\text{ext}} + {\overrightarrow{B}}_{\text{int}}$
are the sums of the external and internal electric and magnetic fields,
$\overrightarrow{v}$ is the particle velocity. TRACKv35 integrates the
equations of motion of all the tracked particles for a short distance
and calculates the space charge fields. In TRACKv35, particle motion
through each ion-optical device can generally be described in three
different Cartesian coordinate systems(CCS). Two CCS correspond to the
entrance and exit of each ion-optical element. The third CCS is used for
the definition of the electromagnetic field distribution in the element
as is seen from Fig.A5-1 (Appendix 5). Depending on the geometry and the
type of element, external fields in the code can be defined using any of
the following formats:

1\. Three-dimensional tables of the fields $\overrightarrow{E}$ and
$\overrightarrow{B}$ in the element's CCS which are generated with the
help of external codes. For calculation of the field value at the
particle location, a quadratic interpolation routine is used.

2\. Two-dimensional tables in the (r,z)plane for elements with axial
symmetry such as solenoids or Einzel lenses. These elements can be also
described by 3D fields.

3\. Two dimensional tables of the *B~y~* component of the magnetic field
in the median plane *{x,z}* for rectangular dipole magnets. The
off-median component *B~y~* and components *B~x~* and *B~z~* are
evaluated using the method described in ref. 4 of Appendix 5.

4\. The fringe field falloff for dipole and multipole elements is
described by a six-parameter Enge function \[see ref. 5-6 in Appendix
5\]:

$$F(z) = \frac{1}{1 + \text{exp}(a_{0} + a_{1}(\frac{z}{D})^{1} + \text{.}\text{.}\text{.} + a_{5}(\frac{z}{D})^{5})}$$

where *z* is the distance along the line which is perpendicular to the
effective field boundary, *D* is the full air-gap of the element.

## 4. Launching the code MWSread

The code **MWSread.exe** is a result of significant modifications of the
code **TRANFORM.EXE**. The latter has been written to support earlier
versions of the TRACKv35. Both the codes **TRACKv37.exe** and
**MWSread.exe** must be compiled with equal number of meshpoints NXmax,
NYmax, NZmax. Typical numbers are NXmax= Nymax=25 and NZmax=201. The
latter can be a larger number if necessary. The code MWSread.exe
performs the following:

a\) Reads ASCII files produced by EM codes in the region of
beam-device[^3] interaction. If spatial symmetry conditions are
applicable for the field calculations in the EM and MWS codes, use them.
For the best accuracy of simulations, meshpoints in the beam-device
interaction area of the EM or MWS model should be larger than NXmax,
NYmax, NZmax. However, the code accepts lower number of mesh-points too.

b\) Interpolates the field in order to produce Ex,Ey,Ez,Hx,Hy,Hz fields
on regular mesh to be used by TRACKv35. The output field file is named
as **eh_MWS.#01** for RF devices or **eh_EMS.#01** for static
devices**.** They are unformatted binary FORTRAN files.

c\) Code **MWSread.exe** produces four auxiliary output files:
**output.dat, egarm.dat, bgarm.dat and check_field.dat.**

For each device one should have three (for static electric or magnetic
device) or four (for electromagnetic and static combined field devices)
files in the same directory: **MWSread.exe**, **input.dat** and two
ASCII-files of electric and magnetic fields for RF or static
electromagnetic devices or ASCII-file of electric field for
electrostatic device or ASCII-file of magnetic field for magnetostatic
device. Make a separate directory for each device. This directory
consists of the executable file **MWSread.exe** which should be run
prior to the code **TRACKv35.EXE.**

Launch the code **MWSread.exe**.

## 4.1 Input Data

***Note:*** 1) The file **input.dat** prepared for the code
**transform.exe** (previous version of **MWSread.exe)** is compatible
with **MWSread.exe** only for RF cavities.

2\) In the earlier versions of **TRACK** (earlier than version 34), the
'**TRACK+TRANSFORM' array** for electrostatic devices was generated
assuming artificial zero magnetic field array. An artificial zero
electric field array was generated for magnetostatic devices. The full
geometry of the device without any spatial symmetry had to be defined.
Only under these restrictions, static field files **eh_EMS.#\*\***
created by **transform.exe** are compatible with any version of the
**TRACK** code.

3\) It is recommended to redefine all field files generated by the file
**transform.exe** for static devices.

The file **input.dat** contains a string *namelist/fasa/.* The
*namelist* variables are listed below.

field defines the type of the device field.

Field = 'rf' stands for RF fields (default value)

'eh' stands for static electromagnetic field

'e' stands for static electric field

'h' stands for static magnetic field.

symmetry defines an electromagnetic symmetry of fields.

symmetry = 'rf' for RF cavities(default value)

> 'dipole' for rectangular dipole magnet with symmetry w.r.t. XZ
> coordinate plane

'axial' for devices with axial symmetry w.r.t. Z-axis.

'quad' for devices with quadrupole symmetry w.r.t. Z-axis.

'nosym' means the lack of any spatial symmetry of the fields.

file_MWS_e and file_MWS_h are the file names for input ASCII files of
electric and magnetic fields. It can be any name allowed by **FORTRAN**.
For example: **E.fld, H.fld**, **einzel_from_opera.dat**, **eRF.MWS**,
**efild.txt** etc.

RF electromagnetic fields:

file_MWS_e= file name of the ASCII file for electric field

file_MWS_h= file name of the ASCII file for magnetic field

Electrostatic field:

file_MWS_e= file name of the ASCII file for electric field

file_MWS_h= 'empty' (default, optional)

Magnetostatic field:

file_MWS_e='empty' (default, optional)

file_MWS_h= file name of the ASCII file for magnetic field

d_device -- the length of the device, d, the field extension along the
z-axis**.**

z_device -- (default value is =0) **z**-coordinate of the device field
CCS w.r.t. the CCS of external 3D-field code, see Fig **xxx**.

aperture = device half-width **a** in **x** and **y** directions.

key_1_e defines symmetry w.r.t. YZ coordinate plane w.r.t. both the
device CCS and 3D-field code CCS.

key_2_e defines symmetry w.r.t. XZ coordinate plane w.r.t. both the
device CCS and 3D-field code CCS.

key_3_e defines symmetry w.r.t. XY plane only when origins of the device
CCS and 3D-field code CCS are the same,i.e. z_device=0. For z_device≠0
key_3_e must be equal to 0.

key_1_e, key_2_e, key_3_e =1, there is symmetry.

key_1_e, key_2_e, key_3_e =0, there is no symmetry.

te00 -- defines field level of the RF device or inter-electrode voltage
for the electrostatic devices

freqb\[Hz\]= operating frequency of the given type of RF cavities.

CFE =(-1 or +1), defines the sign of the electric field.

CFH =(-1 or +1), defines the sign of the magnetic field. CFE and CFH are
the amplitudes of the RF electric and magnetic fields respectively,
which extracted from the external 3D-field electromagnetic code output.

The signs of the electric and magnetic field amplitudes are defined from
the time dependence of the RF fields and can be different in different
electromagnetic codes. In **TRACKv35** all RF-fields have the following
time dependence:

![](media/image1.wmf),

where *~0~*--is an initial phase. From Maxwell equation
$\text{rot \{}\overrightarrow{H} = \varepsilon_{0}\partial\frac{\overrightarrow{E}}{\partial}t$
one can find:

$\oint_{}^{}{\overrightarrow{H}d\overrightarrow{l}} = \text{sin}\varphi\oint_{}^{}{\overrightarrow{h}d\overrightarrow{l}} = \varepsilon_{0}∯_{}^{}{d\overrightarrow{s}\partial\frac{\overrightarrow{E}}{\partial}t = - \varepsilon_{0}\omega\text{sin}\phi ∯_{}^{}{\overrightarrow{e}d\overrightarrow{s}}}$
.

For the circle with the radius r0.5R~aperture~ (perpendicular to the
cavity z-axes), one can find *eds=e~z~(r,,z)rdrd e~z~(0,0,z)rdrd* and
*hdl=hrd* therefore

$\begin{array}{r}
r\int_{0}^{2\pi}h_{\vartheta}(r,\theta,z)d\theta\  \simeq \  - \varepsilon_{0}(2\frac{\pi}{f}){\pi r}^{2}e_{z}(0,0,z) \\
I_{H}(z) = - \frac{\text{freqb}}{2\pi^{2}\varepsilon_{0}r}\int_{0}^{2\pi}h_{\vartheta}(r,\theta,z)d\theta\  \simeq \ e_{z}(0,0,z) = I_{E}(z)
\end{array}$

The electric field amplitude will be multiplied by CFE\*te00 in the
**MWSread.exe** code. Similarly, magnetic field is multiplied by
CFH\*te00. Both functions I~H~(z) and I~E~(z) are evaluated for RF
cavities and z, I~H~(z) and I~E~(z) are extracted in the file
**check_field.dat**. The code **MWSread.exe** compares functions I~H~(z)
and I~E~(z) and will ask to define necessary sign of electric or
magnetic field using the parameters CFE and CFH if initial CFE and CFH
are wrong. It can be necessary to change the sign either CFE or CFH.

Example of output information on the PC screen and in the **output.dat**
file:

CFE=1, CFH=-1

Warning: CFE and CFH are inappropriate.

Please insert new CFE and CFH and press enter

-1 -1 or

1 1 are possible answers.

It is very useful to plot and compare functions I~H~(z) and I~E~(z).

Note: for the RF cavity with negligible magnetic field copy
**e_field.dat** to **h_field.dat** and use CFE=1,CFH=0. Ignore the
warning about CFE and CFH and insert 1 and 0 for CFE, CFH one more time.

Running **MWSread.exe** with different set of parameters d_device and
z_device one can divide 3D-field table into several zones. This feature
is useful for representation of the fringing fields. Another reason
could be to insert long devices as separate zones.

Ncells ≥1 (optional for **MWSread.exe**)→ virtual number of "cells",
have been used in **transform.exe.**

Abeta (optional) → virtual beta, has been used in **transform.exe.**

Three parameters **freqb, Ncells** and **abeta** have been used in the
old code for calculation purpose only.

d_device =0.5\* abeta \*c_light\* ncells/freqb.

In **MWSread.exe** parameters **Ncells** and **abeta** are also
available but parameter **d_device** is more convenient for defining the
extension of the field distribution along the z-axis.

Variables NCAV, atp, ztp, targ, drft, tt0 are optional and included in
**Input.dat** file only for compatibility with previous version
**transform.exe**.

r_fourier (=0.5 by default) the relative radius for Fourier analysis of
the fields at r=r_fourier\*aperture

Parameters iread (=0, default value), iprint (=0, default value),Vf and
Bf are used to analyze the properties of the field distribution obtained
by the external 3D-codes for the devices defined in **sclinac.dat**.

iread =0 the files eh_MWS.#01 or eh_EMS.#01 are created.

iread =n old files eh_MWS.#n or eh_EMS.#n are read and analyzed.

Vf amplitude of the electric field.

Bf amplitude of the magnetic field.

iprint=1 ASCII files with electric and magnetic fields on

the uniform-mesh spatial grid of the TRACk code are extracted.

##  4.2 Output Data

The code **MWSread.exe** produces binary **eh_MWS.#01** file for the RF
devices or **eh_EMS.#01** file for the static devices. The following
line must be inserted into the **sclinac.dat** file to represent a
device with realistic 3D field distributions:

**n elem ... d_elem ... te00 \... rap ... for RF devices**

**n elem ... d_elem ... Bf \... rap ... for magnetostatic devices**

**n elem ... d_elem ... Vf \... rap ... for electrostatic devices**

**n elem ... d_elem ... Bf,Vf \... rap ... for static devices**

where

n -is the number of file containing the field tables (consistent with
the extension of the file **eh_MWS.#xx).**

elem --is the name of the element( cav,eq3d, enzl ...)

d_elem length of the device

te00,Bf,Vf amplitudes of the field.

The binary file **eh_MWS.#01** produced by the code **MWSread.exe**
eh_MWS.#01 must be renamed to

**eh_MWS.#0n** if 0\<n\<9

**eh_MWS.#n** if 10\<n\<99

Examples: 5 cav .. **eh_MWS.#01** -\> **eh_MWS.#05**

13 cav .. **eh_MWS.#01** -\> **eh_MWS.#13**

96 eq3d .. **eh_EMS.#01** -\> **eh_EMS.#96**

1 eq3d .. **eh_EMS.#01** -\> **eh_EMS.#01**

The code **MWSread.exe** produces **check_field.dat** for the set of
mesh-points z~i~\_{0z~i~d_device}

if symmetry='rf' , then z~i,~ I~H~(z~i~), I~E~(z~i~);

if symmetry ='axial' , then z~i,~ V(z~i~) ,where V is the normalized
voltage along Z- axis for axially symmetric electrostatic fields;

if symmetry ='axial' , then z~i,~ B~z~(z~i~), B~hard~(z~i~), where
B~z~(z~i~) is the normalized

> z-component of the magnetic field B~z~(z~i~), for axially symmetric
> magnetostatic fields.

Typical set of parameters in **input.dat** for RF cavity:

& freqb = 100d6,

cfe=1,cfh=-1,te00=0.9,

d_device=50. ,aperture=1. ,

file_MWS_e='e.txt' , file_MWS_h='h.txt' ,

key_1_e=1, key_2_e=1, key_3_e=0

& end

Typical set of parameters for solenoid:

& symmetry='axial'

d_device=50. ,aperture=1.

file_MWS_h='solenoid.txt'

key_1_e=1, key_2_e=1, key_3_e=1

& end

Typical set of parameters for electrostatic quad:

& symmetry='quad'

te00=1

d_device=20. ,aperture=3.

file_MWS_e='equad.txt' ,

key_1_e=0, key_2_e=0, key_3_e=0

& end

Typical set of parameters for Einzel lens:

& symmetry='axial'

te00=1

d_device=10. ,aperture=0.5

file_MWS_e='e.txt'

key_1_e=0, key_2_e=0, key_3_e=1

& end

## 5. TRACK Input Files

The simulation is performed in right-handed Cartesian coordinate system.

To run this code the following files must be copied to a designated
directory[^4]:

**TRACKv37.exe** = simulation code

**fi_in.dat** = has the input "synchronous" phases of all SRF cavities

**Track.dat** = contains general input parameters of the beam and linac

**sclinac.dat** = file containing geometry of the Linac (focusing,
accelerating structure and other elements)

**graph.cfg** = input file to support on-line Windows graphs.

**cavity.#01** = for the first type of cavity (not needed if
iflag_cav=1), in recent simulations using TRACKv35.exe we do not use
this file.

**eh_MWS.#01** = for the first type of cavity. If **sclinac.dat**
contains more types of cavities all files with appropriate extensions
should exist.

**solenoid.#01** = if isol=1 (file of realistic field distribution in
the solenoid)

**deck.#01** = transition to/from HV deck, axial symmetric lens.

**RFQ.#01** = RFQ data.

**MHBrz.#01** = field distribution in rf buncher (2-gap resonator, can
operate at 2 frequencies simultaneously)

**stripper.#01** = stripper data.

The number in the file extension corresponds to the successive number of
similar elements along the linac.

## 5.1 Track.dat

The input data is defined using the FORTARN statement 'namelist'.

namelist /TRAN/ Win,atp,freqb,sfas,serf,npat

& ,nqtot,part,qq,epsnx,alphx,betx,epsny,alphy,bety,DEESRF

& ,epsnz,alphz,betz,aper,x00,xp00,y00,yp00,ph00,dww00,phi0

& ,disp,dcav,phmax,dwwmax,db_b,Qavr,df_4D,Qdesign, Adesign

& ,current,amass,dWWacc

& ,n_tp,n_tt,ncells,np_set

The input file consists of the following data (this is an example of
simulation of the whole RIA driver linac from 0.19 MeV/u to 400 MeV/u):

&TRAN

table_dir=\' c:\\BASELINE_2005\\FIELDS\\ \'

work_dir = \' \'

Win =0.19d06, atp =238.D0,

nqtot=2, qq=28.,29., npat=500000,500000

Qavr=28.5, Adesign=238, Qdesign=28.5

Amass=238,238

Current=0,0

freqb =57.5D06, part = 0.95

epsnz =25.D0, alphz = 0.6D0, betz =4,

epsnx = 0.06, alphx =1., betx =60.,

epsny = 0.06, alphy =1., bety=60.,

phmax=90., dwwmax=20., dwwacc=0.1

x00=0.,0., xp00=0.,0., y00=0.,0., yp00=0.,0., ph00=-0.,0., dww00=0.

&end

Line

table_dir=\' c:\\BASELINE_2005\\FIELDS\\ \'

is given as an example. This line shows the directory where all files
are located with the tables of device fields. All files with the
extension **.#xx** are located in this directory. There is no need to
copy these files into the directory where the input files with the
extension **.dat** and **TRACKv35.exe** are located.

This line

work_dir = \' \'

will serve similar function as table_dir for the output files. Will be
modified in future.

WIN \[eV/u\]= input beam energy.

atp = mass number.

nqtot= number of different ion species.

qq(1:nqtot)\[Q/e\]- charge state of each species.

npat(1:nqtot) - number of macro-particles with given q/A. If beam
current is not equal to zero, final adjustment of the number of
particles takes place in the code: each multi-particle will carry the
same charge for the space charge calculation routines.

np_set - number of particles in each charge state for the accelerator
reference setting. This setting is required if the flag iflag_corr=1 and
the steering correction is activated. The steering correction of the
beam centroid in transverse phase space is required to avoid emittance
growth of multi-q beams and minimize the coherent oscillations in the
transverse phase space. To search for optimum fields in the correctors
several complete runs of the linac must be done. To run for this
optimization procedure the setting of the linac must be defined.

Qavr - average charge state, it is used for 2-charge state injecton
Qavr\~0.5\*(qq(1)+qq(2)). This parameter is effective upstream of the
RFQ, in the LEBT.

Adesign -- mass number of the design particle for the accelerator or
transport system.

Qdesign -- charge state of the design particle for the accelerator or
transport system.

Amass(1:nqtot)- ion mass number, useful for simulation of various masses
exiting the ion source.

Freqb( Hz),- fundamental frequency of the incoming beam. All rf
resonators frequencies are set with respect to freqb using a harmonic
number. This number can be an integer or a non-integer. For dc beams one
can use the frequency of the first rf device located downstream of the
ion source.

current(1:nqtot)-\[mA\] electrical current of each heavy ion beam
component.

part \<=1 for calculation of emittances of beam, containing \>\'part\'
particles with respect to the total number of survived particles.

df_4D -- phase width (+/-) of the initial 4-dimensional distribution (dc
beam) if the flag iflag2D=1 is used.

epsnx,alphx,betx¦ \[cm\*mrad\] , \[unitless\] \[cm/rad\]→ initial
transverse

epsny,alphy,bety¦ parameters of beam, emittance is total and normalized.

epsnz,alphz,betz \[deg\*%\] ,\[unitless\] , \[deg/%\]→ initial
longitudinal parameters of beam, degrees at frequency freqb. epsnx,
epsny are the full normalized emittances in pi\*cm\*mrad. epsnz is the
longitudinal emittance in dW/W(%) and phase (degree of freqb) of current
frequency freqb (this emittance is not invariant). Currently in TRACKv35
we generate 4D or 6D water bag distributions. In this case
![](media/image2.wmf) for the 4D Waterbag and ![](media/image3.wmf) for
the 6D Waterbag.

phmax - is calculated using subroutine PHASSET

dwwmax - \[%\],amplitude of energy spread of the initial distribution
for the acceptance calculation.

Dwwacc -- \[%\], W/W for the acceptance calculations, if particle energy
is lower than dwwacc then this particle will be treated as an
unaccelerated particle.

x00 (1:nqtot)\[cm\] - initial displacement of center of the beam

xp00 (1:nqtot)\[mrad\] - at entrance of accelerator for each

y00 (1:nqtot)\[cm\] - charge state

yp00 (1:nqtot)\[mrad\]- \*\-\-\--\*

ph00 (1:nqtot)\[deg\]- \*\-\-\--\*

Dww00(1:nqtot)\[%\]- \*\-\-\--\*

db_b - delta_beta/beta for dc beam exiting ion source.

DEESRF -- the relative range (like 0.2, for example, which corresponds
to 20% field deviation from the design field) of SC cavity field with
respect to the average design value. This feature can be activated to
study beam evolution along the linac with different level of fields in
the SC resonators. The field level in the resonators is generated using
uniform random distribution within DEESRF.

The track.dat file has a section with integer values and flags:

namelist /INDEX/ isol,lstep,iaccep,iaxial,NRZ,igraph,isrf

&,iflag_lev,IINT,iflag_env,iflag_cav,iflag_ell,nstep_cav

&,iflag_bc,iflag_dis,iflag_qq,iflag2D,iflag_fenv

&,iflag_mhb,iflag_upd,iflag_rms,iflag_tac,iflag_halo,iflag_corr

&,iwrite_dis,iread_dis,iRIARFQ,nrz_min

This is the example of the integer parameter list in the **track.dat**
file:

&INDEX

NRZ=1, igraph=1, iaccep=0, isol=1, iflag_dis=0,iflag2D=0,iflag_qq=1,

iflag_rms=1, iint=100, nstep_cav=50

iflag_env=1, iflag_cav=1, iflag_ell=0, iflag_fenv=0

iflag_upd=0, iflag_halo=0, iflag_lev=1, isrf=100

iwrite_dis=1, iRIARFQ=0,iflag_corr=0

&END

The parameters given below are shown with default values.

NRZ=1 - number of seeds for error and misalignment simulations, for
single simulations NRZ=1. If NRZ not equal 1 use igraph=0 just to save
CPU time. The graphs are not completely supported for NRZ1.

igraph=1 -- show graphs on PC screen, =0 no graphic output

iaccep=0 -- if 1 the longitudinal acceptance is calculated. See details
in Appendix 3.

isol=0 - 1-realistic fields, 0-rectangular model. If isol=1 the code
TRACKv35.exe will search for ASCII data file solenoid.#01 with the
distribution of axial symmetric magnetic field along z. If solenoid is
defined with 3d-field distribution and element 'sol3d' then the
parameter isol is ignored.

ISRF=0 - the seed of the random number generator ISRF must be in the
range (0, 2147483646). If ISRF is zero, a value is computed using the
system clock; and, hence, the result of the program using the IMSL
random number generators will be different at different times.

IINT=50 - number of steps for Runge-Kutta integrator which is applied
for drift spaces and solenoids.

iflag2D=1 starts with DC beam and calculates only 2D electric fields due
to

space charge, in z direction space charge field is equal to 0.

iflag_qq=1 will show phase space plots for indicated ion species or
charge state of given ion species.

iflag_env=1 number of graphical outputs along one element (if 1 it is
not supported in all elements)

iflag_fenv=1 extracts rms phase \[deg\] on the PC screen(shown in green
color). Check vertical scale to see the curve.

iflag_cav=1 RK integration in the accelerating cavities, 0 -- use
iterative method (as in the LANA code). **Do not use 0 -- it is
obsolete.**

iflag_ell=1 Draw ellipses on the PC screen,if =0 do not draw ellipses.

nstep_cav=50 number of steps for RK integrator in the rf cavity.

iflag_dis=1 6D waterbag distribution,if =0 is a 4D waterbag distribution

iflag_upd=0 - this is an internal flag, not to be used.

iflag_rms=1 Show rms envelopes on the PC screen, =0 do not show rms
envelopes

iflag_tac=0, Do not calculate transverse acceptance, if =1 calculate
transverse acceptance. See details in Appendix 3.

iflag_halo=0 if =1, generates and simulates halo particles after the
stripper #2. This feature is not ready to be used.

iflag_mhb=0 MHB is calculated on the base of 3d table

iflag_bc=0 phase setting is not adjusted for average bunch center before
the each cavity. It is important that for the acceptance calculations
iflag_bc must be 0.

iflag_lev=0 → do not calculate N/N0(relative beam intensity) as a
function of emittance(f(є)). If this parameter =1, then N/N0 as f(є) is
reduced to the rms emittance for xx',yy' and the{ - ∆W/W}-planes will be
extracted in the file **level.dat.** Use this flag with element 'prmtr'
to extract 'emittance distribution' in given location along the
structure.

iwrite_dis=1 - writes unformatted data file **read_dis.dat** of the
particle distribution at the end of simulation (at the end of last
element in **sclinac.dat** file) for future use as an initial
distribution.

iread_dis=1 - reads file **read_dis.dat** of the particle distribution
and starts simulation with this distribution ignoring generation of the
initial distribution. Use this flag to read custom formed initial
distribution (see Appendix 6).

iflag_corr=1 - Calls beam centroid steering subroutine to find corrector
strength (see Appendix 7). iflag_corr =-1 is required to start
simulations for many seeds. In addition see Appendix 1 to set up the
simulations of errors and misalignments.

IRIARFQ=0 - simulates single or multiple charge state beam within 360 of
the RFQ frequency (inside one bucket). This option is not valid for
simulation of two charge-state beam with space charge as for RIA RFQ. If
IRIARFQ=1, then simulation takes place within 720 and 2 neighboring
buckets can be populated with different charge states (or the same
charge state). Use IRIARFQ=1, to simulate RIA driver linac RFQ in
two-charge state mode with MHB and velocity equalizer.

The following values are set by default in the **TRACKv35** code:

isol=0

iaccep=0

i_step=0 index for the array of central trajectory in the bending
magnet,

it is used for the space charge calculations

isrf=0

part=0.

db_b=0.

Qdesign=28.5

Adesign=238.

nstep=100 This parameter depends on space charge calculations

and it is better to define the integration step for each device in the
structure file **sclinac.dat.**

nstep_cav=50 !Number of integration steps in resonators.

## 5.2 Sclinac.dat 

The file **sclinac.dat** defines the following elements of the
accelerating-focusing channel or transport line. Each element in the
TRACK code has own ID:

c i_device=0 ! no device assigned

c i_device=1 !\*DRIFT \*!

c i_device=2 !\*SOLENOID\*,\*HARD-EDGE SOLENOID\*!!

c i_device=3 !\*Bending Magnet\*!

c i_device=4 !\*QUAD \*\*HARD-EDGE QUAD\*!

c i_device=5 !\*BUNCHER\*!

c i_device=6 !\*CAVITY \*!

c i_device=7 !\*CORR\*!

c i_device=8 !\*MULTIPOLE\*!

c i_device=9 !\*RFQ\*!

c i_device=10 !\*MHB\*!

c i_device=11 !\*HV DECK\*!

c i_device=12 !\*SLIT\*!

c i_device=13 !\*FHIDE\*!

c i_device=14 !\*MONITOR\*!

c i_device=15 !\*EQUAD3D\*! electrostatic quadrupole with 3D mesh from
EM Studio

c i_device=16 !\*EINZEL\*! electrostatic lens with 3D mesh from EM
Studio

c i_device=17 !\*EQUAD\*! electrostatic quadrupole

c i_device=18 !\*SOL3D \*! solenoid with 3D mesh from EM Studio

c i_device=19 !\*cdump\*! This marker defines correction section
boundaries

c i_device=21 !\*extrc\*! A device with 3D electrostaic field

c i_device=22 !\*UDS\*! User Defined structure (multi-gap resonator like
DTL )

c i_device=23 !\*shrt\*!

c i_device=24 !\*strip\*! STRIPPER

c i_device=25 !\*EH3D\*! static field (combined electric and magnetic
field)

## 5.3 Fi_in.dat 

The file **fi_in.dat** for the **TRACKv35.exe** must be generated
manually and it contains the phase angle with respect to the maximum
energy gain in a given resonator.It should be negative for stable
longitudinal motion. For the bunch rotator the phase is --90 deg (or
close to this number,and can be adjusted using simulated results, for
example, to keep average beam energy unchanged). For a chain of similar
accelerating resonators the phase angle is practically equal to the
synchronous phase. As soon as one runs **TRACKv35.exe,** the code
produces file **linac.dat** which combines **sclinac.dat** and
**fi_in.dat** files. Using the data in file **linac.dat,** one can check
the final phases assigned to each resonator.

## 

## 5.4 Solenoid.#01: Data file for 1D solenoid field profile

This file has been used together with element **sol** and the flag
**isol=1** before the development of the element **sol3d.** The number
in the file extension corresponds to the successive number of solenoids
along the linac. If in **track.dat** the parameter isol=1, then
**TRACKv35.exe** will search for ASCII data file **solenoid.#01** with
the distribution of axial symmetric magnetic field along z. Below is the
typical field distribution of a solenoid with bucking coils. The first
line is the number of mesh-points. The total length of the solenoid L~S~
is given in **sclinac.dat** file. The distribution is applied to this
length L~S.~ This distribution should be smooth enough in order to avoid
irregularities in higher order derivatives otherwise it can result in
non-physical field distribution and emittance growth. The solenoid field
map is calculated using 4^th^ order derivatives.

37

-0.014143283

-0.025661771

-0.040576367

-0.054855518

-0.056903368

-0.027229919

0.053280013

0.191001852

0.369154663

0.547779134

0.692967978

0.798030467

0.870633884

0.920061736

0.953459121

0.975653094

0.98971838

0.99750644

1.000000009

0.99750644

0.98971838

0.975653094

0.953459121

0.920061736

0.870633884

0.798030467

0.692967978

0.547779134

0.369154663

0.191001852

0.053280013

-0.027229919

-0.056903368

-0.054855518

-0.040576367

-0.025661771

-0.014143283

## 5.5 Stripper.#01: Data file for stripper parameters 

In addition to the stripper description in the **sclinac.dat** file
there is a file **stripper.#01** (the number in the file extension
corresponds to the successive number of similar elements along the
linac). Below is the typical stripper file. First line: number of charge
states after the stripper. Second line charge states, the first charge
state will be used as a reference charge state for the phase setting in
the resonators. The third line: percentage of particles at corresponding
charge states. The total percentage is 100.

The fourth line is equal to the second line (this line will be used in
future).

The last line is the kinetic energy per nucleon after the stripper
\[keV/u\].

5

72\. 70. 71. 73. 74.

0.3 0.15 0.2 0.2 0.15

72\. 70. 71. 73. 74.

10000\.

## 5.6 RFQ.#01: Data file for RFQ parameters.

This is an ASCII file with the RFQ parameters on the base of a 2-term
potential expansion. These parameters must be produced by RFQ
optimization codes such as DESRFQ or some other code. It is important
that the accelerating and focusing parameters are determined with the
actual shape of vane modulations. The total number of RFQ accelerating
cells nRFQ is given in the element "RFQ". The format for reading is:

***read
(1,\*)(bRFQ(i),tRFQ(i),xRFQ(i),aRFQ(i),dRFQ(i),indRFQ(i),i=1,nRFQ)***

There are 6 columns, the definitions corresponding to those in the
original Kapchinsky-Teplyakov paper.

1: beta at the exit of the cell, this column is used just for reference,
does not effect on beam parameters.

2: Parameter teta as is defined by Kapchinsky and teta=\*A/4, where A is
the accelerating efficiency defined by the LANL group.

3: Kappa;

4: Aperture radius \[cm\];

5: length of the accelerating cell \[cm\];

6: index, equal to 0 if the cell is of regular length /2 otherwise =1.

## 5.7 Graph.cfg: Data file for graphics output. 

The lines in this file are self-explanatory. In case of any doubts, just
run **TRACKv35.exe** to identify the parameters of the graphics. Do not
change the integer arrays. The graphics are not perfect: if particles
are outside the graph boundary, they will be shown with "wrong"
coordinates. In case of the RFQ, the particles are "filtered" by energy
before sending for graphics.

&WINS

title = \' Superconducting Linac \'

ix(1) = 114, iy(1) = 32, jx(1) = 322, jy(1) = 240, lx(1) = 4, ly(1) = 8,

xmin(1)= -1. , xmax(1)= 1. , ymin(1)= -0.01, ymax(1)= 0.01,

ix(2) = 394, iy(2) = 32, jx(2) = 602, jy(2) = 240, lx(2) = 4, ly(2) = 8,

xmin(2)= -1. , xmax(2)= 1. , ymin(2)= -0.01, ymax(2)= 0.01,

ix(3) = 674, iy(3) = 32, jx(3) = 882, jy(3) = 240, lx(3) = 4, ly(3) = 8,

xmin(3)= -30., xmax(3)=30., ymin(3)= -0.01, ymax(3)= 0.01,

ix(4) = 75, jx(4) = 950, iy(4) = 399, jy(4) = 599, lx(4) = 1, ly(4) = 5,

xmin(4) = 0., xmax(4) = 30000., ymin(4) = 0., ymax(4) =1.5

&end

## 5.8 Maximum size of arrays in the code. 

Maximum possible numbers for the arrays in the TRACKv35 are given in
FORTRAN

Data file in the code. Depending on the code application and hardware
parameters, the code can be compiled for different mesh size, number of
macroparticles and number of ion species.

& NXmax=25 , NYmax=25 , NZmax=201 ! grid for dist. of field in rect reg.

&, KSTEPR= 8,JSTEPA= 16 ,LSTEPZ= 48 !max number of grids for field
distribution of axial-symmetric electromagnetic field of resonators.

&, PI= 3.141592653589793d0 ! \[rad\]

&, PIOVHR= PI/180d0 ! \[rad/ø\]

&, HROVPI= 180d0/PI ! \[rad/ø\]

&, CC= 2.99792458d10 ! \[cm/sec\]

&, C_light= 2.99792458d8 ! \[m/sec\]

&, EPS0= 1/(4.d0\*PI\*1.d-9\*CC\*\*2) ! \[F/cm\]

&, EE= 4.803242d-10 ! \[CGSe\]

&, EV= 1.60217733d-12 ! \[erg/eV\]

&, AMU= 931.49432d6 ! amu \[eV\]

&, W0= 1.0073\*amu ! proton rest mass \[eV\]

&, emass= 510.079 ! electron rest mass \[KeV\]

&, ch_to_m=3.2184034535d-3 ! \[C\*sec/kg\] = \[1/T\]

&, mu0=4d0\*pi\*1d-7 ! \[T/(A/m)\]

&, twopi=2d0\*pi ! \[rad\]

&, tovpi=2d0/pi ! \[rad\]

&, degrad=pi/180d0 ! \[rad/deg\]

&, ngridx=32, ngridy=32, ngridz=64, nm3=16, nm5=33 !For Space Charge
field mesh.

&, MNtot = 100000 ! maximum number of particles of each type.

&, Melem = 2000 ! maximum number of elements (drifts, magnets\...)

&, MQtot = 20 ! total number of charges (masses)

&, CRO=4d0\*pi\*\*2/3.13d10) ! \[1/milliamper\], for space charge
calculation

& NXmax=25 , NYmax=25 , NZmax=201 ! grid for dist. of field in rect reg.

! Attention: For simulation of long DTLs use NZmax=801 for compiling
files

! This requires appropriate generation of field files by
**transform.exe**

&, maxNseed=200 ! max number of seeds

&, maxNCorr = 150, maxNMon = 100 ! max number of correctors and monitors

&, maxNSection = 30 ! max number of correction sections.

&, Nbuf=200000 ! max number of buffer size for graphics, can be
suspended for non-graph option

&, PI= 3.141592653589793d0 ! \[rad\]

&, PIOVHR= PI/180d0 ! \[rad/deg\]

&, HROVPI= 180d0/PI ! \[rad/deg\]

&, CC= 2.99792458d10 ! \[cm/sec\]

&, C_light= 2.99792458d8 ! \[m/sec\]

&, EPS0= 1/(4.d0\*PI\*1.d-9\*CC\*\*2) ! \[F/cm\]

&, EE= 4.803242d-10 ! \[CGSe\]

&, EV= 1.60217733d-12 ! \[erg/eV\]

&, AMU= 931.49432d6 ! amu \[eV\]

&, W0= 1.0073\*amu ! proton rest mass \[eV\]

&, emass= 510.079 ! electron rest mass \[KeV\]

&, ch_to_m=3.2184034535d-3 ! \[C\*sec/kg\*(m/cm)\] = \[1/(T\*cm)\]

&, mu0=4d0\*pi\*1d-7 ! \[T/(A/m)\]

&, twopi=2d0\*pi ! \[rad\]

&, tovpi=2d0/pi ! \[rad\]

&, degrad=pi/180d0 ! \[rad/deg\]

&, ngridx=32, ngridy=32, ngridz=64 !For space charge field grid

&, nm3=16, nm5=33 !nm=max(nx,ny,nz/2) nm3=nm/2,nm5=nm+1,For SC grid

&, MNtot = 250000 ! maximum number of particles

&, Melem = 2000 ! maximum number of elements (drifts, magnets\...)

&, m_cell=15 ! total number of cells in the cavity

&, maxn_tp=99 ! number of different cavity types

&, MQtot = 5 ! total number of charges (masses)

&, nm_halo = 10000 ) ! max number of halo particle generator,

Attention: For simulation of long DTLs with large number of accelerating
cells (more than 10) use NZmax=801 for compiling **TRACKv35.exe**. This
requires appropriate generation of field files by **MWSread.exe.** The
same mesh number along the z-axis must be used in the code
**MWSread.exe** during the compiling. Depending on PC memory the code
**TRACKv35.exe** can be compiled with required dimensions of the arrays.

## 6. Beam line elements supported by TRACK

## 6.1 RF devices

#### \*Accelerating Cavity\* 

### n cav d_elem harm TE00 any nstep(optional)

n type of cavity: each type of cavity must have field files with

> the name **eh_EMS.#\*\***.

d_elem \[cm\] total length of cavity

harm harmonic number of cavity with respect to the fundamental

beam frequency freqb defined in the **TRACK.dat** file

TE00 field level of cavity. This parameter is equivalent to the

> parameter TE00 in the **input.dat** file for **MWSread.exe**. If used
> in the **sclinac.dat** file it can define the field level in a
> particular resonator.

any no longer in use in TRACKv35. In previous versions it meant shift of
the cavity in vertical direction. Use shift device for this purpose.

nstep (optional)number of steps for integration of the cavity. If it is
voided, then nstep = nstep_cav given from TRACK.dat.

Misalignment errors of cavity displacement in transverse directions and
static and dynamic errors of the RF phase and amplitude are defined by
the device 'align'.

##### Example:

5 cav 43.79542 3. 1.0 0.0 here nstep=nstep_cav

5 cav 43.79542 3. 1.0 0.0 500 here nstep=500

#### \*Multi-Cell RFQ\*

### ncells rfq Vf d_elem R0RFQ RFQ_ph0 harm nstep n ncoef

ncells number of λ/2-length cells in the RFQ

Vf \[kV\] Inter-vane Voltage

d_elem \[cm\] total length of the RFQ

R0RFQ \[cm\] average radius

RFQ_ph0 \[deg\] Phase of the RFQ field with respect to the incoming
pre-bunched beam.

harm harmonic number of the RFQ cavity with respect to the

freqb defined in the **track.dat** file.

nstep number of steps for integration per cell (d~cell~ =0.5λ), were

λ=c/(harm\*freqb)is current RF wave length and c -- is velocity

of the reference particle

n (=1 by default,optional) number of the extension of the file

with name **rfq.#n**

ncoef (ncoef=2 by default, optional)number of field coefficient in
Fourier-Bessel expansion of the filed in RFQ cell.

Examples:

1\) Two coefficients field distribution. Input file is **rfq.#1**

138 rfq 68.47 394.3084938 0.6 90. 2. 50

1\) Eight coefficients field distribution. Input file is **rfq.#5**

138 rfq 68.47 394.3084938 0.6 90. 2. 50 5 8

1\) Five coefficients field distribution. Input file is **rfq.#1**

138 rfq 68.47 394.3084938 0.6 90. 2. 50 1 5

More details of the potential expansion in the RFQ are given in Appendix
4.

##### Modifications, October 4, 2005

RFQ can consist of entrance and exit regions as 3D tables obtained from
EM studio. In order to have possibility to optimize vane shapes in the
end regions iterative procedure of EM calculations and TRACK simulation
may be necessary. To do this there is an option to write a scratch file
inside the RFQ. An example follows.

1 prmtr iflag_t=1

-68 scrch 260

263 rfq 90.4 303.442 .34 -90. 1.0 100 3

This line makes scratch file scrch.#68 after cell #260. The RFQ input
file is rfq.#03.

Reading of the scratch file.

1 prmtr iflag_t=1

68 scrch 260

263 rfq 90.4 303.442 .34 -90. 1.0 100 3

#### \*two-Harmonic Buncher\*

### n mhb Ef1 Ef2 d_elem rap MHB_ph0 any any MHBh1 MHBh2 nstep

n number of the extension of the file with name **eh_EMS.#\*\*** 3D
table

field MHB or file with name **eh_2d.#\*\*** for 2D table field MHB

Ef1 \[V\] amplitude of the voltage of the first harmonic

Ef2 \[V\] amplitude of the voltage of the second harmonic

d_elem \[cm\] total length of the MHB

rap \[cm\] aperture radius

MHB_ph0\[deg\] initial phase set of the MHB

any not in use

any not in use

MHBh1 first harmonic number of MHB with respect to the fundamental

beam frequency freqb given in the **TRACK.dat** file

MHBh2 second harmonic number of MHB with respect to the fundamental

beam frequency freqb given in the **TRACK.dat** file

nstep (optional)number of steps for integration for the MHB.

If this parameter is voided, nstep = iint which is defined in the
**TRACK.dat.**

**Example:**

1 mhb 2500. 0. 4.65728 2.0 14.5 257 16

**Comment.** The MHB can be defined as a sequence of resonators (element
'cav'). However, the element 'MHB' allows one to apply 2 harmonics of rf
field with different amplitudes simultaneously.

**Note:**

This element is considered as an rf cavity with only electric field.

####  

#### \*4-Harmonic IDEAL Buncher\*

### Element name: 'fhide'

c ntype = el.n ! Type of the MHB to read the field distribution

c EMHB1 = el.p1 ! Amplitude of the ideal \"Saw tooth\" voltage

c FFAS = el.p2 ! Phase of the ideal \"Saw tooth\" voltage (degree)

##### Example:

1 fhide -0.015 40.

#### \*BUNCHER\* 

This device is equivalent to the device \*CAVITY\* with fi_in=-90.

### n bunch d_elem harm TE00 nstep

n type of cavity: each type of cavity must have field files with

> the name **eh_EMS.#\*\***.

d_elem \[cm\] total length of cavity

harm harmonic number of cavity with respect to the fundamental

beam frequency freqb given in the **TRACK.dat** file

TE00 field level of the cavity.

nstep number of the integration step for the device

##### Example:

2 bunch 43.79542 3. 1.0 100

field distribution is defined in **eh_EMS.#02**

## 6.2 Magnetostatic devices

####  \*HARD-EDGE or 1D TABLE FIELD SOLENOID\*

This element can be used to define either a hard-edge solenoid (isol=0)
or a 1D table field solenoid (isol=1). 1D table format is described in
chapter 5.4.

We recommend using the element sol3D as a "soft edge" solenoid.

### n sol Bf\* d_elem heff\*\* rap rap\*\*\* nstep

n n=0 isol=0,1 hard-edge solenoid

n\>0 isol=0 hard-edge solenoid

n\>0 isol=1 n extension number of the file **solenoid.#n**

Bf \[G\] field level in the solenoid

d_elem \[cm\] total length of solenoid

heff \[cm\] effective length of solenoid, d_elemheff.

rap \[cm\] aperture radius

rap\*\*\* \[cm\] placeholder

nstep\*\*\*\* (optional) number of integration steps for the 1D table

field solenoid. If it is voided, nstep = iint given from

**TRACK.dat**.

**Note:**

\* Use normalization B~z~(0,0,d_elem/2)=1 for solenoid field table.

Bf is the field value in center of the solenoid.

\*\* heff has no meanning for 1D table field solenoid and is a
placeholder.

\*\*\*\* nstep is placeholder for the hard-edge solenoid

##### Examples:

1\) isol=1. Field is given in **solenoid.#01.** In this example nstep =
iint.

The effective length is placeholder and can be used as a reference.

1 sol 110000. 30. 20. 3. 3.

2\) isol=1. Field is given in **solenoid.#45.** In this example nstep =
500.

The effective length is placeholder and can be input for reference.

45 sol 110000. 30. 20. 3. 3. 500

3\) isol=0. All lines below represent the same hard-edge solenoid.

heff must be defined as an input parameter. rap\*\*\* and nstep are

used as the placeholders and can be skiped.

1 sol 110000. 30. 20. 3.

1 sol 110000. 30. 20. 3. 3.

1 sol 110000. 30. 20. 3. 3. 200

0 sol 110000. 30. 20. 3.

####  \* 2D or 3D Table Field Solenoid \*

The solenoid field is calculated by some external electromagnetic code.

2D and 3D table format is described in chapter 5.???

n **sol3D** Bf d_elem rap nstep

n\>0 extension number of the file **eh_EMS.#n**

d_elem \[cm\] total length of the solenoid (the field extension along z)

Bf \[Gs\] peak magnetic field at the center of the solenoid

rap \[cm\] aperture radius

nstep number of integration steps for the device.

**Note:**

The pre-processor code **TRANSFORM.exe** normalizes solenoid field table
to provide Bz(0,0,d_elem/2)=1.

Bf is the field in the center of the solenoid.

##### Examples:

1\) Field is given in **eh_EMS.#01**

1 sol3d 110000. 30. 3. 100

2\) Field is given in **eh_EMS.#67**

67 sol3d 110000. 30. 3. 50

####  \* dipole MAGNET, ROuNded pole face\*

Internal or user defined set of Enge coefficients c0÷c5 can be used for

the fringe field calculation. User can define Enge coefficient using the

commands 1 enge bmag c0 ..c5 and 2 enge bmag c0 ..c5 . The number 1 (2)
in the first position defines coefficients for the entrance (exit) edge
???.

### n bmag d_elem rbend theta airgap width bet1 bet2 r1_inv r2_inv nstep 

n=0 the fringe field is calculated analytically, Eq. (A5-1,A5-2)

n\>1 extension number of the file **eh_EMS.#n** containing

the entrance fringe field 2D table. A file **eh_EMS.#n+1** must

contians 2D table for the exit fringe field, see Fig. A5-4B

2D table format is described in chapter 5.???

d_elem \[cm\] the total length of the magnet, this length includes
entrance

and exit fringe fields L=2d+ρ~0~θ (d3g)

rbend \[cm\] ρ~0~ is the bending radius

theta \[deg\] θ is the bending angle (θ\>0 bend to the right, θ\<0 bend
to the left)

airgap \[cm\] g is the gap width for field calculations

width \[cm\] w is the horizontal aperture of dipole

bet1 \[deg\] β~1~ is the entrance edge angle

bet2 \[deg\] β~2~ is the exit edge angle

r1_inv \[1/cm\] 1/R~1~ is the curvature of entrance pole face

r2_inv \[1/cm\] 1/R~2~ is the curvature of exit pole face

nstep number of integration steps for the device.

**Note:**

It is recommended to read Appendix A5 for more information.

Addititional dipole parameters are $\delta_{1}$(=0.9 by default) and
$\delta_{2}$(=3 by default). The first parameter is defined a vertical
vacuum chamber dimension,

see Fig. A5-3, the parameter $\delta_{2}$ defines the fringe fields
extensions $z_{\text{11}} = z_{\text{21}} = - \delta_{2}g$ inside the
dipole, see Fig. A5-4. TRACK terminates task for

the intersecting entrance and exit fringe fields. User can change this
parameters.

The command line 1 prmtr delta1=r assigns r to $\delta_{1}$ .

The command line 1 prmtr delta2=r assigns r to $\delta_{2}$ .

The command line 1 prmtr dev_field= calculates dipole

parameters p, Bf, k1, xcr1, xcr2, z11, z12, x11, x12, z21, z21, x21, x22
and extracts them into the file **log.dat**. 1D table containing a field
falloff By(0,0,z), see Fig. A5-5A is also extracted in the file
**log.dat**

The command 2 prmtr dev_field= extracts 2D tables contaning the entrance
and exit fringe field B~y~(x,0,z), see Fig. A5-4, into the file
**dev_field.dat** .

##### Examples:

1\) Enge coefficients are internal c0=-0.003183,c1=2.32, c2c5=0.

0 bmag 108.432 40. 90. 7.6 10. 31. 31. 0.01 -0.01 200

2\) Enge coefficients are user defined.

1 enge bmag 0.1756 2.4415 -0.0555 0.4293 -0.4706 0.1088

2 enge bmag 0.1756 2.4415 -0.0555 0.4293 -0.4706 0.1088

1 prmtr delta1=0.8

1 prmtr delta2=2.5

1 prmtr dev_field=

0 bmag 108.432 40. 90. 7.6 10. 31. 31. 0.01 -0.01 200

#### \*dipole MAGNET, any pole face\* 

This element supports any shape of the poles (not only rounded one) and
magnetic field with arbitrary field gradient. N is the field index. This
elment is more generalized bending magnet and supports all 5 types of
diples defined in the code RAYTRACE \[A5-4\].

### n dipo d_elem rbend theta airgap width bet1 bet2 mtype nstep 

n extension number in the files **eh_EMS.#n**

for 2D table fringe field of the dipole

d_elem \[cm\] L-total length of the dipole, this length includes the
entrance

and exit fringe fields ,L=2d+ρ~0~θ (d3g)

rbend \[cm\] ρ~0~-bending radius

theta \[deg\] θ-bending angle (θ\>0 right bend , θ\<0 left bend)

airgap \[cm\] g-gap width for field calculations

width \[cm\] w-horizontal aperture of dipole

bet1 \[deg\] β~1~ -entrance edge angle

bet2 \[deg\] β~2~ exit edge angle

, , ,and are cofficient of the Taylor expansion of the

magnetic field in a "uniform" field region,see Eq. (A5-4)

mtype type of the dipole magnet

mtype=1,2 homogenous field dipole

mtype=3 dipole with field gradient.

nstep number of integration steps for the device

**Note:**

The dipole parameters are defined in Appendix 5. The parameters xcr1,
xcr2 are output parameters. The parameters xmax, zmin, zmax are included
in **eh_2d.#n.** The code "TRANSPORT" uses parameter k1, "GIOS" uses the
function E(z), and "RAYTRACE" uses 2D tables with B~x~(x,0,z) for fringe
field description. Subroutine dipo calculates k1, E(z), and 2D tables
with B~x~(x,0,z). RAYTRACE can calculate 2D fringe field tables for
different types of dipole magnets. These tables can be used for the
element dipo after some modification.

##### Examples:

1\) 34 dipo 40.0 143.2 35. 3. 10. 5. -15. -15. 2 200

2\) 34 dipo 40.0 143.2 35. 3. 10. 5. -15. -15. 3 200 1^st^ line

0.5 0. 0. 0. 2^nd^ line

2D tables for fringe fields are in the file **eh_2d.#34**

####  *n* =0.5, b=0, Γ=0, Δ=0

####   \*Magnetic MULTIPOLE with fringe fields\* 

Internal or user defined set of Enge coefficients c0÷c5 can be used for

the fringe field calculation. User can define Enge coefficient using the

command lines 1 enge mult c0 ..c5 and 2 enge mult c0 ..c5. The number 1
(2) in the first position defines coefficients for the entrance (exit)
edge.

### n mult d_elem Heff\* Bq\*\* Bh\*\* Bo\*\* rap i_quad nstep 

n

d_elem\[cm\] total length of the multipole

Heff \[cm\] effective length of the multipole

Bq \[G\] quadrupole field component at r=Ra

Bh \[G\] hexapole field component at r=Ra

Bo \[G\] octupole component at r=Ra

Ra \[cm} aperture radius

i_quad 0 - full lens, 1 - first half of lens, 2 -second half of lens

Note: when the lement is devided to two halves, the total length of the
element is equal to the length of two halves. However, the effective
length is the same independently either it is full multipole or the half
of the multipole.

nstep number of integration steps for the device.

***Note.***

> \* The effective length heff and Enge coefficients are the same for
> all
>
> multipole components. A device m6 for more precise description of
>
> the edge fields of the magnetic multipole is being developed.
>
> \*\* Bq, Bh, and Bo are some values of the field defined as G= Bq/Ra,
> H= Bh/Ra^2^,and O= Bh/Ra^3^ where G, H, and O are coefficiens of
> multipole field
>
> expansion, see Appendix XXX (being developed).

Bq \>0 provides focusing in the horizontal plane.

##### Examples:

1\) Full lens. Enge coefficients are internal.

1 mult 115. 50. 4834. -350.0 0. 5. 0 200

2\) The lens is divided into two halves. Enge parameters of each half
are

internal.

1 mult 57.5 50. 4834. - 350.0 0. 5. 1 100

1 mult 57.5 50. 4834. - 350.0 0. 5. 2 100

3\) Enge coefficients are user defined. In this example we use the Enge

> coefficients which are equal to the internal coefficients.

1 enge mult -0.00004, 4.518219, 0, 0, 0

2 enge mult -0.00004, 4.518219, 0, 0, 0

\*\*\*\*\*\*

\*\*\*\*\*\*

1 mult 115. 50. 4834. -350.0 0. 5. 0 200

All these examples provide the same beam transformation.

#### 

####  \*Magnetic Quadrupole with fringe fields\*

####  \*HARD EDGE Magnetic Quadrupole\* 

Internal or user defined set of Enge coefficients c0÷c5 can be used for

the fringe field calculation. User can define Enge coefficient using the

commands 1 enge quad c0 ..c5 and 2 enge quad c0 ..c5

The quadrupole with d_elem=Heff or nstep=0 is treated as a hard edge
quadrupole.

### n quad Bq \* d_elem Heff rap any\*\* nstep\*\*\* 

n

Bq \[G\] quadrupole component at r=Ra

d_elem\[cm\] total length of the quadrupole

Heff \[cm\] effective length of the quadrupole

Ra \[cm\] aperture radius

any placeholder, arbitrary number

nstep number of integration steps for the device

***Note.***

\* Bq is an artificial number and defines G= Bq/Ra, where G is a
coefficient

of the quadrupole field expansion, see Appendix XXX (being developed).

Bq \>0 provides focusing in a horizontal plane

\*\* Sorry

\*\*\* nstep is placeholder for the hard-edge quad

##### Example:

1\) The quad with the fringe fields. Enge coefficients are internal.

1 quad -1126.0 40. 25. 3. 0 200

2\) The quad with the fringe fields. Enge coefficients are user defined.

In this example we use the Enge coefficients which are equal to

the internal coefficients.

1 enge quad -0.00004, 4.518219, 0, 0, 0

2 enge quad -0.00004, 4.518219, 0, 0, 0

\*\*\*\*\*\*

\*\*\*\*\*\*

> 1 quad -1126.0 40. 25. 3. 0 200

3\) The hard edge quad (nstep=0).

1 quad -1126.0 40. 25. 3. 0 0

4\) The hard edge quad (d_elem=Heff).

1 drift 8.5 3. 3.

1 quad -1126.0 25. 25. 3. 0 200

1 drift 8.5 3. 3.

The beam transformation is the same for examples 3) and 4).

The "soft-edge" quad in the example 1) or 2) is treated as "hard-edge"

quad in the example 3) by applying nstep=0. It's a recommended way of

switching between "soft-edge" and "hard-edge" quads.

#### \*3D-field-map magnetostatic Quadrupole\* 

The quad field is calculated by some external electromagnetic code.

3D table format is described in chapter 5.?.

### n mq3d d_elem Bq \* rap nstep

n\>0 extension number of the files **eh_EMS.#n**

Bq \[G\] quadrupole component at r=Ra

d_elem \[cm\] total length of the quad

Ra \[cm\] aperture radius

nstep number of the integration steps for the device

***Note.***

\* Bq is an artificial number and defines G= Bq/Ra, where G is a
coefficient

of the quadrupole field expansion, see Appendix ??.

Positive field Bq\>0 implies focusing in a horizontal plane.

The field table **eh_EMS.#n** is normalized by **TRANSFORN.exe** so that
G=1 in

the quad center. **TRANSFORN.exe** evaluates the quad effective length
Heff

and Enge coefficients for the field table **eh_EMS.#n**

(see chapter 4 for further explanation).

##### Example:

1\) field is given in **eh_EMS.#04**

4 mq3d 6000.0 13.61 2. 40

2\) field is given in **eh_EMS.#67**

67 mq3d 6000.0 13.61 2. 140

## 6.3 Electrostatic devices

#### 

#### \*3D-field-map ELECTROSTATIC Quadrupole\* 

### n eq3d d_elem Vf rap nstep

n extension number in the files **eh_EMS.#n**

d_elem \[cm\] total length of the quad

Vf \[V\] inter-electrode voltage\*

Ra \[cm\] aperture radius

nstep number of integration steps for the device

\* The field table **eh_EMS.#n** is normalized by **MWSread.exe** so
that the

inter electrode voltage is equal to 1 (see chapter 4 for explanation).

Vf is the inter electrode voltage of the quad.

***Note.***

1\) Vf\>0 provide focusing in a horizontal plane.

2\) Field gradient in the center of the 3D electrostatic quad is

G=k\*Vf/Ra\*\*2, k1. **MWSread.exe** evaluates k and the quad effective

length Heff and extracts this two parameters in the file **output.dat.**

For linear calculations the device eq3d can be replaced by the equad
with rhe aperture radius Ra, effective length Heff,and inter electrode
voltage Vf\*=k\*Vf.

##### Examples:

4 eq3d 6000.0 13.61 2. 40 , field is given in **eh_EMS.#04**

67 eq3d -1000.0 13.61 2. 140 , field is given in **eh_EMS.#67**

#### 

#### \*3D-field-map three-electrode EINZEL lens\*

### n einz Vf d_elem rap nstep

n extension number in the files **eh_EMS.#n**

d_elem \[cm\] total length of the quad

Vf \[V\] voltage of the central electrode\*, field level

Ra \[cm\] aperture radius

nstep number of integration steps for the device

\*The field table **eh_EMS.#n** is normalazed by **MWSread.exe** so that
the voltage of the outer electrodes is equal to 0 and the voltage of the
central electrode is equal to 1, see chapter 4 of this manual for the
explanations. Vf is the central electrode voltage of the einzel lens.

**Example:**

9 einz 6000.0 13.61 2. 40 , field is given in **eh_EMS.#09**

97 einz -1000.0 13.61 2. 140 , field is given in **eh_EMS.#97**

####  \*ELECTROSTATIC Quadrupole with fringe fields\*

### n quad Vf d_elem Heff rap nstep 

n n=0 internal set of Enge coefficients c0÷c5 is used

n=1 the Enge coefficients c0÷c5 are defined by the latest

element 1 enge equad c0 ..c5 placed upstream the line describing equad
in the sclinac.dat file.

Vf \[V\] inter-electrode voltage

d_elem\[cm\] actual length of the quadrupole

Heff \[cm\] effective length of the quadrupole

Ra \[cm\] aperture radius

nstep number of integration steps for the device\*\*

***Note.***

1\) vf \>0 provides focusing in a horizontal plane

2\) Field gradient in the center of the quad is G=Vf/Ra\*\*2

3\) Hard edge electrostatic quadrupole is not applicapable in **TRACK.**

##### Example:

1\) Enge coefficients are internal.

0 equad 5126.0 40. 25. 3. 0 200

2\) Enge coefficients must be defined. In this example we use the

Enge coefficients which are equal to internal ones.

1 enge equad -0.00004, 4.518219, 0, 0, 0

\*\*\*\*\*\*

\*\*\*\*\*\*

> 1 equad -1126.0 40. 25. 3. 0 200

Beam transformation is the same in the examples 1) and 2).

#### 

#### \*HV platform entrance&exit\*

### Element name: 'deck'

ntype = el.n ! Type of the lens, determines the file with input field
distribution.

Vdeck = el.p1 ! Voltage with respect to the ground \[kV\]

Positive voltage accelerates positively charged ions

d_elem = el.p2 !total length of the electric field distribution at the
edge of the HV deck \[cm\]

rap = el.p3 ! aperture of the beam pipe \[cm\]

mesh_Z = el.n1 ! number of meshpoints along z

mesh_R = el.n2 ! number of meshpoints along r

***Note.***

1\) This element is being reconstructed. Use the device 'extrc' instead
of the 'deck'.

##### Example:

2 deck -35. 20. 1.5 201 16

1 extrc 2000. (voltage,V) 78.(length,cm) 2. (aperture, cm) 100 (number
of integration steps)

## 6.4 Drift space and other elements of the beamline

#### \*DRIFT\* 

### n drift d_elem rapx rapy nstep

n -any integer number

d_elem \[cm\]-length of the drift space

Rx \[cm\] -horizontal half aperture (X direction)

Ry \[cm\] -vertical half aperture (Y direction)

nstep -(optional, ≥2)number of steps for integration along the -drift
space. If this parameter is omitted,

nstep =max{2, d_elem/(0.25λ)}, where λ=c/(harm\*freqb) is the current RF
wave length and c -- is the velocity of the reference particle.

***Note.***

1\) Ry\>0 :the aperture of the drift is
rectangular{-\|Rx\|x\<\|Rx\|,-Ry\<y\<Ry}.

2\) Ry\<0 :the aperture of the drift is elliptical (x/Rx)^2^+ (y/Ry)^2^
\<1

3\) The drift space with the length close to zero can be used as a slit
in **sclinac.dat** input.

##### Example:

1\) 1 drift 9.0 3. 3. nstep is defined internally, the

aperture is rectangular

2\) 1 drift 9.0 3. 3. 45 nstep=45, the aperture is rectangular

3\) 0 drift 9.0 3. -3. 245 nstep=245, the aperture is elliptical

#### \*SLIT\*

### n slit rapx rapy 

n = 1 defines element 'slit'

n = 0 defines element 'pseudo slit'

n =-1 no action

Rx \[cm\] half aperture in x direction

Ry \[cm\] half aperture in y direction

1)Ry\>0 :the aperture of the slit is
rectangular{-\|Rx\|x\<\|Rx\|,-Ry\<y\<Ry}.

2)Ry\<0 :the aperture of the slit is elliptical: (x/Rx)^2^+ (y/Ry)^2^
\<1

3)The slit element has a zero length along z-coordinate.

**Note:**

Particle is marked as a 'lost' particle if it is outside the slit
aperture. The 'lost' particle is not traced further. The coordinates of
the 'lost' particle on the slit will be saved. All particles lost in
'pseudo slit' and upstream of the 'pseudo slit' will be removed from the
array of particle coordinates. The latter is redefined and will consist
of less or equal number of particles than upstream of the element
'pseudo slit'.

#### \*STRIPPER\*

### n strip xWtarg dWtarg dxtarg dds

n number of the stripper film or foil and extension number of the

file **stripper.#0n**

xWtarg energy loss (keV/u)

dWtarg RMS energy straggling in keV/u, rms value calculated by the
external

code,in **TRACK** we assume the distribution is Gaussian.

dxtarg RMS scattering in X\' and Y\', in radians.

ddS fluctuation of the target thickness (relative unit), peak-to-peak

amplitude. The number of charge states and the percentage of particle
distribution in different charge states, as well as average beam energy
after the stripper must be given in file **stripper.#0n**.

##### Example:

1 strip 10. 4.1 0.0002 0.05

\*) Currently this element is suitable only for uranium at energies
\~10-15 MeV/u at the first stripper and at \~85-90 MeV/u at the second
stripper. The stripper subroutines in TRACK are based on SRIM
simulations. The passage through the stripper was initially simulated
using the SRIM code and the ion beam distribution has been
parameterized. Detailed description of the procedure will follow.
Generalized particle distribution after the passage of the stripper is
being developed by B. Mustapha.

#### 

#### \*Shift-rotate\* 

### Element name: \'shrt\'

ntype = el.n = 0 no meaning

fiz \[deg\] = el.p1 angle of rotation (positive for the counterclockwise
rotation)

delx \[cm\] = el.p2 displacement in X-direction

dely \[cm\] = el.p3 displacement in Y-direction

##### Example:

1 shrt 45. 0.1 0.1

#### \*UDS\*

### n uds d_elem Vf rap dz_elem nstep z1 z2 z3 z4 z5 

User defined structure. This element can be used to define a gap inside
the multi-gap resonator.

n extension number of the file **eh_EMS.#\*\***. The field file defines
3D distribution of the electric field in the accelerating gap (no
magnetic field is assumed). This field can be generated by an external
electrostatic code.

d_elem\[cm\] total length of the user defined device

Vf\[V\] gap voltage

rap \[cm\] radius of aperture

dz_elem\[cm\] shortening of the second drift tube length to fit the
reference particle phase in the following rf gap if such a gap exists.

nstep number of the integration steps for the device

z1 z2 z3 z4 z5 (optional) z-coordinates for extracting the reference
particle's (r.p.) phase along the element. Example: if one needs to know
phase of the r.p. one of z-coordinates should be equal to d_elem/2. The
phases of the r.p. will be extracted into the file **matrix.dat.**

#### \*PRMTR\*

This element can be used to define a drift tube resonator containing
many accelerating gaps. In addition, prmtr can be used to define or
re-define any integer flag from the list given as input parameters in
the file **track.dat.**

### 0 prmtr iflag_chain=phasa_in \[deg\]

n uds

n drift

n uds

n drift

.......

### 0 prmtr iflag_chain=0

##### Examples:

If iflag_log=1, it will extract major information about the element
following the line "prmtr" into the file **log.dat.**

If isol=0,1 it will introduce solenoid with out fringe fileds (isol=0)
and with fring fields (requires solenoid.dat file).

If current=0 it will introduce zero current and replaces the 'current'
definition in the **track.dat** file.

#### \*SCRATCH\* 

### Element name: \'scrch\'

##### Example:

-1 scrch

1 scrch

-1 : the code writes all necessary information to temporary file
scratch.#01.

+1 : the code reads all data and starts simulation from the intermediate
location along z where file scratch.#01 has been created.

#### \*STOP\* 

### n stop 

n any

stop stops simulation at this given location along the z.

##### Example:

0 stop

####  \*SWITCH\*

### n SWTCH coeff 

n -number of correction sections

coeff -This element is used to change the field level in focusing
elements during the correction procedures. **swtch** acts on focusing
devices (solenoids and quadrupoules) located immediately after **swtch**

##### Example:

2 **swtch** coeff

1 **sol** B0 d Heff rap rap

#### \*UPDATE\*

When **0 updat** structure line appears in **scilinac.dat** the beam
matrix for all charge states is calculated and then the transfer
matrices of each device between **0 updat** and **1 updat** are
calculated, both for reference particle with charge state Qdesign and
mass Adesign and for each ion species with **Q(iq)**, **A(iq)**, where
iq=1,nqtot. For charge state Qdesign and mass Adesign a cumulative
matrix of all devices from **0 updat** to exit of this device is
calculated. Beam matrix after each element is calculated as matrix
production and from ray trace calculations.

Matrix of devices and cumulative matrix from **0 updat** to exit of this
device and two kinds of beam matrices are extracted into the file
**matrix.dat**.

It is possible to have any number of non-intersecting **0 updat** **...
1 updat** blocs in the **sclinac.dat**. The matrix calculations do not
include beam space charge yet(it is being developed).

#### \*FILTeR\*

This element is used to filter unaccelerated particles after the RFQ by
setting dw_w=0.04. (relative energy deviation from the reference
particle energy). This mode is used for matching purposes. If dw_w=1.0
all particles are kept and the un-accelerated particles will be lost
either on the aperture walls or on the slits.

### Element name 'FILTR'

### n filtr dw_w QdesignNew Index 

n =1 element is activated, if n=-1, element is de-activated

dw_w energy cut-off boundary

QdesignNew -- Charge of the reference particle after the filter, should
be equal to the charge state of one of the charge states upstream of the
element 'filtr'

index If index=0, then no effect on bunch structure; if index=1, two
different charge states are combined into one bucket artificially (space
charge effect is ignored, current =0).

##### Example:

0 filtr 0.05 28 0.

## 6.5 Misalignments, errors and beam steering correction

#### \*ALIGN\*

### n align name ~xy~ ~z~ ~z~ ~j~ F~j~ s Fs 

n = nt_cav - the SRF cavity type (name=cav)

= 1 for all other devices

=-1 no action

name the device name in **sclinac.dat**

~xy~ \[cm\] (=0 by default) the amplitude of the element displacement in
x

and y direction w.r.t. the entrance and exit coordinate systems

of the device \*\*.

~z~ \[cm\] (=0 by default)the amplitude of the element displacement in z

direction w.r.t. the entrance and exit coordinate systems of the

element

~z~ \[mrad\] (=0 by default)the amplitude of the element rotation about

z-axe of the entrance and exit coordinate system of the

element.

~j~ \[deg\] (=0 by default)the rms fast error of the phase\*\*.

F~j~ \[%\] (=0 by default) the rms fast error of the field
amplitude\*\*\*.

s \[deg\] (=0 by default) the amplitude of the element static phase
error

Fs \[%\] (=0 by default) the amplitude of the element static field

error

##### Note:

1\) The previous version of the code, TRACKv34, defined the
misalignements of the solenoids and SRF cavities in the input file
**track.dat. TRACKv35** define the misalignements all of the devices by
the command align in the input file **sclinac.dat**

2\) The line in the **sclinac.dat** file 1 align name.. defines the
position of misalignments, phase and field errors for all devices,
except cavities, with the given name located downstream of this line.
The line nt_cav align cav ..

defines the errors only for cavities of the type nt_cav i.e. only for
devices nt_cav cav .. located downstream of this command.

3\) The errors and misalignments of the device are described by 10
randomly generated numbers R~1~R~10~. Particularly, R~1~R~6~ defines the
spatial misalignments of the device, see Appendix A1 for the
explanations.

x~in~ =~xy~\*R~1~ is the device displacement along x axis of the
entrance

coordinate system.

y~in~ =~xy~\*R~2~ is the device displacement along y axis of the
entrance

coordinate system.

z~in~ =~xy~\*R~3~ is the device displacement along z axis of the
entrance

coordinate system.

~xin~ =~xy~\*R~4~ is the device rotation about x axis of the entrance

coordinate system.

~yin~ =~xy~\*R~5~ is the device rotation about y axis of the entrance

coordinate system.

~zin~ =~z~\*R~6~ is the device rotation about z axis of the entrance

coordinate system.

Phase and amplitude fast errors are described by Gaussian

distribution with standard deviation =1.0 and truncated at the 3-

level. R~7~,R~8~, \|R~7,8~\| 3. The fast errors are known as jitter or

dynamic errors.

~j~\*R~7~ is the fast phase error of the device

F~j~\*R~8~ is the fast field error of the device

R~9~ and R~10~ are uniformly distributed in interval \[-1,1\] and
defined to be the

static errors of the phase and amplitude of the rf field.

~s~\*R~9~ is the static phase error of the device.

F~s~\*R~10~ is the static field error of the device.

4\) The line 1 prmtr mslgn_dstr=N followed by a device evaluates

N seeds for spatial misalignment of this device. The device

displacements and rotation w.r.t. entrance coordinate system are

extracted into the file **r_in.dat.** The file **r_in.dat** contains the
title:

name Xin\[cm\] Yin\[cm\] Zin\[cm\] RXin\[mrad\] RYin\[mrad\]
RZin\[mrad\]

and N line with the device coordinate w.r.t. entrance coordinate

system.

The device displacement and rotation w.r.t. exit coordinate system

is extracted in a file **r_out.dat.** The file **r_out.dat** has the

heading:

name Xout\[cm\] Yout\[cm\] Zout\[cm\] RXout\[mrad\] RYout\[mrad\]
RZout\[mrad\]

and N line with the device coordinate w.r.t. exit coordinate

system.

If the line 1 prmtr mslgn_dstr=N appears in the **sclinac.dat** several

times,only the last line will be executed.

5\) In each accelerator seed 10 numbers R~1~R~10~ are generated for each
element defined in the file **sclinac.dat.** These data is extracted
into the file **VRAND_nnn.dat**, where **nnn** is the number of seed.

##### Examples:

1\) 1 align mult 0.03 0. 0. 0. 0.

The misalignment is assigned or re-assigned to all multipoles

(n mult..) located downstream of this line.

2\) 23 align cav 0.03 0. 0. 0.1 0.1 1. 1.

The misalignment is assigned or re-assigned to all cavities of the

type 23 (23 cav ..) located downstream of this line.

The field in the cavity of type 23 is defined by the file
**eh_MWS.#23**.

#### 

#### \*ARtificial Steering corrector\*

### n zero pos ang 

##### n = 1 the \"zero\" corrector is activated

#####  =-1 no action (the \"zero\" corrector is not activated.)

##### pos\[cm\] error of beam center position after correction in the horizontal 

#####  and verical planes 

##### ang\[mrad\] error of beam centroid angle after correction in the horizontal and verical planes 

#####  

##### Note:

This element assigns zero to the center of gravity (with some

residual errors of positioning) of the beam in xx' and yy' planes.

The new beam center positions Xc and Yc, and the beam center angles X'c

and Y'c will be uniformly distributed in intervals

-pos Xc pos , -pos Yc pos , -ang X'c ang , -ang Y'c ang .

##### Example:

1 zero 0.01 0.1

#### \*Thin-dipole Steering corrector\*

n **CORR** L FH FV rapC nstep FHkick FVkick

n =1 corrector is activated

n =-1 no action (corrector is not activated )

L\[cm\] (=0 by default), "thin"corrector has zero length

FH\[mrad\] -maximum horizontal corrector strength for transverce

correction procedure ( FHkick\>0)

> -actual corrector strength if FHkick=0. In this case it acts as an
> externally defined corrector with the kick FH (manual corrector).

FV\[mrad\] -maximum vertical corrector strength for transverce

correction procedure ( FHkick\>0)

-actual corrector strength if FHkick=0. In this case it acts as an
externally defined corrector with the kick FV (manual corrector).

RapC\[cm\] -(optional)aperture of the corrector, it is not applied to
"thin" corrector

nstep -(optional) number of integration steps, it is not applied to
"thin" corrector

FHkick\[mrad\] -vertical corrector strength for transfer function
calculation

FVkick\[mrad\] -horizontal corrector strength for transfer function
calculation

#####  Note:

This element assigns thin-dipole corrections to the center of gravity of
the beam in xx' and yy' planes. Strengths are determined by running the
correction module of the code or are defined manually.

Details are given in Appendix 2.

##### Examples:

1)0 corr 0. 2. 3. - manual corrector

2)0 corr 0. 2. 3. 0. 0. 1. 1. -- "calculated" correction strengths

3)0 corr 0. 2. 3. 0. 0. 0. 0. - manual corrector

4)0 corr 0. 2. 3. 0. 0. 0. 1. -- manual horizontal corrector and the

"calculated" correction strength in

vertical plane

#### \*Dipole corrector\*

n **CORR** L FH FB rapC nstep FHkick FVkick

n\>1 -number of the extension of the file with name **eh_2d.#n**

for 2D table with B~y~(x,0,z) and B~z~(0,y,z) of the corrector

L\[cm\] -length of the corrector

FH=BYmax\[G\] -maximum vertical field in the center of the corrector for

transverce correction procedure (FHkick\>0)

> -actual corrector strength (FHkick=0). In this case the corrector is

"manual".

> Vertical field bends beam in the horizontal plane.

FV=BXmax\[G\] -maximum horizontal field in the center of the corrector
for

transverse correction procedure ( FVkick\>0).

-actual corrector strength (FVkick=0). In this case the corrector is
"manual".

> Horizontal field bends beam in the vertical plane

RapC \[cm\] - the corrector aperture

nstep -number of integration steps

FHkick\[G\] -vertical field in the center of the corrector for transfer

function calculation

FVkick\[G\] -horizontal field in center of the corrector for transfer

function calculation

##### Note:

This realistic dipole corrector subroutine uses 2D-field distribution in
XZ and YZ planes.

#### 

####  \*Dipole corrector combined with solenoid\*

n1 **sol3D** Bf d_elem rap nstep

& n **CORR** L FH FV rapC nstep FHkick FVkick

n\>1 -extension number in the files **eh_2d.#n**

for 2D table with B~y~(x,0,z) and B~z~(0,y,z) with field of

the corrector

L\[cm\] -length of the corrector\*

FH=BYmax\[G\] -vertical field, bends beam in the horizontal plane

-maximum vertical field in the center of the corrector for

transverce correction procedure ( FHkick\>0)

-actual corrector strength (FHkick=0). The corrector is

"hmanual".

FV=BXmax\[G\] horizontal field, bends beam in the vertical plane

-maximum horizontal field in the center of the corrector for

transverce correction procedure ( FVkick\>0)

-actual corrector strength (FVkick=0). The corrector is

"manual".

RapC \[cm\] - the corrector aperture\*

nstep -number of integration steps\*

FHkick\[G\] -vertical field in center of the corrector for transfer

function calculation

FVkick\[G\] -horizontal field in center of the corrector for transfer

function calculation

\* The length, aperture and number of integration steps of the combined
corrector are defined in the line for the upstream solenoid.

##### Note:

1\) This modification of the corrector subroutine is used for combined
solenoid and dipole fields.

2\) The center of the corrector coincides with the center of the
solenoid

which is defined in preceding line, see Fig???.

#### \*BEAM POSITION MONITOR\*

### n MON L dx dy Wx Wy 

n -any integer, no meaning in this version of the TRACK

L \[cm\] (=0, by default, optional)

dx\[cm\] -accuracy of the BPMX

dy\[cm\] -accuracy of the BPMY

Wx\[cm\] - weight in the correction equation for the BPMX

Wy\[cm\] - weight in the correction equation for the BPMX

***Note:***

1\) This line defines two Beam Position Monitors (BPM) simultaneously:

BPMX measures the x-coordinate of the beam center and BPMY measures

the y-coordinate of the beam center.

2)L0 defines a virtual monitor to measure the beam center angle.
Accuracy of the angle measurement is d~x~ and d~y,~ which are

${d\phi}_{x} = \sqrt{2}\ \frac{\text{dx}}{L},{d\phi}_{y} = \sqrt{2}\frac{\text{dy}}{L}\ $

#### \*CORRECTION SECTION MARKER\*

n CDUMP

n \>0 number of the correction sections.

***Note:***

In TRACKv35 cdump is used like brackets.

The correction section number n is defined by two or three n cdump
elements. The code uses correctors and monitors between 1^st^ n cdump
and 2^nd^ n cdump when the correction section is marked by two n cdump
elements. TRACK uses correctors between 1^st^ n cdump and 2^nd^ n cdump
and the monitors between 1^st^ n cdump and 3^rd^ n cdump when the
correction section is marked by three elements cdump. See Fig.??

##### Example:

#####  Δ~1~(~1~\*\<\-- 1^st^ section\-\-\--\>\<\--2^nd^ section\--\>\<\--3^rd^ sect.\-\--\>\<\-- 4^st^ sect.\--\>\<\-\-\-\-\-\-\-\-\-\-\-\-\-\-- 5^th^ section\-\-\-\-\-\-\--\>

\*\*\*\*\*\*\*\*\*\*\*(~1~ Δ\*\*=\* Δ~1~ ) \*\*\*\*\*\*\*\*(~2~Δ \*\* =
~1~) \*\* =\* Δ\***=**~2~) \*\*\*\*\*\*\*\*

\<\-\-\-\-\-- \-\-\-\--1^st^ correction
section\-\-\-\-\-\-\-\-\-\-\-\-\-\--\>

\<\-\-\-\-\-\-- 2^nd^ correction section\-\-\--\>

\< \-\-\-\-\-\-\--1^st^ section \-\-\-\-\-\-\-\-\--\>\<\-\--
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--2^snd^
section\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\>

(~1~\*\*\*\*\*\*\*\*\*Δ\*\*\* Δ ~1~) (~2~\*\*\*\*\*\*\* Δ \*\* = \*~1~)
\*\* =\* Δ\***=**\*\*\*\*\*\*\*\*~2~)

\< \-\-\-\-\-\-\-\-\-\-\-\-\-\-\--1^st^ correction section
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\>

\<\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-- 2^nd^ correction
section\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\>

(this figure needs some modifications)

Beam passes through the first section. The strengths of the correctors
between (~1~ ~1~) are defined in the first correction section using the
BPM inside the brackets (~1~ ~1~) ~1~).

## 7. Launching the code TRACK 

Collect all necessary files in one directory. Click TRACKv37.EXE, hit
the letter 'g' and press ENTER. For a file manager & editor, we use a
very convenient software "Windows Commander" v.4.52 purchased from
Christian Ghisler (Switzerland).

**TRACKv37.EXE** simulates beam dynamics with the graphical windows. On
running the code several output files are produced.

## 8. TRACK Output data 

Beam parameters after each element of **sclinac.dat** are extracted into
file **out.dat.** The first line in the file **out.dat** is the title of
various beam parameters. The second line contains beam parameters w.r.t.
Cartesian coordinate system (CCS) ${\overrightarrow{E}}_{\text{first}}$
which is the entrance CCS of the accelerator. The subsequent lines
contain beam parameters w.r.t. the device exit coordinate system CCS
${\overrightarrow{E}}_{\text{out}}$. Definitions of different CCS along
the beam path are shown in Fig. 1 below.

![](media/image4.wmf){width="4.75in" height="1.6861111111111111in"}

Figure 1. Trajectroy of the reference particle.

For each device TRACK defines entrance CCS ![](media/image5.wmf), exit
CCS ![](media/image6.wmf) and nstep+1

intermediate CCS ![](media/image7.wmf). Three numbers (x,y,s), where s
is a distance along the reference particle path from accelerator
entrance to origin of any CCS $\overrightarrow{E}$, x and y are given
w.r.t. this CCS $\overrightarrow{E}$, generate a curvilinear beam
optical coordinate of the particle.

![](media/image8.wmf)

Figure 2. Cartesian coordinate system, ![](media/image9.wmf) is the
velocity of the reference particle.

The column names in the file **out.dat** are: ![](media/image10.wmf)

n_el - sequence number of the element in **sclinac.dat**

name - name of the element( cav, align .. )

dist\[m\] -- distance along the accelerator beam optic axis from the
beginning of the entrance to the exit of the given element

Energy\[MeV/u\] -- average kinetic energy of the beam

x_rms\[cm\]
~-~$x_{\text{rms}} = \sqrt{\overline{(x - \overline{x})^{2}}}$, x rms
envelope of beam

y_rms\[cm\]
~-~$y_{\text{rms}} = \sqrt{\overline{(y - \overline{y})^{2}}}$~,~ y rms
envelope of beam

Xmax\[cm\] -x~max~ envelope of beam (100% of particles)

Ymax\[cm\] -y~max~ envelope of beam (100% of particles)

phi_rms\[deg\]
~-~$\phi_{\text{rms}} = \sqrt{\overline{(\phi - \overline{\phi})^{2}}}$
rms phase envelope of beam

phi_max\[deg\] -φ~max~ phase envelope of beam (100% of particles)

DW/W\[rel.u.\] -(dW/W)~max~ energy envelope of beam (100% of particles)

4\*exn_rms\[cm\*mrad\]- 4ε~x~,where ![](media/image11.wmf) is normalized
rms emittance in the(xx') phase plane

ex##.#\[cm\*mrad\] ε~x~(##.#%)normalized emittance in (xx') phase plane
containing

##.#\[%\] of the beam particles. ##.# is defined by variable

> part in the file **track.dat.** ##.#=100\*part, for example if
> part=0.995, then ##.#=99.5)

exn_max\[cm\*mrad\] ε~x~(100%) normalized emittance in (xx') phase plane

containing 100% of particles.

4\*eyn_rms\[cm\*mrad\]- 4ε~x~,where ![](media/image12.wmf) is normalized
rms emittance

in the (yy') phase plane

ey##.#\[cm\*mrad\] -ε~y~(##.#%) normalized emittance in (yy') phase
plane

containing ##.#\[%\] of the beam particles. ##.# is defined by

variable part in the file **track.dat.**

eyn_max\[cm\*mrad\] -ε~y~(100%) normalized emittance in (yy') phase
plane

containing 100% of the beam particles.

4\*ezn_rms\[keV/u\*ns\] -4ε~z~,where ![](media/image13.wmf) is
normalized rms

emittance in longitudinal (Δt=t-t~RP~, ΔW/W=(W-W~RP~)/ W~RP~ )

phase plane. t~RP~ and W~RP~ is time of flight and kinetic

energy of the reference particle.

ezn##.#\[ keV/u\*ns\] -ε~z~(##.#%) normalized emittance in longitudinal
(Δt=t-t~RP~,

ΔW/W=(W-W~RP~)/ W~RP~ ) containing ##.#\[%\] of the beam

particles. ##.# is defined by variable part in the file

**track.dat.**

ezn_max\[cm\*mrad\] -ε~y~(100%) normalized emittance in longitudinal

> (Δt=t-t~RP~,ΔW/W=(W-W~RP~)/ W~RP~ ) containing of the beam particles.

XPc\[cm\] $\overline{x}$ - spatial beam center position in (xx') phase
plane

BXc\[mrad\] $\overline{x^{'}}$ - angular beam center position in (xx')
phase plane

YPc\[cm\] $\overline{y}$- spatial beam center position in (yy') phase
plane

BYc\[mrad\] $\overline{y^{'}}$ - angular beam center position in (yy')
phase plane

btgm βγ, =v/c is velocity of the reference
particle,$\gamma = \frac{1}{\sqrt{1 - \beta^{2}}}$

zcn\[deg\] $\overline{\phi}$ phase beam center position in (φ dw/w)
phase plane w.r.t reference particle

a_x α~X~ -Twiss-parameter of the beam in (xx') phase plane

b_x\[cm/mrad\] β~X~ -Twiss-parameter of the beam in (xx') phase plane

a_y α~y~ -Twiss-parameter of the beam in (yy') phase plane

b_y\[cm/mrad\] β~y~ -Twiss-parameter of the beam in (yy') phase plane

a_z α~z~ -Twiss-parameter of the beam in (φ dw/w) phase plane

b_z\[deg\*(%ofD_W/W)\] β~z~ -Twiss-parameter of the beam in (φ dw/w)
phase plane

#of_lost_part number of the lost particles

total#of_part total number of the survived particles

File **coord.dat** contains coordinates of particles transmitted to the
line 0 stop in the **sclinac.dat** file. The particle coordinates are
calculated w.r.t. the CCS ${\overrightarrow{E}}_{\text{last}}$ which is
the exit CCS of the accelerator. The first line of this file is column
names:

**Nseed iq dt\[nsec\] dW\[Mev/u\] x\[cm\] x\'\[mrad\] y\[cm\]
y\'\[mrad\].**

Nseed is the seed number. For ideal machine without errors Nseed=0.

iq is the charge state number of ion. The charge and mass of the ion is
equal

Q~iq~=qq(iq)and A~iq~=amass(iq). The arrays qq and amass are

defined in the file **track.dat**.

dt dt=t-t~RP~ ,where t is the particle time-of-flight and t~RP~ is the

reference particle time-of-flight.

dW dW=W-W~RP~ ,where W is the energy of the particle, and W~RP~ is

the energy of the reference particle.

x is the x-coordinate of the particle w.r.t. CS
${\overrightarrow{E}}_{\text{last}}$

x' x'=v~x~/v~z~

y is the y-coordinate of the particle w.r.t. CS
${\overrightarrow{E}}_{\text{last}}$

y' y'= v~y~/v~z~

The file **lost .dat** containes coordinates of the particles which are
lost

in the accelerator or transport line. The coordinates and velocities of
the particles lost in a given device are extracted in the first CCS
${\overrightarrow{E}}_{\text{first}}$ of the accelerator and in the
entrance CCS ![](media/image14.wmf) of the device.

![](media/image15.wmf){width="4.0in" height="2.0381944444444446in"}

The unit vectors of the device CCS ![](media/image16.wmf) are defined by
the transformation matrix ***O*** and the unit vectors of the device CCS
${\overrightarrow{E}}_{\text{first}}$ as

![](media/image17.wmf) .

The transformation rule from the device CCS ![](media/image18.wmf) to
the CCS ${\overrightarrow{E}}_{\text{first}}$

for the particle coordinate and velocity is

![](media/image19.wmf),

where T means transpose.

The column names of the file **lost.dat** are:

n_el -sequence number of element in the file **sclinac.dat**

name -name of the device( cav, align .. )

Q\[\|e\|\] --the charge of the ion

A --the mass number of the ion

Xfirst\[cm\] -x-coordinate of the particle w.r.t. the CCS
${\overrightarrow{E}}_{\text{first}}$

Yfirst\[cm\] -y-coordinate of the particle w.r.t. the CCS
${\overrightarrow{E}}_{\text{first}}$

Zfirst\[cm\] -z-coordinate of the particle w.r.t. the CCS
${\overrightarrow{E}}_{\text{first}}$

VXfirst Vx/c-x-component of the particle velocity w.r.t. the CCS
${\overrightarrow{E}}_{\text{first}}$

VYfirst Vy/c-y-component of the particle velocity w.r.t. the CCS
${\overrightarrow{E}}_{\text{first}}$

VZfirst Vz/c- z-component of the particle velocity w.r.t. the CCS
${\overrightarrow{E}}_{\text{first}}$

Xdev\[cm\] - x-coordinate of the particle w.r.t. the device CCS
![](media/image20.wmf)

Ydev\[cm\] - y-coordinate of the particle w.r.t. the device CCS
![](media/image20.wmf)

Ydev\[cm\] - z-coordinate of the particle w.r.t. the device CCS
![](media/image20.wmf)

VXdev Vx/c- x-component of the particle velocity w.r.t. the CCS
![](media/image20.wmf)

VYdev Vy/c- y-component of the particle velocity w.r.t. the CCS
![](media/image20.wmf)

VZdev Vz/c- z-component of the particle velocity w.r.t. the CCS
![](media/image20.wmf)

Xc\[cm\] x-coordinate of the origin the CCS ![](media/image20.wmf)
w.r.t. the CCS ${\overrightarrow{E}}_{\text{first}}$

Yc\[cm\] y-coordinate of the origin the CCS ![](media/image20.wmf)
w.r.t. the CCS ${\overrightarrow{E}}_{\text{first}}$

Zc\[cm\] z-coordinate of the origin the CCS ![](media/image20.wmf)
w.r.t. the CCS ${\overrightarrow{E}}_{\text{first}}$

O(1,1) O~11~ transformation matrix element

O(1,2) O~12~ transformation matrix element

O(1,3) O~13~ transformation matrix element

O(2,1) O~21~ transformation matrix element

O(2,2) O~22~ transformation matrix element

O(2,3) O~23~ transformation matrix element

O(3,1) O~31~ transformation matrix element

O(3,2) O~32~ transformation matrix element

O(3,3) O~33~ transformation matrix element

A flag iflag_lost provides two features.

## 9. Acknowledgements

We appreciate very much the continuous help from B. Mustapha who
supports the UNIX version of TRACK. Many our colleagues contributed to
the code development. Particularly, the following subroutines were
developed with the help of our associates: a)the early version of the
code transform.exe - A.A. Kolomiets;

b\) the 3D Poisson solver - V.A. Moiseev (INR, Moscow-Troitsk),

c\) the parametrization of the stripper on the base of SRIM code - B.
Mustapha (ANL-PHY);

d\) the original version of automatic steering correction in transverse
phase space - E. Lessner (ANL-PHY).

The authors thank M. Sengupta for careful reading of the Manual.

## 10. References

1.  P. N. Ostroumov and K. W. Shepard, Correction of Beam Steering
    Effects in Low-Velocity Superconducting Quarter- Wave Cavities,
    Phys. Rev. ST. Accel. Beams **11**, 030101 (2001).

2.  V.A. Moiseev and P. N. Ostroumov. High Intensity Beam Dynamics in
    the Ion Linear Accelerators. Proc. of the 1998 European Part. Accel.
    Conf., EPAC98, Stockholm, p.1216.
    <http://accelconf.web.cern.ch/AccelConf/e98/PAPERS/THP10F.PDF>

3.  P.N. Ostroumov†, V. N. Aseev, B. Mustapha. Beam Loss Studies in
    High-Intensity Heavy-Ion Linacs. Phys. Rev. ST. Accel. Beams, Volume
    7, 090101 (2004).

# Appendix 1. Simulation of element misalignments and field errors

There are three groups of errors:

1)  Misalignment error is a displacement of the device as a rigid body.

2)  Field error is the field amplitude of the device.

3)  Error of the rf field phase.

A rigid body requires six independent coordinates to specify its
displacement. Usually a Cartesian set of coordinates (CSC) is fixed in
the rigid body and the body motion is defined by three shifts x, y, z of
the CSC origin and three angles x, y, z which specify the rotation axes
about the initial axes. In TRACK there are two equivalent sets of the
coordinates for each device: the entrance CSC and the exit CSC, Figure
1a.

![](media/image21.wmf){width="4.750694444444444in"
height="3.4159722222222224in"}

Figure 1a

A special set of the device coordinates is for providing equality of the
device entrance and exit CSC's. This set contains the device shifts
x~in~, y~in~ and z~in~ and a rotation angle z~in~ about the z-direction
of the entrance CSC ,and the device shifts x~out~, y~out~ and z~out~
w.r.t. exit SC,and rotation angle z~in~ about the z-direction of the
exit SC. The actual position of the device is uncertain within the given
tolerances (~x~, ~y~, ~z~, z). In TRACK we use the uniform distribution
of misalignments and randomly generate x~in~, y~in~, ... within the
given tolerance amplitudes (~x~, ~y~, ~z~, z).

A complete position of the misaligned device is determined by its
displacements x~in~, y~in~, z~in~ and the rotation angles x~in~, y~in~,
z~in~ w.r.t. the entrance CSC. Tolerances x and y can be estimated
as![](media/image22.wmf), where R is the distance between the origins of
the entrance and exit CSC. They are the upper boundaries for x, y (a
device with rectilinear optic axis has x=2~y~/R, y=2~x~/R). The set of
values {x~in~, y~in~, z~in~ x~in~, y~in~, z~in~ } unambiguously
determine the device displacements x~out~, y~out~, z~out~ and rotation
angles x~out~, y~out~, z~out~ w.r.t. the exit CSC as is seen from the
equations (A2-2)

One can obtain x~in~, y**~in~**, z~in~, x~in~, y~in~, z~in~ uniformly
distributed within their tolerances, calculate x~out~, y~out~, z~out~,
z~out~ and check conditions

\-~x~\<x~out~\<~x~, -~y~ \<y~out~\<~y~, -~z~ \<z~out~\<~z~,
-z\<z~out~\<z. (A1-1)

This procedure is continued until (A1-1) will be satisfied.

In this way a distribution function of each pair of the coordinates
(x~in~,x~out~), (y~in~,y~out~), (z~in~,z~out~), and (z~in~,z~out~) are
the same and the equality of the entrance and exit CSC are provided.

Below we present mathematical formalism to support our conclusions. Let
$\overrightarrow{E}$ and ![](media/image23.wmf) be vectors:

![](media/image24.wmf)

where
${\overrightarrow{e}}_{x},{\overrightarrow{e}}_{y},{\overrightarrow{e}}_{z}$
are basic unit vectors of an arbitrary Cartesian System of Coordinate
(CSC) w.r.t. "master" or accelerator hall coordinate system. Any vector
defined in CSC $\overrightarrow{E}$ is a scalar product
$\overrightarrow{r} = r^{T}\overrightarrow{E} = r_{x}{\overrightarrow{e}}_{x} + r_{y}{\overrightarrow{e}}_{y} + r_{z}{\overrightarrow{e}}_{z}$
where "T" means transpose. The entrance CSC
${\overrightarrow{E}}_{\text{in}}\ $, exit
CSC$\ {\overrightarrow{E}}_{\text{out}}\  = O{\overrightarrow{E}}_{\text{in}}$,and
vector $\overrightarrow{R} = R^{T}{\overrightarrow{E}}_{\text{in}}$-a
origin of the exit CSC w.r.t. entrance CSC are defined for any device as
is presented in Fig1. The 33 matrix O and R^T^ are defined by the device
setup. *O* is the 33 unit matrix and R^t^=(0,0,d_elem) is valid for the
devices with rectilinear central trajectory. For the dipole magnets one
can obtain the following matrix O and vector R:

![](media/image25.wmf)

The entrance CSC
${\overrightarrow{\overset{\sim}{E}}}_{\text{in}} = \Omega_{\text{in}}{\overrightarrow{E}}_{\text{in}}$
of the misaligned device is defined to be 33 rotation matrix ~in~ and a
shift vector **r~in~** as is seen in Fig 1a. The rotation

matrix $\Omega_{\text{in}} = \Omega_{x}\Omega_{y}\Omega_{z}$, where

![](media/image26.wmf)

For small angles the rotation matrix is

$\Omega \approx \left| \begin{matrix}
1 & \varphi_{z} & - \varphi_{y} \\
 - \varphi_{z} & 1 & \varphi_{x} \\
\varphi_{y} & - \varphi_{x} & 1
\end{matrix} \right|$.

Because the device is a rigid body, the matrix O and vector R^T^ have
the same numerical values for the unmoved and misaligned device:
${\overset{\sim}{E}}_{\text{out}} = O{\overset{\sim}{E}}_{\text{in}}\ \overrightarrow{\overset{\sim}{R}} = R^{T}{\overrightarrow{\overset{\sim}{E}}}_{\text{in}}$.

We can define a rotation matrix ~out~ and a shift vector **r~out~** for
exit CSC:

![](media/image27.wmf).

From the following equalities

$$![](media/image28.wmf)

One can obtain

$\ \Omega_{\text{out}} = O\Omega_{\text{in}}O^{- 1}\ ,\ r_{\text{out}}^{T} = (r_{\text{in}}^{T} + R^{T}\Omega_{\text{in}} - R^{T})Ο^{- 1}$
(A2-2)

Particle motion through the device starts in the plane z=0 of the
entrance CSC.

The particle position
${\overrightarrow{u}}_{0},u_{0}^{T} = (x_{o},y_{0},0)$ and velocity
${\overrightarrow{v}}_{0},v_{0}^{T} = (v_{\text{ox}},v_{\text{oy}},v_{0z})$
(see Fig.2a) are transformed from the entrance CSC
${\overrightarrow{E}}_{\text{in}}\ $to CSC
${\overrightarrow{\overset{\sim}{E}}}_{\text{in}}\ $ as

${\overset{\sim}{u}}_{0}^{T} = (u_{0}^{T} - r_{\text{in}}^{T})\Omega_{\text{in}^{- 1}}\ ,\ {\overset{\sim}{v}}_{0^{T}} = v_{0^{T}}\Omega_{\text{in}^{- 1}}$

Using the equation of motion in field free space

$\overset{\sim}{x} = {\overset{\sim}{x}}_{0} - {\overset{\sim}{x}}_{o}^{'}{\overset{\sim}{z}}_{0}\ ,\ \overset{\sim}{y} = {\overset{\sim}{y}}_{0} - {\overset{\sim}{y}}_{o}^{'}{\overset{\sim}{z}}_{0},\ {\overset{\sim}{x}}_{0}^{'} = \frac{{\overset{\sim}{v}}_{0x}}{{\overset{\sim}{v}}_{0z}}\ ,\ {\overset{\sim}{y}}_{0}^{'} = \frac{{\overset{\sim}{v}}_{0y}}{{\overset{\sim}{v}}_{0z}}$

the particle is transformed to the plane ${\overset{\sim}{z}}_{0} = 0$
of the entrance CSC
${\overrightarrow{\overset{\sim}{E}}}_{\text{in}}\ $.

![](media/image29.wmf){width="2.875in" height="2.0854166666666667in"}

![](media/image30.wmf){width="2.5in" height="2.2958333333333334in"}

Figure 1b Figure 1c

Then the particle is tracked through the device using the Lorenz
equations and arrives at the plane ${\overset{\sim}{z}}_{1} = 0$ of the
exit CSC ${\overrightarrow{\overset{\sim}{E}}}_{\text{out}}\ $. Let us
denote as
${\overrightarrow{\overset{\sim}{u}}}_{1},{\overset{\sim}{u}}_{1}^{T} = ({\overset{\sim}{x}}_{1},{\overset{\sim}{y}}_{1},0)$
the particle coordinate and velocity
${\overrightarrow{\overset{\sim}{v}}}_{1},{\overset{\sim}{v}}_{1}^{T} = ({\overset{\sim}{v}}_{1x},{\overset{\sim}{v}}_{1y},{\overset{\sim}{v}}_{1z})$
on this plane, Fig.2b. The transformation rule from of the exit CSC
${\overrightarrow{\overset{\sim}{E}}}_{\text{out}}\ $to the exit CSC
${\overrightarrow{E}}_{\text{out}}\ $ for the particle coordinate and
velocity is

$u_{1}^{T} = {\overset{\sim}{u}}_{1}^{T}\Omega_{\text{out}} + r_{\text{out}}^{T}\ ,\ v_{1}^{T} = {\overset{\sim}{v}}_{1}^{T}\Omega_{\text{out}}$.

Ultimately, particle is transported to the plane *z~1~=0* of the exit
CSC ${\overrightarrow{E}}_{\text{out}}\ $

according to the equations

$x_{1} = x_{1} - x_{1}^{'}z_{1}\ ,\ y = y_{1} - y_{1}^{'}z_{1},\ x_{1}^{'} = \frac{v_{1x}}{v_{1z}}\ ,\ y_{1}^{'} = \frac{v_{1y}}{v_{1z}}$

Misalignment errors are introduced in the file **sclinac.dat** by using
the element align. All devices of the type n downstream of the line
align experience position misalignments, phase and field errors within
the tolerances defined in the line align.

The errors and misalignments of the device are described by 10 randomly
generated numbers R~1~R~10~. Particularly, R~1~R~6~ define spatial
misalignments of the device, see below for more details.

x~in~ =~xy~\*R~1~ is the device displacement along x axis in the
entrance coordinate system;

y~in~ =~xy~\*R~2~ is the device displacement along y axis in the
entrance coordinate system;

z~in~ =~xy~\*R~3~ is the device displacement along z axis in the
entrance coordinate system;

~xin~ =~xy~\*R~4~ is the device rotation about x axis in the entrance
coordinate system;

~yin~ =~xy~\*R~5~ is the device rotation about y axis in the entrance
coordinate system;

~zin~ =~z~\*R~6~ is the device rotation about z axis in the entrance
coordinate system;

Phase and amplitude fast errors are described by the Gaussian
distribution with standard deviation =1.0 and truncated at the 3-level.
R~7~,R~8~, \|R~7,8~\| 3. The fast errors are known as jitter or dynamic
errors:

~j~\*R~7~ is the fast phase error of the device;

F~j~\*R~8~ is the fast field error of the device

R~9~ and R~10~ are uniformly distributed in interval \[-1,1\] and
defined static errors of the phase and amplitude of the rf field.

~s~\*R~9~ is the static phase error of the device.

F~s~\*R~10~ is the static field error of the device.

In each accelerator seed 10 random numbers R~1~R~10~ are generated for
each element defined in the file **sclinac.dat.** These data is stored
in the file **VRAND_nnn.dat**, where **nnn** is the total number of
accelerator seeds.

To start simulation of many seeds with errors the following steps should
be applied:

1)  In the **track.dat** file. Assign NRZ the number of required seeds,
    there are no misalignments for the first seed. Set iflag_corr=-1.
    Add the following lines;

> &correct
>
> partCorr=1
>
> &end

2)  Add lines with the element **align** in the **sclinac.dat** file.

##  A1.1 Main Cycle for generation of different accelerator seeds

Before simulation with errors, TRACK performs calculation for ideal
machine

without errors to define phase setting of the accelerator devices and
design

energy of the reference particle for each device. After the first run of
the whole machine without errors TRACK generates several samples of the
accelerator with error. Each seed (or sample of the accelerator with
error) have a number.

This number is included in the correction procedure output files names.
Usually, they are useful for comparison of the PC and multiprocessor
calculations.

Two parameters define the number of the seeds:

nrz (=1 by default) number of seeds in given run of the TRACK

nrz_min (=1 by default) number of the first seed in a given run of the
TRACK

The seeds have the numbers nrz_min÷nrz_min+nrz-1 in a given run.

***Note:***

Some seeds can have an error set that can result in unusual particle
motion and extra losses. It can take place due to the resonance motion
in the given set of fields or unsatisfactory work of the beam center
correction procedure. The flag iglag_vrand can be used for the error set
extraction and detailed investigation of such accelerator seed.

##### Examples:

1\) nrz_min=4, nrz=2, iflag_vrand=0. The randomly generated errors are
calculated for seeds ##4÷5 in a given run.

2\) nrz_min=4, nrz=2, iflag_vrand=1. The randomly generated errors are
calculated for seeds ##4÷5 in a given run. As a result of the run the
files **vrand_004.dat** and **vrand_005.dat** will be created.

3\) nrz_min=4, nrz=2, iflag_vrand=-1. Files **vrand_004.dat** and
**vrand_005.dat**

must be generated in some previous run and must exist in the directory
to run the code successfully. The seeds #45 are calculated with
previously generated errors.

# Appendix 2. Optimization of the corrector fileds

The accelerator (or beam line) can be divided into several "correction
sections", for correction of the spatial and angular beam center
displacement from the accelerator axis due to misalignements of the
elements.

Let us introduce the vectors

![](media/image31.wmf),

where f~x~(i)and f~y~(i) are actual and F~x~(i)and F~y~(i) are maximum
strength of the corrector number i. N~x~ and N~y~ are the number of the
x-correctors and y-correctors in a given section as is seen in Fig.
A2-1. This section is delimited by two first brackets as is shown in
Fig. A2-1. The beam steering algorithm can be implemented in "correction
sections", whereby N correctors and M monitors are related by the
following two sets of equations:

![](media/image32.wmf), (1)

where ![](media/image33.wmf) are beam center displacement at the
$\hat{i}$^th^ monitor.

![](media/image34.wmf){width="6.7243055555555555in"
height="2.107638888888889in"}

Figure A2-1.

Indexes *i* denote correctors, and 'covered' indexes $\hat{i}$ denote
monitors. Here ![](media/image35.wmf) are transfer functions from the
corrector i to the monitor $\hat{i}$. $\overrightarrow{B}$ denotes the
vector containing device parameters in the given section.

The test particle with coordinates ![](media/image36.wmf) at the
entrance of each correction section is used to evaluate the transfer
function. $\overline{W}$ is an average beam energy. Beam center,
![](media/image37.wmf), ![](media/image38.wmf), at the monitor number
$\hat{i}$ is calculated for special sets of the correctors' strengths

![](media/image39.wmf) (2)

The transfer functions are defined as

![](media/image40.wmf) (3)

![](media/image41.wmf) are beam position mesurament errors.

We can repeat calculations (or measurements with the real beam) with
other set parameters $\overrightarrow{\overset{\sim}{B}}$ (for example,
turn off the quad Q2 in Fig A2-1) and obtain the additional correction
equations

![](media/image42.wmf) (4)

We can rewrite equations (3) in matrix form
$(A + \Delta A)f = - (b + \Delta b)$, where transfer matrix
$A + \Delta A\ \text{is}\ 2M \times (N_{x} + N_{y})$ rectangular matrix
and equals to

![](media/image43.wmf) (5)

In equation (5) transfer matrix and right hand vector are divided into
two parts. A and b are calculated without beam position measurement
errors (![](media/image44.wmf)). A and b are random numbers because of
the devices' field errors and finite accuracy of the monitors. To find
the correctors' strengths we minimize over the vector *f* the function

![](media/image45.wmf) with restrictions ![](media/image46.wmf), (6)

where *w~i~* is the 'weight' of the $\hat{i}$^th^ monitor. Usually
*w~i~* is equal to the standard

deviation of the measurament errors of the monitor. The residual beam
desplacement on the $\hat{i}$^th^ monitors after correction is nonzero
and equals to

$\delta_{i} = - b_{i} + \sum_{k = 1}^{N_{x} + N_{y}}A_{\text{ik}}f_{k}$

We estimate the quality of the given correction procedure by solving (6)

*Nr* times with monitor errors ![](media/image47.wmf) uniformly
distributed in the interval ![](media/image48.wmf). The correlation
matrix for the correctors' strength is

![](media/image49.wmf)

and for residual beam positions on monitors is

![](media/image50.wmf).

Abnormal value ![](media/image51.wmf) where *F~i~* is the maximum
strength of the i^th^ corrector or ![](media/image52.wmf) gives warning
of possible difficulties of the given correction procedure.

Useful information about the solution of the matrix A can be obtained
from the covariance matrix of the set of solutions f~n~ for randomly
defined matrix A~n~=A+ΔA~n~ and right-hand side b+b~n~ for N samples of
the correction equations.

The code TRACK provides four possibilities depending on parameter MonErr
for calculations of the covariance matrix C. For each seed, the devices
are misaligned and their phases and field amplitudes are deviated from
the nominal values. The set of particles npatC(iq),iq=1,nqtot, where
npatC(iq)≤npat(iq), is transported through the correction section to
calculate the vector b and the beam with zero transverse and
longitudinal emittances is transported through the section Neq times.
Each time only one corrector is on (remember, that the device corr
define simultaneously two correctors), the first deflects the beam in
the horizontal plane and the second - in the vertical plane. The
correctors' strength F~i~ for the correction matrix calculation is equal
to ThetaH or Bymax.

1)  MonErr=1 (by default). In each seed erros and misalignemnets are
    generated for each device and BPMs measure beam position in each
    monitor. Matrix A~n~ and b~n~ are defined in each seed with the
    errors of the devices position and field errors, in this case
    Δ*b*=0.

2)  MonErr=0 beam experiences errors only due to the device
    misalignments and field errors, in this case Δ*b*=0 (no measurement
    errors)

3)  MonErr \>1 The matrix A and b are calcualted including randomly
    generated monitor errors ![](media/image53.wmf) with uniform
    distribution in the interval ![](media/image54.wmf) *i=1,Nmon*. The
    minimization problem (6) is solved M=MonErr times for different sets
    of the monitor errors.

![](media/image55.wmf)

![](media/image56.wmf)

![](media/image57.wmf)

Efficiency of the correction procedure is determined by the condition
number of the transfer matrix A. The large condition number indicates
that small changes in A and b can lead to large changes in the solution
*f.*

# Appendix 3. Acceptance calculation

The code allows one to generate both transverse and longitudinal
acceptance of the accelerating-focusing system. The acceptance picture
at the beginning of the accelerator or transport system can be obtained
as an area in the phase space occupied by survived particles which are
tracked to the end of the system defined in the file **sclinac.dat**. To
simulate acceptance two flags either iaccep=1 for the longitudinal
acceptance or iflag_tac=1 for the transverse acceptance are used (see
the description of the file **input.dat**). As a result two files
**accep.dat** and **negative.dat** are generated. The coordinates of the
survived particles are stored in **accep.dat**. Coordinates of the lost
particles are stored in **negative.dat**. Options iaccep=1 and
iflag_tac=1 don't work together.

For the acceptance calculations NRZ in the **input.dat** file must be
equal to 1. The output data can be processed using EXCEL or ORIGIN to
produce the acceptance picture. Acceptance calculation in one transverse
phase space usually should be done with negligible emittance in another
transverse plane.

# Appendix 4. Potential expansion in a multi-cell RFQ

A Radio Frequency Quadrupole accelerator can be separated into three
functional sections:

1\) A regular bunching or accelerating section.

2\) A transition cell between the radial matcher and regular cell.

3\) Entrance and exit radial matchers.

For the beam dynamics simulation in the TRACK code we assume
electrostatic approximation of the fields. The RFQ fields can be
inserted into the code by using numerical 3D tables and/or by using the
coefficients of Fourier-Bessel expansion of the electrostatic potential
in each cell. The design of the vane profile must be known and an
external code must be used to generate 3D fields in the RFQ sections and
cells. Usually we use the code DESRFQ \[1\] which is available through
contact to Dr. A.A. Kolomiets (ITEP, Moscow). Also the PARMTEQ code of
LANL can be used to generate TRACK input files.

The transverse cross-section of the vanes has a shape shown in Fig.
A4-1. We assume that the regular RFQ cells are sinusoidally shaped:

![](media/image58.wmf), (1)

where *a* and *ma* are the minimum and maximum distance of the vane tips
wrt the z-axes, *x~t~* and *y~t~* are the coordinates of the horizontal
and vertical vanes, ![](media/image59.wmf){width="3.296527777777778in"
height="3.4902777777777776in"}

![](media/image60.wmf) is the average radius of the vanes and *L* is the
cell length as shown in Fig.
A4-2.![](media/image61.wmf){width="2.8569444444444443in"
height="3.202777777777778in"}

## A4.1 Regular accelerating cells

In the TRACK code we assume that the cell begins at the point where the
vane tips have exact quadrupole symmetry as is shown in Fig. A4-2. As
usual, we assume that the parameters a,m,L are varied slowly along the
RFQ and the potential in a regular cell can be found applying a mirror
symmetry wrt the xy-plane at the beginning and the end of cell. Let's
assume z=0 at the center of the cell then the potential function
satisfies symmetry conditions which can be written in cylindrical
coordinates as:

\` $\begin{array}{r}
 \\
 \\

\end{array}$$\begin{array}{r}
U(r, - \vartheta,z) = U(r,\vartheta,z)\  \\
U(r,\frac{\pi}{2} + \vartheta,z) = - U(r,\frac{\pi}{2} - \vartheta,z) \\
U(r,\vartheta, - z) = U(r,\vartheta,z) \\
U(r,\vartheta + \frac{\pi}{2},L - z) = - U(r,\vartheta,z)
\end{array}$ (2)

The potential is:

$\begin{array}{r}
U(r,\theta,z) = \frac{|V|}{2}\sum_{m = 0}^{\infty}\left\{ A_{0,2m + 1}( \middle| \middle| \frac{r}{R_{0}})^{2(2m + 1)}\text{cos}\lbrack 2(2m + 1)\theta\rbrack + \middle| \middle| \middle| \middle| \ \sum_{n = 1}^{\infty}{A_{2n,2m + 1}\ }I_{2(2m + 1)}(2\text{nkr})\ \text{cos}\lbrack 2(2m + 1)\theta\rbrack\ \text{cos}(2\text{nkz}) + \middle| \middle| \ \sum_{n = 1}^{\infty}A_{2n - 1,2m}I_{4m}\lbrack(2n - 1)\text{kr}\rbrack\text{cos}(4m\theta)\text{cos}\lbrack(2n - 1)\text{kz}\rbrack \right\} \\

\end{array}$ (3)

The potential expansion in a regular RFQ cell with an accuracy of the
order *r^7^* contains eight terms:

$\begin{array}{r}
U(r,\theta,z) \approx \frac{|V|}{2}\left\lbrack A_{\text{01}}(\frac{r}{r_{0}})^{2}\text{cos}(2\theta) + A_{\text{10}}I_{0}(\text{kr})\text{cos}(\text{kz}) \right\rbrack + \\
\frac{|V|}{2}\lbrack A_{\text{03}}(\frac{r}{r_{0}})^{6}\text{cos}(6\theta) + A_{\text{21}}I_{2}(2\text{kr})\text{cos}(2\theta)\text{cos}(2\text{kz}) + A_{\text{12}}I_{4}(\text{kr})\text{cos}(4\theta)\text{cos}(\text{kz}) + \\
\ A_{\text{30}}I_{0}(3\text{kr})\text{cos}(3\text{kz})\text{++}A_{\text{23}}I_{6}(2\text{kr})\text{cos}(6\theta)\text{cos}(2\text{kz}) + A_{\text{32}}I_{4}(3\text{kr})\text{cos}(4\theta)\text{cos}(3\text{kz})\rbrack
\end{array}$(4)

In the TRACK code, the line in the input file **RFQ.#nn** for regular
RFQ cell may contain thirteen parameters

$\left\{ \beta,T,\kappa,a,L,\text{index},A_{\text{21}},A_{\text{12}},A_{\text{30}},A_{\text{03}},A_{\text{23}},A_{\text{32}},\text{eh}_{\text{EM}}\text{.} \middle| \middle| \text{nn} \right\}$,
(5)

where *=v/c* is the reference particle velocity at the exit of the cell,
*T=A~10~/4, =a^2^A~01~,index=0*. First six parameters in this line
define two-term potential approximation (A~01~0, A~10~0). The first
column is used only for the graphic outputs and does not effect on
particle tracking.

Six parameters A~mn~ and the file name eh_EMS.#nn are optional. By
default all 6 coefficients A~mn~ are equal to zero. These coefficients
must be defined by an external code for the given design of the RFQ if
one likes to track particles in 8-term potential. If the file name
eh_EMS.#nn is appeared in the line, the field in the cell must be given
as a 3D table field in the file eh_EMS.#nn. In this case TRACK reads
file eh_EMS.#nn and uses this field to interpolate for trajectory
integration.

The command line in the sclinac.dat file

1 prmtr ncoef=k~01~ k~10~ k~21~ k~12~ k~30~ k~03~ k~23~ k~32~

is used to turn off the effect of each term in series (4). By default
all coefficients k~mn~ are equal to 1. Defining k~mn~=0 one can make
A~mn~ =0 for all regular cells even if these coefficients are not equal
to zero in the line (5) in the **sclinac.dat** file.

A period of modulation with the length 2L consist of two cells. For
certainty, we assume the vane tip in horizontal plane in the center of
*n-*th cell is at the maximum and the vane tip in the vertical plane is
at the minimum wrt the z-axis. In the *(n+1)*-cell the location of H-
and V-vane tips wrt the z-axis is opposite. For each cell, the potential
expansion is performed assuming that the center of z-coordinate is
located in the center of cell and H-vane tip reaches its minimum
distance wrt the z-axis. Usually RFQ begins with the radial matcher
which does not have any modulation. The first RFQ cell with modulation
has maximum distance of the vane tip from the z-axis in horizontal plane
at the center of the cell. In order to reverse this condition, one
should define vane=-1 in the line

n rfq .....

## A4.2 Transition cell

Transition cell is the cell between two sections of the RFQ with
non-adiabatic change of modulation. For example, a cell between the
uniform section of the RFQ without any modulation and the section with
modulation is the transition cell. In the transition cell the potential
function satisfies symmetry conditions:

$$$\begin{array}{r}
U(r, - \theta,z) = U(r,\theta,z) \\
U(r,\frac{\pi}{2} - \theta,z) = U(r,\frac{\pi}{2} + \theta,z)
\end{array}$ (6)

The potential can be expanded into series

$U(r,\theta,z) = \frac{|V|}{2}\sum_{m = 0}^{\infty}{\ \sum_{n = 0}^{\infty}{B_{2m\ ,2m + 2n}(z)\ }}r^{2m + 2n}\text{cos}(2m\theta)$
(7)

with recursive relation between the series coefficients:

$B_{2m,2m + 2n + 2} = \frac{1}{(2m)^{2} - \lbrack 2m + 2n + 2\rbrack^{2}}B_{2m,2m + 2n}^{''}(z)$
(8)

The field distribution in the transition cell is essentially three
dimensional. To define transition cell fields in TRACK, we use 3D field
tables obtained from EM Studio. Also, an analytical field expansion in
the transient cell is available in TRACK with an accuracy of order r^3^

$U(r,\vartheta,z) = B_{\text{00}}(z) - \frac{1}{4}B_{\text{00}^{''}}(z)\ r^{{}^{2}} + B_{\text{22}}r^{2}\text{cos}2\vartheta$
(9)

Vane tip profiles and potential expansion in the transition cell between
modulated and unmodulated vanes has been discussed by K. Crandall \[2\].
K. Crandall divides transition cell into two sections as is shown in
Fig. A4-3. In the first section where -L/2\<z\<0, the vane tip
modulation is similar as in a regular accelerating cell. At z\>0 the
vane modulation is given by the expression:

$\begin{array}{r}
x_{t} = r_{0} + (\text{ma} - r_{0})\ \text{Cr}(\text{Kz}) \\
y_{t} = r_{0} + (\ a - r_{0})\ \text{Cr}(\text{Kz})\ 0 \leq z \leq L^{'} \\
\text{Cr}(\text{Kz}) = \frac{3}{4}\text{cos}\frac{\text{Kz}}{2} + \frac{1}{4}\text{cos}\frac{3\text{Kz}}{2}\ 
\end{array}$ , (10)

where $K = \frac{\pi}{L^{'}}\ L^{'} = \sqrt{0\text{.}\text{75}}\ L$. In
ref. \[2\] it is proposed to provide continuity of the functions x~t~(z)
and y~t~(z) and its first and second derivatives in the points of
conjugation at z=0 and z=L^'^ as is shown in Fig. A4-3. If the vane
modulation is given by (10), a good approximation to the expansion
coefficients in the expression (9) is:

$\begin{array}{r}
B_{\text{00}} = A_{\text{10}}\text{cos}(\text{kz})\ ,\  - \frac{L}{2} < z < 0 \\
B_{\text{00}} = A_{\text{10}}\text{Cr}(\text{Kz})\ ,\ 0 < z < L^{'} \\
B_{\text{22}} = \frac{A_{\text{01}}}{r_{0}^{2}}\ ,\  - \frac{L}{2} < z < L^{'}
\end{array}$ (11)

where A~01,~ A~10~ are the expansion coefficients of the series (4) for
the regular cell with the parameters a,m,L,r~e~. Fig. A4-4 shows the
longitudinal electric field obtained from numerical calculations with EM
Studio and analytical expansion (9).

![](media/image62.wmf){width="2.782638888888889in"
height="3.4590277777777776in"}![](media/image63.wmf){width="3.15625in"
height="2.6972222222222224in"}

In the RFQ for ISAC at TRIUMF a sinusoidal modulation of the vanes for
z\>0 has been applied \[3\]:

$\begin{array}{r}
x_{t} = \frac{r_{0} + a}{2} + \frac{r_{0} - a}{2}\text{cos}(\frac{\pi\ z}{L})\  \\
y_{t} = \frac{r_{0} + \text{ma}}{2} + \frac{r_{0} - \text{ma}}{2}\text{cos}(\frac{\pi\ z}{L})\ 0 < z < L
\end{array}$.

The line in the input file **RFQ.#nn** for transient RFQ cell may
contain seven parameters

$\left\{ \beta,T,\kappa,a,L_{T},\text{index},\text{eh}_{\text{EM}}\text{.} \middle| \middle| \text{nn} \right\}$,
(12)

where *index=2* is for the entrance transition cell and *index=-2* is
for the exit transition cell and
$L_{T} = (0\text{.}5 + \sqrt{0\text{.}\text{75}})L$. Parameter
eh\_\_EM.#nn appears if 3D-table of the electric field obtained from EM
studio code will be used.

## A4.3 Entrance and exit radial matchers

In radial matcher section (RMS) the potential function has symmetry
planes x=0, y=0, x=y and satisfies the symmetry conditions:

$$$\begin{array}{r}
U(r, - \theta,z) = U(r,\theta,z) \\
U(r,\frac{\pi}{2} - \theta,z) = U(r,\frac{\pi}{2} + \theta,z) \\
U(r,\frac{\pi}{2} - \theta,z) = - U(r,\theta,z)
\end{array}$ (13)

The potential can be expanded into the series

$U(r,\theta,z) = \frac{|V|}{2}\sum_{m = 0}^{\infty}{\ \sum_{n = 0}^{\infty}{B_{2(2m + 1)\ ,2(2m + 1) + 2n}(z)\ }}r^{2(2m + 1) + 2n}\text{cos}\lbrack 2(2m + 1)\theta\rbrack$
(14)

with recursive relation

$B_{2(2m + 1),2(2m + 1) + 2n + 2} = \frac{1}{\lbrack 2(2m + 1)\rbrack^{2} - \lbrack 2(2m + 1) + 2n + 2\rbrack^{2}}B_{2(2m + 1),2(2m + 1) + 2n}^{''}(z)$
. (15)

With the accuracy of r^7^ as in a regular cell, the potential expansion
in the RMS is

$U(r,\theta,z) = \frac{|V|}{2}B_{\text{22}}\left\lbrack g(z)r^{2} - \frac{g^{''}(z)}{\text{12}r_{0}^{2}}r^{4} + \frac{g^{(4)}(z)}{\text{384}r_{0}^{4}}r^{6} \right\rbrack\text{cos}2\theta + \frac{|V|}{2}B_{\text{66}}s(z)r^{6}\text{cos}6\theta$
(16)

Where B~22~ =*A*~01~/r~0~^2^ and B~66~ =*A*~03~/r~0~^6^, *A*~01~ and
*A*~03~ is the expansion coefficients of the series (???) for the cell
without modulation. Let's assume z=0 at the beginning of the RMS. The
functional form of a falloff function g(z) is

$g(z) = \begin{array}{r}
\left\{ 1\ 0 \leq z < L_{1} \middle| \right.\ \left\{ \overset{\sim}{g}(z)\ L_{1} \leq z \leq L_{1} + D \middle| \right.\ 
\end{array}$ (17)

Where L~m~ is the RMS length. As a $\overset{\sim}{g}(z)$ one can use

$\overset{\sim}{g}(z) = (z - L_{1}\frac{)}{D}$, linear function (18)

$\overset{\sim}{g}(z) = \frac{3}{4}\text{cos}\left\lbrack \frac{\pi(z - L_{1})}{2D} \right\rbrack + \frac{1}{4}\text{cos}\left\lbrack \frac{3\pi(z - L_{1})}{2D} \right\rbrack$,
Crandall function \[2\] (19)

$\overset{\sim}{g}(z) = 0\text{.}5\lbrack 1 + \text{cos}\left\lbrack \pi(z - L_{1}\frac{)}{D} \right\rbrack$,
sinusoidal ramp \[3\] (20)

For the falloff function one can define two parameters: effective length
of the field falloff and effective length of the transition region:

$\ H_{\text{eff}} = \int_{0}^{L_{m}}{g(z)\text{dz}},\ D = \frac{1}{\left| g^{'}(z_{D}) \right|}\ $,
(21)

where z~D~ is defined as a solution of the equation $g^{''}(z_{D}) = 0$.

Let's define the vane tip profile in the RMS as

$x_{t}(z) = y_{t}(z) = \frac{r_{0}}{\sqrt{g(z)}}\ 0 \leq z \leq z_{V}$,
(22)

where z~v~ is the endpoint of the vanes. If the condition
$x_{t}(z_{V}\frac{)}{r_{0}} = \frac{1}{\sqrt{g(z_{V})}}\  \geq 5$ is
satisfied, the falloff function behavior does not depend from the
location of the point z~V~.

Fig. A4-5 and A4-6 show different falloff functions and vane profiles
calculated by the expression (22) at the same values of parameters
H~eff~ and D~eff~ for x~t~(z~v~)=8. The vane profiles to produce the
falloff functions (19) and (20) have smoother field transition compared
with the low (1). Once there is no significant difference between
falloff functions (19) and (20), in the TRACK code we use the sinusoidal
ramp (20) for the analytical representation of the field in the entrance
and exit RMS.![](media/image64.wmf){width="2.786111111111111in"
height="2.2583333333333333in"}

The RMS described by the expression (22) and (20) has been simulated by
EM Studio which shown that the Fourier expansion of the numerically
calculated potential reproduces the analytical as is shown in Fig. A4-7.

![](media/image65.wmf){width="2.7847222222222223in"
height="2.373611111111111in"}

The line in the input file **RFQ.#nn** for RMS may contain 11 parameters

$\left\{ \beta,H_{\text{eff}},D_{\text{eff}},r_{0},L_{M},\text{index},A_{\text{01}},A_{\text{03}},k_{H},k_{D},\text{eh}_{\text{EM}}\text{.} \middle| \middle| \text{nn} \right\}$,
(23)

where H~eff~ ,D~eff~ - effective length and the effective transient
length of the quadrupole field component, L~1~=H~eff~-D~eff~/4,
D=D~eff~/2, see equation (9)

*A*~01~, *A*~03~ are the expansion coefficients of the series (2) for
the unmodulated cell, k~H~ (=1 by default, optional)--correction
coefficient for the effective length, of the duodecapole field
component, k~V~ (=1 by default, optional)--correction coefficient for
the effective transient length of the duodecapole component, *index=1*
for the entrance transient cell and *index=-1* for the exit. Parameter
eh\_\_EM.#nn is optional. Appearance of the parameter em_EM.#nn in cells
description string means that TRACK uses the 3D-table field
approximation for this transition cell.

The code **MWS_read.exe** with input.dat file as defined below

&fasa

device=\'RFQM\'

r_fourier=.6

Vf=1

file_MWS_e=\'cellM.dat\',

file_MWS_h=\'empty\',

key_1_e=1, key_2_e=1, key_3_e=0,

aperture=2\*r0

d_device=L~M~

z_device=

&end

produces a line (23) for given input 3D-table cellM.dat.

## ![](media/image66.wmf){width="3.046527777777778in" height="2.6125in"}

## 

## 

## 

## 

## 

## 

**References**

A4-1. A.A. Kolomiets, T.E. Tretjakova and S.G. Yaramishev. DESRFQ -- a
code for Generation of Radio Frequency Qudarupole. ITEP report, 2001.

A4-2. K. R. Crandall Effects of Vane-Tip geometry on the Electric Fields
in Radio-Frequency Quadrupole Linacs. Technical report LA-9595, LANL,
April 1983.

A4-3. L. Root. TRIUMF report. 1996.

# Appendix 5. Particle simulation in dipole magnets

Four coordinate systems (CS) are used for the dipole: an entrance CS
(X~in~,Z~in~), an exit CS (X~out~,Z~out~), an entrance fringe field CS
(X~1~,Z~1~ ) and an exit fringe field CS (X~2~,Z~2~ ). Axis Z~1~ is
normal to the entrance effective field boundary. Axis Z~2~ is normal to
the exit effective field boundary. The positive Y direction is out of
the page, see Fig. A5-1. TRACK sign convention for parameters is
identical to the sign convention in the TRANSPORT code. \>0 means
rotation of the beam direction clockwise about positive Y axis. Positive
~1~, ~2~ imply transverse focusing i. e. focusing in YZ plane. Positive
R~1~, R~2~ (convex curvature) represent negative sextupole components.
On Fig. A5-1 \>0 , ~1~\>0 , ~2~\<0, R~1~\>0 , R~2~\>0 .

The central trajectory is defined using the "hard edge" approximation as
a straight line, a circular arc and another straight line. There is no
particle moving along this trajectory in realistic field. As a central
trajectory we use the trajectory which coincides with the circular arc
inside the dipole, see Fig. A5-2. We also suggest that the beam enters
the dipole along Z~in~ --axis and exit along Z~out~ --axis. To provide
these conditions, the dipole is artificially moved x=-xcr1 and z
=-xcr2/sin() w.r.t. the entrance coordinate system (X~in~, Z~in~). XCR1
and XCR2 are parallel shifts of the realistic central trajectory w.r.t.
the hard edge central trajectory at entry and exit fringe fields
respectively \[A5-1, A5-2\]. The code TRACK evaluates XCR1 and XCR2 and
shifts the dipole automatically.

TRACK dipole aperture is a curvilinear tube with the rectangular cross
section. The shape of the tube is defined in Fig. A5-3. The vacuum tube
has finite thickness and it is taken into account by the parameter ~1~
(~1~=0.9 by default).

#### ![](media/image67.wmf){width="4.549305555555556in" height="3.2625in"}

Fig. A5-1: Definition of dipole parameters in the TRACK code.

![](media/image68.wmf){width="4.877083333333333in"
height="3.592361111111111in"}

Fig. A5-2: The reference particle (central) trajectory.

#### ![](media/image69.wmf){width="5.999305555555556in" height="3.1486111111111112in"}

Fig. A5-3. The dipole aperture.

The element bmag is a dipole magnet with the homogenous magnetic field
in the central region of the magnet and rounded pole tip edges. Due to
rounded pole shape (see Fig A5-1), only the field components B~y~(0,y,z)
and B~z~(0,y,z) are needed for the field calculations in the fringe
field regions. We use the Enge type function E(z) for magnetic field
falloff at the dipole edges {A5-5, A5---6\], see Fig. A5-4.

![](media/image70.wmf) (A5-1)

![](media/image71.wmf) (A5-2)

The entrance fringe field covers an interval from z11=-~2~g to
$z\text{12} = w\text{sin}(\left| \beta_{1} \right|) + d\text{cos}(\beta_{1})$
and the exit fringe field covers an interval

from z21=-~2~g to
$z\text{22} = w\text{sin}(\left| \beta_{2} \right|) + d\text{cos}(\beta_{2})$.

2D field tables are also available for the bmag fringe fields
evaluation. These tables have to be defined on a rectangular grid
{0≤y≤g/2, z11≤z≤z12} for

enrance fringe field and on a rectangular grid {0≤y≤g/2, z21≤z≤z22} for
the

exit fringe field,see Fig. A5-5B

The codes "TRANSPORT" \[A5-1\] and "TRACE-3D" \[A5-2\] use the parameter

$k1 = \frac{\int_{z\text{11}}^{z\text{12}}{E(z)(1 - E(z))\text{dz}}}{z\text{12} - z\text{11}}$
(A5-3)

the code "GIOS" \[A5-3\] uses the function E(z),and the code "RAYTRACE"
\[A5-4\] uses 2D tables with B~y~(x,0,z) for fringe field description.

The momentum p of the reference particle, magnetic field Bf in the
uniform region, and k1, xcr1, xcr2, x11, z11, x12, z12, x21, z21, x22
and z22 are the output parameters of the TRACK code.

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*This
section is the description of the element "dipo". Currently it is under
development.

The "dipo" is a dipole with the homogenous field or field with a field
gradient inside the magnet (the uniform field region in the element
"bmag"). The field expansion in the median plane is given by:

![](media/image72.wmf), (A5-4)

where ρ is the distance between the point and the curvature center of
the layout circular arc (see fig. A5-1). 2D tables are used for the
definition of the magnetic field in the fringe field regions. These
tables are defined in the Cortesian coordinates, see Fig.
A5-4,{-xmax≤x≤xmax, zmin≤z≤zmax}, where xmax = max(x11,x12,x21,x22), for
the entrance and exit fringe fields. The y-component of the magnetic
field B~y~(x,0,z) is given on the median plane.

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

![](media/image73.wmf){width="5.370138888888889in"
height="4.388888888888889in"}

Fig. A5-4. Fringe fields extension in the median plane.

####  

#### ![](media/image74.wmf){width="5.99375in" height="1.979861111111111in"}

####  a) b)

#### 

Fig. A5-5. Fringe fields extension in the {y,z} plane.

**References**

\[A5-1\] K.L. Brown, The ion optical program TRANSPORT. Technical Report
91, SLAC, 1979.

\[A5-2\] K.R. Crandall, TRACE 3-D Documentation, Report LA-11054-MS, Los
Alamos, 1987.

\[A5-3\] H. Wollnik, J. Brezina and M. Berz, Nucl. Instr. and Meth. A
258 (1987) 408.

\[A5-4\] S. Kowalsky and H.A. Enge, RAYTRACE, MIT Report, Cambridge,
Massachusetts, July 1, 1987.

\[A5-5\] H.A. Enge, Rev. of Sci. Instr, **34,** 385 (1964)

\[A5-6\] H.A. Enge, Rev. of Sci. Instr, **35,** 278 (1964)

## A5.1 Structure line for the element "rounded DIPOLE"

amu= 931.49432d3\[keV/u\]

W is the kinetic energy per nucleon

Q is the ion charge

A is the ion mass

=1+W/amu, $\beta = \sqrt{1 - \frac{1}{\gamma^{2}}}$
p\[GeV/c\]=10^-6^amu/(Q/A)
$B_{f}\lbrack\text{kG}\rbrack = \frac{0\text{.}\text{3107131}\text{βγ}}{\rho\lbrack\text{cm}\rbrack(\frac{Q}{a})}$

### 0 bmag L g w ~1~ ~2~ 1/ R~1~ 1/R~2~ nstep 

The input file for the same element in the code **TRANSPORT**

\' DIPOLE \'

0

15\. 1. \'mm\' 0.1 ;

15\. 5. \'mm\' 0.1 ;

15\. 6. \'P/10\' 0.1 ;

1\. 0. 0. 0. 0. 0. 0. p ;

17\. \'2ND \' ;

16\. 5. w/2 ;

16\. 5. g/2 ;

16\. 7. k1 ;

16\. 8. 0. ;

16\. 12. 1/R~1~ ;

16\. 12. 1/R~2~ ;

20\. 180. ; (if \<0)

3\. d=0.5(L- \|\| ) ;

2\. ~1~ ;

4\. \|\|, Bf 0.0 \'BMAG\' ;

2\. ~2~;

3\. d=0.5(L- \|\| ) ;

20\. -180. ; (if \<0)

SENTININEL

# Appendix 6. Creation of user defined initial distribution.

Frequently it is useful to start the simulation with the existing
particle distribution, not from the initial distribution generated
inside the code. A particular example is the simulation of the SC linac
with the initial distribution obtained from TRACK or another code by
simulation of the elements located upstream of the SC linac. For beam
loss simulation on the SC linac it is preferable to start with the
distribution formed in the RFQ. For this and similar cases we have
developed a possibility to write a file with the information of total
charge states nqtot, average energy Wtmp \[keV/u\], number of particles
of each charge state npat(ird), charge states qq(ird) and 6 coordinates
of each particle. The maximum size of the particle coordinates is
usually 0:500000, however, it can be larger for specific cases. The
particle phase csi(i,iq) is in radians at the fundamental frequency of
the accelerator or front end that was used for generation of the
distribution.

Example: In the front end of the RIA driver linac there is MHB operating
at 28.75 MHz therefore the simulation starts with fundamental frequency
28.75 MHz. The particle distribution is written into the file after the
RFQ which operates at 57.5 MHz. Before writing into the file the array
is reduced to 28.75 MHz by dividing the array elements by harmonic
number which is 2 in this case.

The following text is the excerpt from the FORTRAN program which shows
format of the file.

if (iwrite_dis.eq.1) then

open(1, file=\'read_dis.dat\', status=\'unknown\'

& ,access=\'SEQUENTIAL\',form=\'UNFORMATTED\')

write(1) Wtmp,nqtot

write(1) (npat(ird),ird=1,nqtot)

write(1) (qq (ird),ird=1,nqtot)

do iq = 1,nqtot

do i = 0,npat(iq)

write(1) x(i,iq) , xx(i,iq) , y(i,iq) , yy (i,iq),

& csi(i,iq)/harm0, bb (i,iq) , spin(i,iq)

enddo

enddo

close(1)

endif

Units:

x(i,iq)\[cm\], xx(i,iq)\[rad\], y(i,iq)\[cm\], yy(i,iq) \[rad\],
csi(i,iq) \[rad\],

bb(i,iq) \[relative velocity\] , spin(i,iq) \[1.d0 if particle is within
the acceptance of the following system, otherwise =-1d0\]

To write a file with the particle distribution at the end of simulation
the flag iwrite_dis=1.

Reading of the particle distribution will be done with the initial flag
iread_dis=1.

By default these flags are equal to 0.

The following steps are necessary to provide correct simulation with the
initial distribution which is read from the file **read_dis.dat**:

1.  Make **track.dat** file assuming that the simulation starts with the
    internally generated distribution.

2.  Be sure that files **track.dat** and **sclinac.dat** are compatible
    to start the simulation with fundamental frequency that was used for
    the phases in the file **read_dis.dat**.

3.  In the **"INDEX"** section of the **track.dat** file set
    iread_dis=1.

4.  Be sure that file **read_dis.dat** exists in the directory where all
    files related to the **TRACKv35.exe** code are located.

5.  Check flag isol. For hard edge solenoids **isol=0**. Check parameter
    **current=0** for zero space charge calculations. Set
    **iflag_dis=1** for bunched beam structure, not for dc beam.

# Appendix 7. A short manual for longitudinal corrections using TRACK

A correction section should be bracketed between two \'cdump\' commands
with the same index number \'n\'. The index number \'n\' refers to the
number of the correction section; the first is 1, the second is 2, \...

An example of a correction section is given below

n cdump

..

..

.. here is the regular lattice

..

..

..

phcor i1 i2 r1 r2

n cdump

The command \'phcor\' is the actual correction command, it should be
bewteen two \'cdump\' commands of the same index. The arguments of the
command \'phcor\' are:

i1: energy correction flag:

i1=0 No correction;

i1=1 correction using the reference charge state average energy;

i1=2 correction using the multiple charge state beam average energy.

i2: phase correction flag:

i2=0 No correction;

i2=1 correction using the reference charge state average phase;

i2=2 correction using the multiple charge state beam average phase.

r1: energy correction residual error in %

r2: phase correction residual error in deg

[^1]: ^1^ This work is supported by the U. S. Department of Energy,
    Office of Nuclear Physics, under contract No. DE-AC02-06CH11357.

[^2]: The version of TRACKv37 for multiprocessor platform operating on
    LINUX has been also developed.

[^3]: In this write-up the term "device" and "beam-line element" are
    equivalent.

[^4]: LINUX version of the TRACKv37 exists and the Manual is being
    written.