OPTION, ECHO = FALSE,
        PSDUMPFREQ = 10,
        STATDUMPFREQ = 10,
        REPARTFREQ = 1000;
Option, VERSION=10900;

TITLE, string="Gaussian bunch drift test";

REAL Edes    = 0.001;
REAL CURRENT = 0.01;

REAL gamma=(Edes+PMASS)/PMASS;
REAL beta=sqrt(1-(1/gamma^2));
REAL gambet=gamma*beta;
REAL P0 = gamma*beta*PMASS;
REAL brho = (PMASS*1.0e9*gambet) / CLIGHT;

D1: DRIFT, ELEMEDGE = 0.0, L = 1.0;

Line1: LINE = (D1);

Fs1: FIELDSOLVER, FSTYPE = FFT, MX = 16, MY = 16, MT = 16, BBOXINCR=0.1;

Dist1: DISTRIBUTION, TYPE = GAUSS,
       OFFSETX = 0.0, OFFSETY = 0.0, OFFSETZ = 0.0,   // Centroid of bunch (m)
       SIGMAX = 5.0e-3, SIGMAY = 5.0e-3, SIGMAZ = 5.0e-3,   // Sigmas of the Gaussian bunch (m)
       OFFSETPX = 0.0, OFFSETPY = 0.0, OFFSETPZ = 0.0,    // Mean momenta (eV)
       SIGMAPX = 0.0 , SIGMAPY = 0.0 , SIGMAPZ = 0.0 ,    // Sigmas of the momenta (eV)
       CORRX = 0.0, CORRY = 0.0, CORRZ = 0.0,             // Correlations
       CUTOFFX = 4.0, CUTOFFY = 4.0, CUTOFFLONG = 4.0;    // Impact-t is calculating 4 sigma distributions

Beam1: BEAM, PARTICLE = PROTON, CHARGE = 1.0, BFREQ = 1.0, PC = P0, NPART = 1E5, BCURRENT = CURRENT;

SELECT, LINE = Line1;

TRACK, LINE = Line1, BEAM = Beam1, MAXSTEPS = 1000, ZSTOP = 1.0, DT = 1.0e-10, ZSTART = 15.0e-3;
 RUN, METHOD = "PARALLEL-T", BEAM = Beam1, FIELDSOLVER = Fs1, DISTRIBUTION = Dist1;
ENDTRACK;

STOP;
