IMPACTlayer.doc


!----------------------------- COPYRIGHT -----------------------------------
!    IMPACT: Integrated Map and Particle Accelerator Tracking Code
!
!                     Lawrence Berkeley National Laboratory
!                             Mailstop 71J
!                         Berkeley, CA 94720, USA
!
!(c) Copyright, 2000 by the Regents of the University of California.
!
!This software was produced under U.S. Government contract 
!by Lawrence Berkeley National Laboratory, which is operated by the University
!of California for the U.S. Department of Energy.  Neither the Government
!nor the University makes any warranty, express or implied, or assumes
!any liability or responsibility for the use of this software.
!
!Unpublished -- rights reserved under Copyright Laws of the United States.
!--------------------------------------------------------------------------
------------
VERSION: 1.2
------------
AUTHORS
------------
Ji Qiang, Rober D. Ryne and Salman Habib
Ms 71 J, AFTD
1 cyclotron Rd.
Lawrence Berkeley National Laboratory
Berkeley, CA 94720
Email: jqiang@lbl.gov
       RDRyne@lbl.gov
Tel: 510-495-2608
     510-486-7639
-----------------------------
MODIFICATIONS AND EXTENSIONS
-----------------------------
James F. Amundson and Panagiotis Spentzouris
FNAL, POBox 500, MS 234, Batavia Il 60510
Email: 	amundson@fnal.gov
	spentz@fnal.gov

------------
COMMENTS
------------
27) 11/03/03 JFA/PGS Merge Synergia and main trunk. For a detailed description
of changes and for further code update please read the file ChangeLog.cvs
26) 8/08/03 J. Q. updated the reading external field in "AccSimulator.f90"
so that the same type of external RF field is going to be read once.
25) 8/06/03 J. Q. fixed the bug in "AccSimulator.f90" for setting
up the dipole element.
24) 7/4/03 J. Q. modified the DTL definition to add the different
random displacement and rotation errors for the front half quad and the
back half quad. This affects the files, DTL.f90, Input.f90, and AccSimulator.f90.
23) 6/4/03 J. Q. added the Ex, Ey, Ez, Bx, By, Bz to the EMfld.f90. 
Here, the fields are defined on the grid of a 3D Cartesian box.
To use this function, the flag for the Cartisian or Cylindric has 
to be set as 2.0. The BeamBunch.f90 and Data.f90 have also been updated
to include this capability.
22) 6/2/03 J. Q. modified the Quadrupole.f90 module so that it can handle
the Quadrupole with fringe field. (supplied by the external data file).
21) 2/24/03 J. Q. corrected a bug in Constant focusing channel for vertical focusing.
20) 2/3/03 J. Q. modified the Bessel.f90 to replace the old trapzoid rule
integration of the Bessel coefficients by the Simpson rule. The calculations
of the first derivative of the function using FFT or Bessel expansion were
also added.
19) 10/27/02 J. Q. modified the THETA code to make it more robust.
18) 9/19/02 J. A. modified the 6D particle output so that user can sample
a fraction of particles to output instead of the total particles which
can be very big. This modification affects file Output.f90 and 
AccSimulator.f90. The format for type "-2" is also modified with 6th number
give the sample freqency.
17) 9/10/02 J. Q. modified the output format of 90,95,99% in fort.26 to
make it consistent with the original format. 
16) 8/29/02 J. Q. fixed the field distribution bug in CCDTL.
15) 8/14/02 J. Q. add the double-Gaussian initial distribution. This
initial distribution can be used to study the long tail effects on
the mismatch free energy conversion.
14) 5/29/02 J. Q. made the dynamic load balance working differently
for boundary type 3 and 4 since they use cylindrical coordinates.
The file affected is "AccSimulator.f90". Meanwhile, I have updated
the "Distribution.f90" so that the total number of particles has
to be an integer multiple of 10 times the number of processors.
13) 4/04/02 J. Q. noted that the input period length should be the
period length in the lab frame mulitplied by gamma.
12) 3/07/02 J. Q. modified the theta.f code to find the initial driven
phase theta0 with user supplied energy-related synchronous phase.
11) 2/05/02 J. Q. modified the fix3d.f and theta.f codes to include the
beam line element DTL.
10) 1/26/02 J. Q. modified the IMPACT code by adding an initial phase to
the reference particle. This will affect the source files: BeamBunch.f90,
Input.f90 and AccSimulator.f90. The input file has also been modified
in the line 8 by adding the initial phase of reference particle there.       
9) 1/12/02 J. Q. modified the "theta" code to include the following design
capabilities: 1 for a) given syn. phase and fixed E0, find theta0
                    b) given syn. phase and 0 current phase advance, find
                       theta0 and E0.
              2 for a) given energy gain and fixed E0, find theta0
                    b) given energy gain and 0 current phase advance, find
                       theta0 and E0.
              3 for given energy gain and syn. phase, find the theta0 and E0.
              4 for given transverse 0 current phase advance, find B field.
