- description: Converts data of the form B
_{ρ}(z,ϕ) into a set of generalized gradients [50] for use with elegant’s BGGEXP element. - synopsis:
computeGeneralizedGradients -input filename -output rootname -mainHarmonic integer -nHarmonics integer [-allHarmonics 1]

- switches:
- input — Give the name of the input file, which must be an SDDS file having two columns and two parameters. The columns are phi and Br, giving respectively the polar angle in radians and the radial magnetic field in Tesla. Each page should have the same number of rows n. The phi values are assumed to be equispaced starting at 0 and ending at 2π(1 - 1∕n). The pages are labeled by the parameter z, which gives the longitudinal coordinate in meters for the data on that page. These z values are assumed to be equispaced and to cover the entire length of the magnet, starting and ending well outside the magnet. (For periodic systems, the onePeriod option may be appropriate. See below.) Finally, a parameter R must exist that gives the radius in meters for the Br values.
- output — Give the root name for the output files. The main output file, which has extension ggrad and is used directly with the BGGEXP element, will contain the generalized gradients for the normal (non-skew) components of the magnetic field. Each page corresponds to a different harmonic.
- mainHarmonic — The main harmonic of the field, where 2 is quadrupole, 3 is sextupole, etc. For fields with several designed-in harmonics, use the lowest, and see the entry for allHarmonics.
- nHarmonics — The number of harmonics to include.
- allHarmonics — Normally, only allowed harmonics of the main harmonic are included. However, if the magnet has several main harmonics (e.g., a combined-function quadrupole and sextupole), this may be inappropriate. In that case, use this option to force use of all harmonics greater than the given main harmonic.

- authors: M. Borland, R. Lindberg (ANL/APS).

computeRBGGE