OPTION, ECHO=FALSE;
OPTION, PSDUMPFREQ=1000;
OPTION, STATDUMPFREQ=1;
OPTION, VERSION=20000;

TITLE, STRING="Quad Test";

REAL Edes   = 0.590;
REAL gamma  = (Edes+PMASS)/PMASS;
REAL beta   = sqrt(1-(1/gamma^2));
REAL P0     = gamma*beta*PMASS;

QP1: QUADRUPOLE, L=0.644, ELEMEDGE=2.000, K1= 4.744;
QP2: QUADRUPOLE, L=0.644, ELEMEDGE=3.644, K1=-5.616;
QP3: QUADRUPOLE, L=0.644, ELEMEDGE=5.288, K1= 4.744;

D:   DRIFT,      L=2.000, ELEMEDGE=5.288+0.644;

QUADTEST: LINE=(QP1,QP2,QP3,D);

D1: DISTRIBUTION, TYPE=GAUSS,
SIGMAX=  5*1.0e-03,   SIGMAPX= 0.696*1.0e06,  CORRX= 0.0,
SIGMAY=  5*1.0e-03,   SIGMAPY= 0.310*1.0e06,  CORRY= 0.0,
SIGMAZ=  0.005,       SIGMAPZ= 0.0,           CORRZ= 0.0, R61= 0.0, INPUTMOUNITS=EV;

FS1:FIELDSOLVER, FSTYPE=NONE, MX=64, MY=64, MT=64,
                 PARFFTX=true, PARFFTY=true, PARFFTT=true,
                 BCFFTX=open, BCFFTY=open, BCFFTT=open;

BEAM1: BEAM, PARTICLE=PROTON, PC=P0, NPART=1000, BCURRENT=2.0e-03, BFREQ=50.6328e6, CHARGE=1;

SELECT, LINE=QUADTEST;

TRACK, LINE=QUADTEST, BEAM=BEAM1, MAXSTEPS=6000, DT=1.0e-11, ZSTOP=8.0;
 RUN, METHOD = "PARALLEL-T", BEAM=BEAM1, FIELDSOLVER=FS1, DISTRIBUTION=D1;
ENDTRACK;
STOP;