8) 10/24/01 J. Q. modified the restart capability of code so that each
processor will read in from a file. The file name is fort.xx (xx=31+myid).
This will affect the file "Output.f90" and "AccSimulator.f90".
7) 9/23/01 J. Q. found an error in the calculation of linear map of
Solenoid in file Sol.f90. Also, a minor change of CCL.f90 so that
the linear map of RF gap can use the analytical function too.
6) 9/21/01 J. Q. added the calculation of 0 current phase advance per 
period in the Theta code. Meanwhile, the Fix3d code can handle the
quadrupole + RF, solenoid + RF, and 3D constant focusing channel in the
input file (lattice.in) generated by Theta code (fort.24).
5) 9/16/01 J. Q. changed the initial random sampling in Distribution.f90
by using a vector to store a large number of uniformly distributed 
random number at once instead of generating one or two random number per
call. Meanwhile, a new distorted Gaussian distribution with the same
alpha, beta, emittance as the distribution without distortion has been
added in with option "12".
4) 8/05/01 J. Q. added the capability of given synchronous phase of a RF
gap, finding the energy gain across the RF gap in the Theta code. This 
modification affects the first line in the input file, sim.dat.
3) 8/04/01 J. Q. added the external field shift function capability for
the error studies using the Lorentz integrator with all six boundary
conditions. For the error study, using linear map integrator works only
for transverse open boundary condition since for this integrator we transform
all particle coordinates instead of field coordinates. This modification
affects the files: AccSimulator.f90, BeamBunch.f90, BeamLineElem.f90, 
CCDTL.f90, CCL.f90, DTL.f90, SC.f90, Quadrupole.f90, Sol.f90, SolRF.f90,
EMfld.f90, Data.f90.
2) 7/31/01 J. Q. put sub-cycle capability for the nonlinear Lorentz integrator
in the space charge calculation. This means that several steps using different external
field will use the same space charge force. This can significantly improve the 
computation speed of the Lorentz integrator. When using this function, some crude run
should be done with sub-cycle flag turned off to get an estimate of the computation
domain range. Then this range will be used in the fixed computation domain simulation.
This modification affects the files: AccSimulator.f90 and Input.f90. A switch flag
is added to the input file.
1) 7/29/01 J. Q. adds a new beam line element type, EMfld, for user
defined function form of field or user supplied discrete Er, Ez, Btheta 
data as a function of "r" at given "z". This type element provides 
flexibility for user to use complex external field in the simulation.
This modification affects the files: BeamLineElem.f90, BeamBunch.f90, 
Data.f90, and AccSimulator.f90.
------------
REFERENCES
------------
1) "An Object-Oriented Parallel Particle-In-Cell Code for Beam
  Dynamics Simulation in Linear Accelerators," by Ji Qiang, Robert Ryne,
  Salman Habib, and Viktor Decyk, Journal of Computational Physics 163, 
  p. 434 (2000).

2) "Computational Challenges in High Intensity Ion Beam Physics,"
  by Robert Ryne, Ji Qiang, and Salman Habib, (to be published in
  Proceedings of the proceedings of the 2nd ICFA Advanced Accelerator
  Workshop on the Physics of High-Brightness Beams, UCLA, 11/11/99)

