- Aperture
ataparture(FAMNAME,[-x,+x,-y,+y],'AperturePass');
define physical aperture element (collimator)
- Base element
atbaselem
- Drift:
atdrift(FAMNAME,LENGTH,'DriftPass')
- Sector Bend/Rectangular Bend:
atrbend/atsbend(FAMNAME,LENGTH,BENDINGANGLE,PASSMETHOD)
PASSMETHODs: 'BndMPoleSymplectic4Pass', 'BndMPoleSymplectic4RadPass', 'BndMPoleSymplectic4E2Pass', 'BndMPoleSymplectic4E2RadPass', 'BndMPoleSymplectic4FrgGPass', 'BndMPoleSymplectic4FrgFradPass', 'BendLinearPass'
- Quadrupole:
atquadrupole(FAMNAME,LENGTH,K,PASSMETHOD)
PASSMETHODs: 'StrMPoleSymplectic4Pass', 'StrMPoleSymplectic4RadPass, QuadLinearPass, QuadMPoleFringePass, QuadMPoleFringeRadPass, ThinMPolePass'
- Sextupole:
atsextupole(FAMNAME,LENGTH,S,PASSMETHOD)
PASSMETHODs: 'StrMPoleSymplectic4Pass', 'StrMPoleSymplectic4RadPass', 'ThinMPolePass'
- Octupole:
octupole(FAMNAME,LENGTH, S, PASSMETHOD)
PASSMETHODs: 'StrMPoleSymplectic4Pass,StrMPoleSymplectic4RadPass'
- Multipole
ATMULTIPOLE(FAMNAME,LENGTH,POLYNOMA,POLYNOMB,PASSMETHOD)
PASSMETHODs: 'StrMPoleSymplectic4Pass,StrMPoleSymplectic4RadPass','ThinMPolePass'
- ThinMultipole
atthinmultipole(FAMNAME,PolynomA,PolynomB,'ThinMPolePass')
- Wiggler
atwiggler(FAMNAME, Ltot,Lw,Bmax,Nstep,Nmeth,By,Bx,PASSMETHOD)
PASSMETHODS: 'GWigSymplecticPass', 'WigLinearPass'
- KickMap (Insertion Device)
atidtable(Nslice,filename,Energy,'IDTablePass')
- RFCavity
atrfcavity(FAMNAME,LENGTH,VOLTAGE,FREQUENCY,HARMNUMBER,ENERGY,'CavityPass')
- QuantDiff
atQuantDiff(FAMNAME,?,'QuantDiffPass')
- Monitor
atmonitor(FAMNAME,'FIELDNAME1',VALUE1,...,'IdentityPass')
- Marker
atmarker(FAMNAME,'FIELDNAME1',VALUE1,...,'IdentityPass');
- Corrector
atcorrector(FAMNAME,LENGTH,KICK,PASSMETHOD);
- Solenoid
atsolenoid(FAMNAME,LENGTH, KS,'SolenoidLinearPass');
- Matrix66
atM66(FAMNAME,?,'Matrix66Pass')
- RingParam
ATRINGPARAM(FAMNAME,E0,NBPERIODS);
NOTE: all elements may be misaligned (T1,2) or rotated (R1,2)
passfunction: Pass method written in C
mexfunction: interface to MatLab is via the Mex function for each passmethod
Cell = [{Elem1}; {Elem2}; ...; {NthElem}];
Ring = repmat(Cell,Ntimes,1);
To find and modify elements:
- findcells: allows to find indices of elements in the lattice using various criteria
- eg.
QFindices = findcells(FODO,'FamName','QF');
- eg.
QFIndices = findcells(FODO,'Class','Quadrupole')
- eg.
- getcellstruct: to extract the fields with the elements
- eg. to retrieve quadrupole strength values
Kvals = getcellstruct(FODO,'PolynomB',QuadIndices,2);
- eg. to retrieve quadrupole strength values
- setcellstruct: may be used to set the values of parameters
- eg. add some random errors to all the quadrupole strengths with
Kvals = Kvals + 0.2*(rand(length(Kvals),1)-0.5); FODOerr = setcellstruct(FODO,'PolynomB',QuadIndices,Kvalserr,2);
- findspos: to find the longitudinal position of each element of a certain family/class
- eg.
quadpos = findspos(FODO,QuadIndices);
- eg.
- ringpass: this is the function that does the tracking
- eg.
nturns=200; Z01=[.001;0;0;0;0;0]*(1:3); Z200=ringpass(FODO,Z01,nturns);
NOTE: it can be convenient to cast ZZ200=reshape(Z200,6,3,nturns); ZZZn = ZZ200(:,n,:);
when tracking multiple particles
[param,tune,chrom]= atlinopt(FODO,offenergy,observationpointelementnumber)
where
param = struct array with following fields:
- ElemIndex
- SPos
- ClosedOrbit
- Dispersion
- M44
- gamma
- C
- A
- B
- beta
- alpha
- mu
eg. to access beta function beta=param.beta;betax=beta(:,1);
atplot([FODO;FODO]);
- atx: To take into account radiation and compute both linear optics and beam sizes
- eg.
[beamdata,params]=atx(FODOwCav);
NOTE: it requires the beam to be longitudinally stable