
Step I  The Magnetic LatticeThe coarse layout of the undulator is defined by the undulator period length (XLAMD), the number of periods (NWIG) and number of modules (NSEC). In this coarse lattice the FODO lattice has to fit in a way that a new undulator module starts after the last FODO cell of the section is complete. The length of a FODO cell is determined by FL + DL +2*DRL. Thus the number of FODO cells per undulator section is given by the next higher integer of the ratio between NWIG and the FODOcell length. As an example with NWIG = 100, NSEC = 2, FL = 4.0, DL = 4.0 and DRL = 8.0 there are 5 FODO cells per section and the two undulator modules are separated by a gap of 20 undulator periods. If F1ST is set to half the value of FL the FODO cell starts in the center of the first quadrupole, which simplifies the matching of the electron beam (ALPHAX, ALPHAY=0). Set AWD to the same value as AW0. Similar XKX and XKY should agree with the definition of the undulator (0.0, 1.0 for planar undulator (IWITYP = 0) or 0.5, 0.5 for helical undulator (IWITYP = 1)). It is recommended that the coupling factor is calculated automatically by setting FBESS0 to zero. Disable tapering and undulator field errors. Finally set the integration step with DELZ so that it can resolve FL, DL, DRL and F1ST. In the example above possible choices are 0.5, 1.0 or 2.0. 