------------
INTRODUCTION
------------
IMPACT is a 3D parallel Particle-In-Cell (PIC) code based on multi-layer
object-oriented design.
The present version of IMPACT can treat intense beams propagating
through drifts, magnetic quadrupoles, magnetic soleniods, and rf cavities
using linear map integrator and drifts, magnetic dipoles, quadrupoles,
soleniods, and rf cavities using nonlinear Lorentz integrator. 
It has a novel treatment of rf cavities, in which the gap transfer maps
are computed during the simulations by reading in Superfish rf fields.
The goal is to avoid time-consuming (and unnecessary) fine-scale
integration of millions of particles through the highly z-dependent
cavity fields. Instead, fine-scale integration is used to compute the
maps (which involve a small number of terms), and the maps are applied
to particles. If you are familiar with magnetic optics, then you will
recognize that this is analogous to the technique used to simulate
beam transport through magnets with fringe fields. Typical IMPACT
simulations at NERSC are run with 10 million to 50 million particles,
though smaller and larger runs are possible.

The version of IMPACT that you will be using at NERSC currently
has a 3D space-charge model that assumes six types of
boundary conditions: 1) 3D open boundary conditions, 
2) a solver that uses open boundary conditions transversely and
periodic boundary conditions longitudinally, and 3) solvers for
round and rectangular conducting pipes (where the longitudinal
boundary condition is either open or periodic).
The error studies have include the field errors, misalignment
errors, and rotation errors. 

The IMPACT code was designed based on a multi-layer object-oriented
methodology. In this design, objects identified from the
analysis are organized into different physical modules.
The physical modules are built into an ordered layer structure.
The objects in the lower layer provide the service for the objects
in the upper layer. Usually, the upper layer is related to the problem
domain and the lower layer is related to the available resources.
In the IMPACT code, we have defined a four-layer framework. These four 
layers are the data structure layer, function layer, application layer 
and control layer. The detailed discussion of these four layers 
can be found in "A Layer-Based Object-Oriented Parallel Framework for
Beam Dynamics Studies", Ji Qiang and Robert D. Ryne, PAC 2001, Chicago.

Up to now, IMPACT has been used to model the Spallation Neutron
Source linac (room temperature and superconducting versions), the
Accelerator Production of Tritium linac, the quadrupole channel
for the upcoming LEDA beam halo experiment, and the CERN
Superconducting Proton Linac.

IMPACT was largely developed by Ji Qiang, Robert Ryne and Salman Habib (LANL),
with contributions from Viktor Decyk (UCLA) and the POOMA team (LANL).
There are three versions of IMPACT: F90/MPI, POOMA, and HPF. The
most up-to-date version, which you will use, is the F90/MPI version.

Finally, there is at present no IMPACT manual (we are working on it).
However, there is some written material that includes a description
of the code. This can be found at http://public.lanl.gov/ryne/gca.html
Two useful documents can be found in the page:

IMPACT INPUT FILES
------------------
The main IMPACT input file is called test.in
Here is a sample with some of my comments in ()
WARNING: The / seen at the end of each line below is important:
the read statement in IMPACT that reads all the beamline element
info wants to read in a lot of numbers (I forget how many).
In a fortran free-format read statement, you can make it ignore
the rest by using / at the end of the line.
So, if you neglect this, the code will crash.
=========================================================================
                        INPUT FILE test.in
=========================================================================
8 8                     (processor layout: NOTE WELL: the product of
                         these numbers must equal the number of
                         processors that you run on!)

6 10000000 1 0 1 1       (6D problem with 10M particles, "1" for linear map
                         integrator ("2" for nonlinear Lorentz integrator),
                         "0" for no error studies ("1" for error studies),
                         "1" for standard output ("2" for 90%, 95%, 99% 
                         emittance, radius output), map order "1" (orders 1 and 2 are available).)
