A Python-based Charged Particle Tracker

The goal of this project is to build a charged particle tracker somewhat similar in capability to Lucretia. Despite its similarities, this will not simply be a rewrite of that code, and will include several features that make it stand out from the crowd:
  1. No reliance on any proprietary software, or on any code that requires a license to use
    • Lucretia's dependence on Matlab leads to the frustrating requirement for each and every user/computer to have a valid Matlab license. In situations where a student (for example) would just like to make a few quick calculations, this is obviously not satisfactory.
    • The license for the code produced here will be the GPL, and care will be taken to ensure that any included libraries/executables, are also compliant with the GPL. To comply with this philosophy, the native input format for beamline lattice files will be AML (although, use of the accompanying Universal Accelerator Parser (UAP) will allow a significant number of the most popular lattice formats to be read).
  2. Build it to be light
    • A package to quickly calculate beamline R-matrices, Twiss parameters, etc. may be constructed to be very small and light, therefore the philosophy behind the design of this code is to build a small, light framework for the most commonly used functions, and to allow expansion of the complexity by importing additional modules/classes.

Planned Capabilities

The following is a (perhaps incomplete) list of the capabilities that are planned for this code. The list is divided into two (the "Basics", and "Add-ons") in order to suggest the priorities of this project.

The Basics:

  1. Tracking
  2. Transport matrices (linear & non-linear)
    • Easy calculation of the linear R matrices for a single element (calculated on construction of the beamline element), and for a series of elements.
    • Calculation of the appropriate higher-order matrices for any elements requiring them. Limited to 4th order.
  3. Twiss parameters.
    • Propagation of the Twiss parameters (alpha, beta, phase, dispersion, dispersion_prime, and the sigma matrix) through a system of elements.
  4. Multi-species
    • Electron or positron bunches. Extension to other species later (p, pbar, ions, ...)
  5. Loading of lattice formats in AML.


  1. Collective effects
    • Longitudinal and transverse cavity wakes, represented as both frequency and time domain fields.
    • Synchrotron losses (yeah, yeah, I know SR isn't a collective effect), including average and stochastic effects, coherency for short bunches (or bunches with longitudinal structure), and interaction of the beam with the emitted light.
      • In other words, make this code work well for FELs.
  2. Realistic diagnostics
    • Add realistic effects to the BPM output (such as losing resolution if charge is lost upstream).
    • Prevent OTRs, screens, etc. working in the case of COTR.
    • A full calculation of the BPM signals -- including phase noise, gain changes, etc. -- for diagnostics studies.
  3. Generation of 'special' beams
    • Integration with Parmela for a full simulation of the beam emitted by realistic RF guns.
    • Simulation of the beam expected from a damping ring.
    • A true macro-particle beam (unlike that existing in Lucretia), where each macro-particle carries information on its mean and second moment.


  1. The UAP has been incorporated as a module named "accformat". This allows AML files to be read directly into the internal format, and also converts from AML to XSIF, MADX, MAD8, and Bmad. The ability to convert the other way needs to be incorporated.
  2. Element generation. Sector bends (neglecting fringe fields), quadrupoles, thin sextupoles, xcors, ycors, & xycors, have been created, along with their calcRmat class, and TrackThruElement.
  3. Rmat calculation. All current elements have this class (some inherit the drift rmat class from the superclass, but only in the cases where this would be expected). The beamline "line" function has a class to calculate R matrices for a sequence of elements.

Physics Notes

Element-by-element comparison with Lucretia

Edit | Attach | Watch | Print version | History: r12 | r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions...

Physics WebpagesRHUL WebpagesCampus Connect • Royal Holloway, University of London, Egham, Surrey TW20 0EX; Tel/Fax +44 (0)1784 434455/437520

Topic revision: r7 - 09 Jul 2009 - StephenMolloy

  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding RHUL Physics Department TWiki? Send feedback