2. DATA INPUT The data is read on unit 5 (FOR005) in free-format (READ(5,*)). There are 6 lines, containing the following parameters : 1) ITYPE, PERIOD, KX, KY, PHASE, N 2) EMIN, EMAX, NE 3) ENERGY, CUR, SIGX, SIGY, SIGX1, SIGY1 4) D, XPC, YPC, XPS, YPS, NXP, NYP 5) MODE, ICALC, IHARM 6) NPHI, NSIG, NALPHA, DALPHA, NOMEGA, DOMEGA A value must be entered for each parameter, even if not relevant for the calculation that is to be performed. Parameters ITYPE, N, NE, NXP, NYP, MODE, ICALC, IHARM, NPHI, NSIG, NALPHA, NOMEGA are integers. The parameters have the following meaning : Line 1 : Undulator ITYPE - either ITYPE=1 : plane/helical/elliptical magnet or ITYPE=2 : crossed undulator PERIOD - magnet period (m) KX, KY - magnet deflection parameters coresponding to a horizontal and vertical field direction respectively PHASE - phase difference between the two undulators in the crossed undulator scheme (degrees) N - number of magnet periods Line 2 : Photon Energy EMIN - minimum photon energy (eV) (>0) EMAX - maximum photon energy (eV) NE - number of photon energy intervals (<5000) Line 3 : Electron Beam ENERGY - electron beam energy (GeV) CUR - electron beam current (A) SIGX, SIGY - rms horizontal and vertical electron beam sizes (mm) SIGX1, SIGY1 - rms horizontal and vertical electron beam divergences (mrad) Line 4 : Observation point and range of acceptance D - distance from centre of undulator to the observation point (m) XPC, YPC - horizontal and vertical position of the observation point or centre of the range of acceptance (mm or mrad) XPS, YPS - TOTAL horizontal and vertical acceptance (mm or mrad) NXP, NYP - number of intervals into which the acceptance is divided in the horizontal and vertical directions (<50) Line 5 : Calculation Method MODE - type of calculation, having the following possible values : MODE=1 angular/spatial flux density distribution at photon energy EMIN In this case EMAX, NE are irrelevant. MODE=2 spectrum of angular/spatial flux density at position XPC, YPC In this case XPS, YPS, NXP and NYP are irrelevant. MODE=3 spectrum of on-axis brightness. In this case D, XPC, YPC, XPS, YPS, NXP and NYP are irrelevant. MODE=4 spectrum of flux integrated over the defined range of acceptance. MODE=5 spectrum of flux integrated over all angles In this case D, XPC, YPC, XPS, YPS, NXP and NYP are irrelevant. MODE=6 angular/spatial distribution of power density in a given harmonic or range of harmonics; central power density and integrated power over the range of acceptance, listed for each harmonic In this case EMIN, EMAX, NE are irrelevant Note : to increase the options available MODE=-6 can also be used (see below under IHARM). ICALC - calculation method, having the following possible values : For MODE=1,2,3,4 : ICALC=1 non-zero emittance, finite N ICALC=2 non-zero emittance, infinite N ICALC=3 zero emittance, finite N For MODE=5 : ICALC=1 finite N ICALC=2 infinite N For MODE=6 : ICALC=1 non-zero emittance ICALC=2 zero emittance IHARM - number of harmonics to be included, having the following values : For MODE=1,2,3,4,5 with ICALC=1,2 : IHARM=-1 include all harmonics contributing at a given point and given photon energy IHARM=0 use only the lowest order contributing harmonic IHARM=i use only the i'th harmonic For MODE=1,2,3,4 with ICALC=3 : IHARM is not relevant For MODE=6 : IHARM=i angular/spatial distribution of power density for harmonic i IHARM=-i include all harmonics from 1 to i MODE=-6 : angular/spatial distribution of power density for each harmonic + angular/spatial distribution of power density for sum of harmonics + central power density and integrated power for each i MODE=6 : angular/spatial distribution of power density for sum of harmonics + central power density and integrated power for each i IHARM=0 include harmonics up to some limit determined by the program MODE=-6 or MODE=6 as above LINE 6 : Calculation Parameters - All of the following parameters can be set to zero in which case they default to the values given in brackets []. NPHI - no. of steps in phi between 0 and pi/2.0 [20]. NPHI < 100. used in (MODE=1,2,3,4,5 ICALC=1,2) NSIG - no. of standard deviations of electron beam dimensions (size and divergence) to be included [4]. used in (MODE=1,2,3,4 ICALC=1,2) and (MODE=6 ICALC=1) NALPHA - no. of steps in angle alpha (gamma*theta) [15]. NALPHA < 100. used in (MODE=1 ICALC=1). DALPHA - range of angles in alpha**2 to be used, in units of the angular equivalent of 1/N [2.0]. used in (MODE=1 ICALC=1) and ICALC=3. NOMEGA - no. of steps in photon energy for the natural lineshape [16]. NOMEGA < 5000. used in (MODE=2,3,4,5 ICALC=1) DOMEGA - range of photon energies to be included in the natural lineshape in units (energy of fundamental/N) [2.0] i.e. the default value covers the range +/- 2/N of the natural lineshape. used in (MODE=2,3,4,5 ICALC=1) NOTES : i/ For (MODE=2,3,4,5 ICALC=1 ITYPE=1) the finite N spectrum is obtained by convoluting the infinite N spectrum with the natural lineshape. To make this easy the point spacing in photon energy must be the same for the two curves. This can be achieved as follows : - set NE=0, in which case the spacing is set by the values of NOMEGA and DOMEGA and NE is set accordingly. - set NE to the approximate number of points desired in the energy range EMIN,EMAX. A new value of NE is then calculated which gives the closest match with the spacing of the natural lineshape. In either case EMAX will also be adjusted so that the convolution can be carried out correctly over the defined energy region. In order to get an accurate convolution the program insists that the rule (NOMEGA/DOMEGA) >= 4 is respected. ii/ In cases with non-zero emittance (MODE=1,2,3,4,ICALC=1,2 and MODE=6, ICALC=1) both SIGX and SIGY may be zero, but both SIGX1 and SIGY1 must be non-zero. iii/ If D is set to zero, this indicates that angular flux and power density is to be calculated rather than spatial flux and power density in MODEs 1,2,4 and 6. In this case SIGX and SIGY are ignored, and the acceptance (XPC, YPC, XPS, YPS) is entered in mrad rather than mm units. iv/ If the acceptance is centred on the axis (XPC=YPC=0.0) then only one quarter of the acceptance needs to be calculated because of symmetry. In this case the range from (0,0) to (XPS/2.0,YPS/2.0) will be divided into NXP, NYP intervals. The printed values of integrated flux and power, including Stokes parameters will however be correct for the total acceptance. v/ Theta (alpha/gamma) is the angle between the undulator axis and the direction of observation. Phi is the angle between the projection of the angle of observation in the x-y plane and the x-axis. vi/ MODE=6 : In addition to power density the program now also prints total flux density (photons/s/mrad**2 or mm**2), and as well as integrated power the total flux (photons/s). The central value means at the centre of the defined acceptance in the case of a 2D acceptance (NXP>0, NYP>0). In other cases it refers to the first point. It is permitted to enter NXP=0 or NYP=0 to obtain values of the power density for example as a function of vertical or horizontal position (angle) respectively. vii/ For the crossed undulator (ITYPE=2) the following special rules apply : - KX is set to 0.0; both undulators are assummed to have deflection parameter KY - each undulator is assumed to have N periods - only MODE = 1, 2 or 4 can be used - NPHI <= 25 - The calculation method is different to that for standard magnets (ITYPE=1); finite N is taken into account directly and no convolution with the natural lineshape is necessary. ICALC=1 or ICALC=2 can be entered equally; NOMEGA and DOMEGA are irrelevant. DALPHA is needed in all cases, NALPHA for ICALC=1,2.