attrack#
Tracking functions
Functions
Low-level tracking engine |
|
Tracks particles through a single element |
|
Get information on GPUs available for tracking |
|
Low-level tracking engine on GPU |
|
tracks particles through each element of the cell array LINE |
|
tracks particles through each element of the cell array RING |
- atpass(lattice, rin, mode, nturns, refpts, prefunc, postfunc, nhist, numthreads, ringprops)#
- Low-level tracking enginerout = atpass(lattice,rin,mode,nturns,refpts,prefunc,postfunc,nhist,numthreads,ringprops)LATTICE AT latticeRIN 6xN matrix: input coordinates of N particlesMODE 0 - reuse lattice1 - new latticeNTURNS number of turnsREFPTS Indexes of elements where the trajectory is observedMay run from 1 to length(LATTICE)+1PREFUNC function called before each elementPOSTFUNC function called after each elementNHIST length of history buffer. Optional, default 1NUMTHREADS Number of threads in OpenMP. Optional, default: automaticRINGPROPS Ring properties (energy and particle).[rout,lost] = atpass(…)Additionally return information on lost particlesLOST 1x1 structure with the following fields:turn 1xN vector, turn number where the particle is lostelement 1xN vector, element number where the particle is lostcoordinates 6xNxNHIST matrix, coordinates at the entrance of theelement where the particle was lostSee also
ringpass()
,linepass()
- elempass(elem, rin)#
- Tracks particles through a single elementrout=elempass(elem,rin) Tracks particles through ELEMELEM: lattice elementRIN 6xN matrix: input coordinates of N particlesROUT 6xN matrix: output coordinates of N particlesrout=elempass(…,’passmethod’,passmethod,…)Use PASSMETHOD (default: ELEM.PassMethod)rout=elempass(…,’energy’,energy,…)Use ENERGY and ignore the ‘Energy’ field of elementsrout=elempass(…,’particle’,particle,…)Use PARTICLE (default: relativistic)See also
ringpass()
,linepass()
- gpuinfo()#
- Get information on GPUs available for trackinginfo = gpuinfoINFO: 1xn structure with the following fields:Name: GPU nameVersion: CUDA compute capability (? for OpenCL)CoreNumber: Multi processor numberPlatform: Platform name
- gpupass(lattice, rin, mode, nturns, refpts, turn, keepcounter, gpupool, integrator)#
- Low-level tracking engine on GPUrout = gpupass(lattice,rin,mode,nturns,refpts,turn,keepcounter,gpupool,integrator)LATTICE AT latticeRIN 6xN matrix: input coordinates of N particlesMODE 0 - reuse lattice1 - new latticeNTURNS number of turnsREFPTS Indexes of elements where the trajectory is observedMay run from 1 to length(LATTICE)+1KEEPCOUNTER 0 - Start counting turn from 01 - Keep last turn counter of the previous gpupass callGPUPOOL GPU to use (see gpuinfo)INTEGRATOR Type of integrator to use1: Euler 1st order, 1 drift/1 kick per step2: Verlet 2nd order, 1 drift/2 kicks per step3: Ruth 3rd order, 3 drifts/3 kicks per step4: Forest/Ruth 4th order, 4 drifts/3 kicks per step (Default)5: Optimal 4th order from R. Mclachlan, 4 drifts/4 kicks per step6: Yoshida 6th order, 8 drifts/7 kicks per step[rout,lost] = gpupass(…)Additionally return information on lost particlesLOST 1x1 structure with the following fields:turn 1xN vector, turn number where the particle is lostelement 1xN vector, element number where the particle is lostcoordinates_at_loss 6xN matrix, coordinates at the entrance of theelement where the particle was lostSee also
ringpass()
,linepass()
- linepass(line, rin) tracks particle(s)#
- tracks particles through each element of the cell array LINEcalling the element-specific tracking function specified in theLINE{i}.PassMethod field.rout=linepass(line,rin) tracks particle(s) with initialcondition(s) RIN for NTURNS turns to the end of the LINELINE AT latticeRIN 6xN matrix: input coordinates of N particlesROUT 6xN matrix: output coordinates of N particles atthe end of LINErout=linepass(line,rin,refpts) also returns intermediate resultsat the entrance of each element specified in the REFPTSREFPTS is an array of increasing indexes that selects elementsbetween 1 and length(LINE)+1.See further explanation of REFPTS in the ‘help’ for FINDSPOSROUT 6x(N*length(REFPTS)) matrix: output coordinates of N particles ateach reference pointNOTE:linepass(line,rin,length(line)+1) is the same as linepass(line,rin)since the reference point length(LINE)+1 is the exit of the last elementlinepass(line,rin,1) is a copy of RIN since thereference point 1 is the entrance of the first element[rout, lost]=linepass(…)Return additionally an information on lost particlesLOST 1xN logical vector, indicating lost particlesIf only one output is given, loss information is saved inglobal variable LOSSFLAG[rout, loss, lossinfo]=linepass(…,’nhist’,nhist,…)Return additional information on lost particlesNHIST number elements before the loss to be traced (default: 1)LOSSINFO 1x1 structure with the following fields:lost 1xN logical vector, indicating lost particlesturn 1xN vector, turn number where the particle is lostelement 1xN vector, element number where the particle is lostcoordinates_at_loss 6xN array, coordinates at the exit ofthe element where the particle is lost(sixth coordinate is inf if particle is lost in a physical aperture)coordinates 6xNxNHIST array, coordinates at the entrance of theLHIST elements before the lossrout=linepass(…,’keeplattice’) Tracking with the ‘KeepLattice’ flag ismore efficient because it reuses persistent data structures stored inmemory in previous calls to linepass.!!! In order to use this option, linepass must first be calledwithout the ‘KeepLattice’ flag. It then assumes that the elements in LINEDO NOT CHANGE between calls. Otherwise, linepass must be called againwithout ‘KeepLattice’.rout=linepass(…,’reuse’) is kept for compatibilty with previousversions. It has no effect.rout=linepass(…,’seed’,seed) The random generators are reset to startwith SEED.rout=linepass(…,’omp_num_threads’,nthreads) Number of OpenMP threads.By default, OpenMP chooses the number of threads.rfin=linepass(…,prefunc)rfin=linepass(…,prefunc,postfunc)rfin=linepass(…,cell(0),postfunc)PREFUNC and POSTFUNC are function handles, PREFUNC is calledimmediately before tracking each element, POSTFUNC is calledimmediately after each element. Functions are called as:ROUT=FUNC(ELEMENT, RIN, NTURN, NELEMENT)and is allowed to modify the particle coordinatesSee also
ringpass()
- ringpass(ring, rin, nturns) tracks particle(s)#
- tracks particles through each element of the cell array RINGcalling the element-specific tracking function specified in theRING{i}.PassMethod field.rout=ringpass(ring,rin,nturns) tracks particle(s) with initialcondition(s) RIN for NTURNS turnsRING AT latticeRIN 6xN matrix: input coordinates of N particlesNTURNS Number of turns to perform (default: 1)ROUT 6x(N*NTURNS) matrix: output coordinates of N particles atthe exit of each turn[rout, lost]=ringpass(…)Return additionally an information on lost particlesLOST 1xN logical vector, indicating lost particlesIf only one output is given, loss information is saved inglobal variable LOSSFLAG[rout, lost, nturns]=ringpass(…)Return additionally the number of turns performed by each particleNTURNS 1xN vector, number of turns performed[rout, loss, nturns, lossinfo]=ringpass(…,’nhist’,nhist,…)Return additional information on lost particlesNHIST number elements before the loss to be traced (default: 1)LOSSINFO 1x1 structure with the following fields:lost 1xN logical vector, indicating lost particlesturn 1xN vector, turn number where the particle is lostelement 1xN vector, element number where the particle is lostcoordinates_at_loss 6xN array, coordinates at the exit ofthe element where the particle is lost(sixth coordinate is inf if particle is lost in a physical aperture)coordinates 6xNxNHIST array, coordinates at the entrance of theLHIST elements before the lossrout=ringpass(…,’keeplattice’) Tracking with the ‘KeepLattice’ flag ismore efficient because it reuses persistent data structures stored inmemory in previous calls to ringpass.!!! In order to use this option, ringpass must first be calledwithout the ‘KeepLattice’ flag. It then assumes that the elements in RINGDO NOT CHANGE between calls. Otherwise, ringpass must be called againwithout ‘KeepLattice’.rout=ringpass(…,’reuse’) is kept for compatibilty with previousversions. It has no effect.rout=ringpass(…,’seed’,seed) The random generators are reset to startwith SEED.rout=ringpass(…,’turn’,turn) Initial turn number. Default 0.The turn number is necessary to compute the absolute path length usedby RFCavityPass. Ignored if KeepCounter is set.rout=ringpass(…,’keepcounter’) The turn number starts with the lastturn of the previous call.NOTE:To resume an interrupted tracking (for instance to get intermediateresults), one must use one of the ‘turn’ option or ‘KeepCounter’ flag toensure the continuity of the turn number.rout=ringpass(…,’omp_num_threads’,nthreads) Number of OpenMP threads.By default, OpenMP chooses the number of threads.rout=ringpass(…,’silent’) does not output the particle coordinates ateach turn but only at the end of the trackingrout=ringpass(…,prefunc)rout=ringpass(…,prefunc,postfunc)rout=ringpass(…,cell(0),postfunc)PREFUNC and POSTFUNC are function handles, PREFUNC is calledimmediately before tracking each element, POSTFUNC is calledimmediately after each element. Functions are called as:ROUT=FUNC(ELEMENT, RIN, NTURN, NELEMENT)and are allowed to modify the particle coordinatesSee also
linepass()