64 64 64 1 0.014 0.014 0.10  (64x64x64 space-charge grid, "1" for 3D open
                             ("2" for transverse open, longitudinal periodic,
                             "3" for transverse finite, longitudinal open 
                             round pipe, "4" for transverse finite, 
                             longitudinal periodic round pipe, "5" for 
                             transverse finite, longitudinal open rectangular
                             pipe, "6" for transverse finite, longitudinal
                             periodic rectangular pipe), x pipe width 
                             "0.014" m, y pipe width "0.014" m, period length
                             "0.10" m.  Period length stands for the bunch 
				separation in the bunch frame, so it is
				beta * gamma * lambda
3 0 0                    (Input distribution is "type 3",
                        Here is what the distributions mean:
                        1=rectangle in 6D phase space [for testing]
                        2=6D Gaussian
                        3=6D Waterbag
                        4=Semi-Gaussian [uniform position, Gaussian momentum]
                        5=KV transverse, uniform longitudinal.
                        6=Read coords/momenta from external file "partcl.data"
                        [this is
                        undergoing tests in Testing directory. More later.])
			666=6D Gaussian with covariance matrix specified input
			667=5D Gaussian, uniform z, with covariance matrix
                            Same as 666, but with z distributed evenly between
                            -pi and +pi. Any correlations with the z coordinate
                            will be ill-defined. numzpeaks should be 1.
                        "0" means no restart ("1" means to restart from
                        some point after stop), "0" means no sub-cycle 
                        ("1" means sub-cycle).

     (The following 3 lines apply to distributions 1 through 6:)

2.60529297811E-2, 3.6536731692E-4,  -0.95073401 1.0 1.0 0.0 0.0
1.69213266215E-2, 2.3573085744E-4,  -0.67283857 1.0 1.0 0.0 0.0
6.14232727818E-2, 1.7583221689E-4,  0.148895386 1.0 1.0 0.0 0.0 1.0 /
(Explanation of preceding 3 lines: They are
 sigmax    lambdax      mux     mismatchx  mismatchpx offsetX  offsetPx
 sigmay    lambday      muy     mismatchy  mismatchpy offsetY  offsetPy
 sigmaz    lambdaz      muz     mismatchz  mismatchE offsetPhase offsetEnergy numzpeaks 
         The distribution in each dimension is a quadratic form.
         For example, in x, it is a function of
         x^2/sigmax^2 + 2*x*px*mux/(sigmax*lambdax)+px^2/lambdax^2
         Some day the code may be changed to work with Courant-Snyder
         parameters. These quantities are produced by a 3D rms envelope
         code that I will describe later.)

         z is actually phase in IMPACT (see Units file).
         MismatchX/Y/Px/Py/z/E are multiplying X/Y/... (dimensionless)
         Offsets are expressed in IMPACT units and are added to the means. 
         numzpeaks is the number of equally distributed gaussians in z, used
         to model injection of multiple bunches.
         ***Note the trailing "/" at the end of the third line; it is required.


    (For the 6D Gaussian with covariance matrix input, or the 5D
     Gaussian + uniform z, use the following 3 lines instead:)

0.000215236 2.69656e-08 3.75376e-07 0 0 0.000751554 0
0 0 1.07502e-07 0 0 0 0
0.175703 -6.58164e-07 0 0 0 0 9.30938e-08 0 0 0 0 0 0 1 /
(Explanation of preceding 3 lines:
           
         
         xoffset x'offset yoffset y'offset zoffset z'offset numzpeaks

         For the generation of the 6D Gaussian with covariance matrix 
         as described above we follow the prescription found in Knuth,
         Seminumerical Algorithms, pp. 139 and 586. The Twiss
         parameter alpha (in the x-direction) is related to 
         by

               = R  
              R = alpha/sqrt(1+alpha**2)



0.070 120.e6 939.294e6 1.0 352.2e6 0.0 (current averaged over rf period=70 mA,
                                    initial kinetic energy=120MeV
                                    particle mass=939.294 MeV/c^2
                                    1.0=charge
                                    scaling frequency=352.2 MHz, 0.0 is
                                    initial phase of the reference particle)
0.770000  4  20    0    0.014  /    (drift, length=0.77m,
                   ^                 4 "steps" where each step
                 drift               through the beamline element
                                     consists of a half-step +
                                     a space-charge kick + a half-step.
                                     Each half-step involves
                                     computing a map for that
                                     half-element, computed by
                                     numerical integration with
                                     20 "map steps", pipe radus is 0.014 m.)
                                             
0.30      4  20    1 -5.67  0. 0.014  0. 0. 0. 0. 0. /(magnetic quad, length=0.3m
                   ^                        4 "steps," 20 "map steps"
                 quad                       gradient=-5.67 Tesla/m, input
                                            gradient file ID, radius=0.014m,
                                            x misalignment error=0.0m, y
                                            misalignment error=0.0m, rotation
                                            error x, y, z = 0.0, 0., 0. rad.)

0.30      4  20    2  9.8696 9.8696 9.8696 0.014 / (3D constant focusing, 
                                            length=0.3m, 4 "steps",
                   ^                        " 20 "map steps",kx0^2=9.8696,
                 constant focusing          ky0^2=9.8696,kz0^2=9.8696, 
                                            radius=0.014m)

0.30      4  20    3  5.67  0. 0.014  0. 0. 0. 0. 0. 0. /(magnetic solenoid,length=0.3m
                   ^                        4 "steps," 20 "map steps"
                 solenoid                   Bz0=5.67 Tesla, input
                                            field file ID 0., radius=0.014m,
                                            x misalignment error=0.0m, y
                                            misalignment error=0.0m, rotation
                                            error x, y, z=0.0, 0., 0. rad.)

1.48524   10 20   4   0.1  0.0  0.  0.014  0.0 0.0 0.0 0. 0. /
                  ^                  (magnetic dipole, length=1.48524m,
                dipole               10 "steps", 20 "map steps"
                                     Bx=0.1 T, By=0.0, input field file ID 0.,
                                     radius=0.014m,x misalignment error=0.0m,
                                     y misalignment error=0.0m, rotation
                                     error x, y, z=0.0, 0., 0. rad.)

0. 0 0 21 2 1480 0 0 0 /             (injection element, length = 0, steps = 0,
       ^				kicks = 0, distribution number = 2 
	injection element		-currently ignored, only 6D covariance
					gaussian implemented--, number of 
					particles = 1480, x, y, offsets (impact
					units))


0.30      4  20    91 1.0  0. 0.014  0. 0. 0. 0. 0. /(external element, i.e
					    mad file, length=0.3m
                   ^                        4 "steps," 20 "map steps"
                 external element           unused (1.0), unused (0.0),
                                            radius=0.014m, beamline index, 
                                            see Synergia python script 
					    implementation)

1.48524   10 20   101   1.0 700.0e6 30. 1.0 0.014 0.01 1.0 0.01 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 /
                  ^              (RF cavity, length=1.48524m,
                 DTL             10 "steps", 20 "map steps"
                                 field scaling=1.0, RF frequency=700.0e6,
                                 driven phase=30.0 degree, input field 
                                 ID=1.0, radius=0.014m, quad 1 length=0.01m,
                                 quad 1 gradient=1.0T/m, quad 2 length=0.01m,
                                 quad 2 gradient, x misalignment 
                                 error=0.0m, y misalignment error=0.0m, 
                                 rotation error x, y, z=0.0, 0., 0. rad for
                                 quad1, x, y displacement, rotation error x, y, z for
                                 quad2, x displacement, y displacement, 
                                 rotation error x, y, z for RF field.
       

1.48524   10 20   102   1.0 700.0e6 30. 1.0 0.014 0. 0. 0. 0. 0. /
                  ^              (RF cavity, length=1.48524m,
                 CCDTL             10 "steps", 20 "map steps"
                                 field scaling=1.0, RF frequency=700.0e6,
                                 driven phase=30.0 degree, input field 
                                 ID=1.0, radius=0.014m, x misalignment 
                                 error=0.0m, y misalignment error=0.0m, 
                                 rotation error x, y, z=0.0, 0., 0. rad)

1.48524   10 20   103   1.0 700.0e6 30. 1.0 0.014 0. 0. 0. 0. 0. /
                  ^              (RF cavity, length=1.48524m,
                 CCL             10 "steps", 20 "map steps"
                                 field scaling=1.0, RF frequency=700.0e6,
                                 driven phase=30.0 degree, input field 
                                 ID=1.0, radius=0.014m, x misalignment 
                                 error=0.0m, y misalignment error=0.0m, 
                                 rotation error x, y, z=0.0, 0., 0. rad)

1.48524   10 20   104   1.0 700.0e6 30. 1.0 0.014 0. 0. 0. 0. 0. /
                  ^              (RF cavity, length=1.48524m,
                  SC             10 "steps", 20 "map steps"
                                 field scaling=1.0, RF frequency=700.0e6,
                                 driven phase=30.0 degree, input field 
                                 ID=1.0, radius=0.014m, x misalignment 
                                 error=0.0m, y misalignment error=0.0m, 
                                 rotation error x, y, z=0.0, 0., 0. rad)

1.48524   10 20   105   1.0 700.0e6 30. 1.0 0.014 0. 0. 0. 0. 0. 1.0 /
                  ^              (Solenoid with RF cavity, length=1.48524m,
                  SolRF           10 "steps", 20 "map steps"
                                 field scaling=1.0, RF frequency=700.0e6,
                                 driven phase=30.0 degree, input field 
                                 ID=1.0, radius=0.014m, x misalignment 
                                 error=0.0m, y misalignment error=0.0m, 
                                 rotation error x, y, z=0.0, 0., 0. rad, 
                                 Bz0=1.0 Tesla)

1.48524   10 20   110   1.0 700.0e6 30. 1.0 0.014 0. 0. 0. 0. 0. 1.0 1.0 /
                  ^              (user defined RF cavity, length=1.48524m,
                  EMfld          10 "steps", 20 "map steps"
                                 field scaling=1.0, RF frequency=700.0e6,
                                 driven phase=30.0 degree, input field 
                                 ID=1.0, radius=0.014m, x misalignment 
                                 error=0.0m, y misalignment error=0.0m, 
                                 rotation error x, y, z=0.0, 0., 0. rad),
                                 1.0 (using discrete data only, 2.0 using both
                                 discrete data and analytical function, other
                                 using analytical function only), 2.0 (field
                                 in Cartesian coordinate, 1.0 in Cylindrical                                 coordinate)

0. 0 0 -1 /   (shift the centroid of beam to the axis)

0. 0 N -2 0.0 1 /   (write the full particle set on fort.N
        ^     ^ NOTE WELL: N must not equal 5 or 6 (Fortran code)
      write     NOTE WELL: This prints the data set with 1 as sample
                frequency. 

0. 0 0 -3 0.014 0.02 0.02 0.02 0.02 0.02 0.02 /   
                       (write the accumulated density along R, X, Y into file 
                        Xprof.data, Yprof.data, RadDens.data, radius=0.014m,
                        xmax=0.02m,pxmax=0.02 mc,ymax=0.02m,pymax=0.02 mc,
                        zmax=0.02 rad,pzmax=0.02 mc^2, if no frame range
                        is specified, the program will use the maximum
                        amplitude at given location as the frame.)

0. 0 0 -4 0.014 0.02 0.02 0.02 0.02 0.02 0.02 /   
                       (write the density along R, X, Y into file 
                       Xprof2.data, Yprof2.data, RadDens2.data, radius=0.014m,
                       xmax=0.02m,pxmax=0.02 mc,ymax=0.02m,pymax=0.02 mc,
                       zmax=0.02 rad,pzmax=0.02 mc^2, if no frame range
                       is specified, the program will use the maximum
                       amplitude at given location as the frame.)

0. 0 0 -5 0.014 0.02 0.02 0.02 0.02 0.02 0.02 /   
                       (write the 2D projections of 6D distribution in 
                       XY.data, XPx.data, XZ.data, YPy.data, YZ.data, 
                       ZPz.data. radius=0.014m,
                       xmax=0.02m,pxmax=0.02 mc,ymax=0.02m,pymax=0.02 mc,
                       zmax=0.02 rad,pzmax=0.02 mc^2, if no frame range
                       is specified, the program will use the maximum
                       amplitude at given location as the frame.)

0. 0 0 -6 0.014 0.02 0.02 0.02 0.02 0.02 0.02 /   
                       (write the 3D density into the file fort.8.
                       radius=0.014m,
                       xmax=0.02m,pxmax=0.02 mc,ymax=0.02m,pymax=0.02 mc,
                       zmax=0.02 rad,pzmax=0.02 mc^2, if no frame range
                       is specified, the program will use the maximum
                       amplitude at given location as the frame.)

0. 0 0 -7 /   
                       (write the 6D phase space information and local
                       computation domain into files ph0000sN and gm0000sN.
                       This function is used for restart purpose.

0.  1 1 -99 /
         ^      (halt execution at this point in the input file.
        halt     this is useful if you have a big file want to run
                part-way through it without deleting a lot of lines.

=====================================================================
The other data files are called rfdataN, e.g. rfdata1, rfdata52,...
The first column of this file is "z," the second column is "Ez"
on-axis, and the third column is d/dz(Ez on-axis). This is what
is needed to compute the linear transfer map for the rf cavities.
The input initial distribution is stored in the file "partcl.data".

IMPACT OUTPUT FILES
-------------------
File fort.18: reference particle information
----------------------------------------------------------------
1st col: distance (m)
2nd col: absolute phase (radian)
3rd col: gamma
4th col: kinetic energy (MeV)
5th col: beta
6th col: Rmax (m) R is measured from the axis of pipe
----------------------------------------------------------------
File fort.24 (for X) fort.25 (for Y), fort.26 (for Z): RMS size information
----------------------------------------------------------------
1st col: z distance (m)
2nd col: centroid location (m)
3rd col: RMS size (m for fort.24 and fort.26, degrees for fort.26)
4th col: Centroid momentum (rad for fort.24 and fort.25, MeV for fort.26)
5th col: RMS momentum (rad for fort.24 and fort.25, MeV for fort.26)
6th col: Twiss parameter, alpha 
7th col: normalized RMS emittance (m-rad for transverse and degree-MeV for for
t.26) 
----------------------------------------------------------------
File fort.27: maximum amplitude information
----------------------------------------------------------------
1st col: z distance (m)
2nd col: Max. X (m)
3rd col: Max. Px (rad)
4th col: Max. Y (m)
5th col: Max. Py (rad)
6th col: Max. Phase (degree)
7th col: Max. Energy deviation (MeV)
----------------------------------------------------------------
File fort.28: load balance and loss diagnostic
----------------------------------------------------------------
1st col: z distance (m)
2nd col: min # of particles on a PE
3rd col: max # of particles on a PE
4th col: total # of particles in the bunch
----------------------------------------------------------------
File fort.29: cubic root of 3rd moments of the beam distribution
----------------------------------------------------------------
1st col: z distance (m)
2nd col: X (m)
3rd col: Px (rad)
4th col: Y (m)
5th col: Py  (rad)
6th col: phase (degree)
7th col: Energy deviation (MeV)
----------------------------------------------------------------
File fort.30: square root, square root of 4th moments of the beam distribution
----------------------------------------------------------------
1st col: z distance (m)
2nd col: X (m)
3rd col: Px (rad)
4th col: Y (m)
5th col: Py (rad)
6th col: phase (degree)
7th col: Energy deviation (MeV)
----------------------------------------------------------------
File fort.31 beam emittance
----------------------------------------------------------------
1st col: z distance (m)
2nd col: e_x (m rad)
3rd col: e_y (m rad)
4th col: e_z (degree-MeV)
5th col: e_4d (m^2 rad^2) (determinant of the transverse covariance matrix)
6th col: e_6d (m^2 rad^2 degree-MeV) (6D determinant)
----------------------------------------------------------------
File fort.32 beam correlations (r_ij = /sqrt( ))
----------------------------------------------------------------
1st  col: xx'
2nd  col: xy
3rd  col: x'y
4th  col: xy' 
5th  col: x'y'
6th  col: yy' 
7th  col: xz
8th  col: x'z
9th  col: yz
10th col: y'z
11th col: xz'
12th col: x'z'
13th col: yz'
14th col: y'z'
15th col: zz'
----------------------------------------------------------------
Lastly, if you use the "-2" type code (described in the
explanation of test.in) to print the data at various locations,
the resulting data will be in columns of the form
x,px,y,py,t,pt.
1st col: x normalized by c/omega = 0.1185427
2nd col: Px normalized by mc, here this column has to be divided by gamma beta
 = 0.126832 to convert to unit radian 
3rd col: y normalized by c/omega = 0.1185427
4th col: Py normalized by mc, here this column has to be divided by gamma beta
 = 0.126832  to convert to unit radian
5th col: phase (radian)
6th col: kinetic energy deviation normalized by mc^2 = 939.294 MeV for H-.

----------------------------------------------------------------
The following notes are out of date.
----------------------------------------------------------------
A NOTE ON UNITS
---------------
At the moment, xrms and yrms are in meters. trms is in degrees.
The units used internally by IMPACT are quite strange, and
it will take me an entire email message just to explain them.
I will do that at a later time.

WARNINGS, KNOWN BUGS, ETC
-------------------------
At the moment, the frequency specified on the 8th line of test.in
(after specifying the distribution parameters and before specifying
the beamline) must equal the frequency specified for the rf cavities
(352.2 MHz in the above example).

-------------------------------

NERSC INFORMATION
-----------------
NERSC (the National Energy Research Scientific Computing Center)
has excellent web pages. There are two main starting points:
http://hpcf.nersc.gov adn http://www.nersc.gov
I will not say much here since their web pages are so comprehensive.
But I will mention a few things:

You will need secure shell (ssh) to access all NERSC computers.

There are two main platforms:
gseaborg.nersc.gov   (IBM SP)
mcurie.nersc.gov     (SGI/Cray T3E)
The IBM SP will eventually become NERSC's premier platform,
so I suggest that you to devote most of your energy to using
that machine rather than mcurie. Before you can begin using
gseaborg, you will need to do the following, as described in
the NERSC web page http://hpcf.nersc.gov/machines/SP/#access
----
    Before logging into the SP for the first time you must change
    your password on a special interactive node named gsadmin.nersc.gov: 

    1.type ssh -P gsadmin.nersc.gov 
    2.issue the passwd command 
    3.select a new password that is at least 8 characters long with
      at least 2 alphabet letters and at least 2 non alpha characters 
    4.log out of gsadmin 
    5.wait at least one hour before connecting to gseaborg 
    6.after waiting one hour, ssh -P to gseaborg.nersc.gov 
----

When you log in to gseaborg or mcurie, I recommend typing the
following (which you can automate -- see the web pages):
 module load tcsh
 tcsh
 module load GNU

The first two statements will enable the unix tc shell.
The second is needed so that you can use gnuplot.
Just type "gnuplot" and, once inside gnuplot, type "help"
to get information. A day does not go by that I don't use
gnuplot to look at the output of my jobs. In the future,
I will send you info about how to look at various quantities
with gnuplot. For example, plot 'fort.24' u 1:3 w l
produces a plot of xrms vs. z I say all this because I make
heavy use of gnuplot, and it will help us communicate if
you use it too. I think you will find it a pleasure to use.
See http://www.cs.dartmouth.edu/gnuplot_info.html for more
info. Note that it is slightly inconvenient to locate the
version 3.7 manual, so I have placed it in my home space on
gseaborg. It is called /u2/ryne/gnuplot.ps or /u2/ryne/gnuplot.pdf

RUNNING IMPACT ON GSEABORG
--------------------------
At this time, the current version of IMPACT is located on
gseaborg in the following directory tree:
/u2/ryne
    SPL
      Testing
      SrcDouble
      RunDouble
        Batch64
        Batch128
        Batch256
        Batch512
        Interactive
          Gauss1
          Semigauss
          Waterbag

Batch64 contains input files and results from 64-processor runs
Batch128 contains input files and results from 128-proc runs, etc.
Interactive contains input filed and results from 8-proc interactive
runs. To give you a rough picture of performance, the 8-processor
jobs in Interactive used 250K macroparticles on a 32x32x32
space-charge grid and required roughly 13 minutes to complete.
Batch64 contains a 10M particle run on a 64x64x64 grid which
required about an hour to complete. Batch128 contains a 25M
particle run on a 64x64x128 grid that required 1.5 hrs to complete.
Batch256 contains a 50M particle run on a 128x128x128 grid that
required about 2.6 hours to complete. Batch512/Matched (which only
simulated half the linac) used 50M particles on a 256x256x256 grid
and required 3.4 hours.

The NERSC web pages tell you how to submit jobs, but, briefly,
here is the basic info:
To run interactive jobs (say, an executable called ximpact), type:
  ximpact -procs 4            (to run a 4 processor interactive job)
To run a batch job, use the script files in the directory tree.
For example, to run a 64 processor job, type
  llsubmit myscript64.cmd        (ll means "load leveler")
To see the status of all jobs on the machine, type
  llqs
To see the status of all jobs by a given user, e.g. ryne, type
  llqs | grep ryne
Note that, on the present IBM SP, each compute "node" has
two processors. Results from llqs are in nodes (NDS), not processors.
But everything you tell the IMPACT code refers to *processors*
For more info about running jobs, see
http://hpcf.nersc.gov/computers/SP/
and click on "Running on the SP" and "The IBM Batch System"