LAUE SCALING MODULE (LSM) ========================= Version: 1.0 John Campbell, Steffi Arzt, Hao Quan & Marjorie Harding CONTENTS -------- CHAPTER 1: THE LAUE SCALING MODULE (LSM) 1.1 INTRODUCTION 1.2 The Scaling Function and Requirements 1.3 The Laue Scaling Module Parameters 1.4 The Function Minimised 1.5 The Laue Integrated Reflections List (LIRL) 1.6 The MTZ Integrated Reflection Data File CHAPTER 2: THE SCALING FUNCTION 2.1 INTRODUCTION 2.2 The Lorentz Factor 2.3 The Polarisation factor 2.4 The Obliquity Correction 2.5 The Plate Scaling Factor 2.6 The Pack Scaling Factor 2.7 The Reference Scaling Factor 2.8 The Wavelength Normalisation Curve 2.9 The Absorption Correction CHAPTER 3: LAUE SCALING MODULE (LSM) ROUTINES 3.1 INTRODUCTION 3.2 Setting up the Laue Scaling Module (LSM) 3.2.1 Introduction 3.2.2 Set up keyworded parameters - LSM_KEYSETUP 3.2.3 Set up other LSM parameters - LSM_PARSETUP 3.2.4 Select absorption option - LSM_ABSOPT 3.3 Copy KDM Stored LSM Data to/from Internal Scaling Arrays 3.3.1 Introduction 3.3.2 Copy LSM parameters to/from internal storage - LSM_KDMCOPY 3.4 Select and Find Reflection Sets 3.4.1 Introduction 3.4.2 Omit packs - LSM_OMIT 3.4.3 Select packs and plates - LSM_SELECT_PKPL 3.4.4 Add packs and plates to selection - LSM_ADD_PKPL 3.4.5 Clear packs and plates from selection - LSM_CLR_PKPL 3.4.6 Select reflection types - LSM_SELECT_SCREFS 3.4.7 Reset to top of LIRL - LSM_TOP_LIRL 3.4.8 Get reflection set from LIRL - LSM_NEXT_REFLN 3.4.9 Get LIRL reflection index- LSM_INDX 3.4.10 Get scaling factor for a reflection - LSM_SCFAC 3.5 LSM Refinement Routines 3.5.1 Introduction 3.5.2 Set LSM parameter refinement flags - LSM_SET_RFLAGS 3.5.3 Add a LSM parameter refinement flag - LSM_ADD_RFLAG 3.5.4 Clear a LSM parameter refinement flag - LSM_CLR_RFLAG 3.5.5 General LSM refinement routine - LSM_REFINE 3.5.6 Refine local absorption correction - LSM_ABSCOR_RFN 3.6 Multiples deconvolution 3.6.1 Introduction 3.6.2 Multiples deconvolutions LSM_MULTIPLES_DECONV 3.6.3 Reset to top of LIRL - LSM_TOP_MULTS_LIRL 3.7 Miscellaneous LSM Routines 3.7.1 Introduction 3.7.2 Return maximum numbers of plates and packs - LSM_MAXPKPL 3.7.3 Set up other LSM parameters - LSM_PARSETUP_LDM 3.8 Setting up the Laue Scaling Parameters LSP 3.8.1 Introduction 3.8.2 Set up LSP Parameters - LSM_SETLSP 3.9 LSP Based Convenience Routines 3.9.1 Introduction 3.9.2 Set up other LSM parameters - LSM_PARSETUP_LSP 3.9.3 Select absorption option - LSM_ABSOPT_LSP 3.9.4 Select reflection types - LSM_SELECT_SCREFS_LSP 3.9.5 Omit packs from processing - LSM_OMIT_LSP 3.10 Analysing the Intensity Statistics after Scaling 3.10.1 Introduction 3.10.2 Prepares graphic windows for statistics output - LSC_GRAPHSETUP 3.10.3 Calculates and outputs statistical data - LSC_ANALYSES 3.10.4 Refines reference set scale factors - LSC_SCALESTAT_OUT 3.10.5 Output of reference set scaling results - LSC_HIST 3.10.6 Graphical output of scaling results - LSC_MENU1 3.10.7 Graphical output of scaling results - LSC_MENU1ABS 3.10.8 Graphical output of scaling results - LSC_MENU2 3.10.9 Graphical output of scaling results - LSC_MENU2ABS 3.10.10 Graphical output of scaling results - LSC_MENU3 3.10.11 Graphical output of scaling results - LSC_MENU3ABS 3.10.12 Get R-factor tables data - LSC_RFACTS_LSP 3.10.13 Output of RSCALE of multiples vs. reference data - LSC_MULT_ANALOG 3.10.14 Outputs mtz- and/or shelx-files - LSC_FILE_OUTPUT FIGURES: CHAPTER 1 1.1 Flowchart of LSM based scaling FIGURES: CHAPTER 2 2.1 Diagram of Absorption Correction Coordinates CHAPTER 1: THE LAUE SCALING MODULE (LSM) ======================================== 1.1 INTRODUCTION The Laue Scaling Module (LSM) development followed some of the basic ideas of the Laue Data Module (LDM) which defined a set of parameters relating to the initial stages of processing Laue X-ray diffraction data. It defines a set of keyworded parameters for all the scaling parameters required to scale a raw integrated intensity value to a fully corrected intensity value. A series of subroutines for handling and refining these parameters and for scaling intensity data form part of the LSM. The LSM makes use of a Laue Integrated Reflection List (LIRL) use to store Laue data internally within a program and a new MTZ reflection data file format is available as an alternative to the .ge1/.ge2 files. In addition to the LSM parameters, a number of other parameters will be required to form a complete set of keyworded parameters for a stand alone Laue scaling, normalisation and absorption correction program. A set of Laue Scaling Parameters (LSP) has, for example, been developed for the LSM based scaling program LSCALE. The LSM scaling parameters and related routines are designed so that they could be used in an extended LDM parameter set or in some other context not using either the LSP or extended LDM. The main set of LSM routines are written to be program independent. A clear distinction is made between the Laue Scaling Module itself and the context in which it is used. List of sections: The Scaling Function and Requirements The Laue Scaling Module Parameters The Function Minimised The Laue Integrated Reflections List (LIRL) The MTZ Integrated Reflection Data File 1.2 THE SCALING FUNCTION AND REQUIREMENTS The overall scaling funtion required to convert the raw integrated intensity of a spot to a corrected intensity value. The scaling consists of a series of components as follows: foverall = fL * fP * fOb * fPlate * fPack * fReference * fLambda * fAbs A detailed description of the scaling function components and the relevant equations can be found in Chapter 2 . The basic purpose of the LSM is to provide a series of keyworded items for the parameters required to calculate this overall scaling function. The LSM also provides a set of routines to refine the values of these parameters, where appropriate, given a set of starting values. Normally the LSM default parameter values should provide an adequate starting point so that the LSM routines can be used in practice to both determine and refine the scaling parameters. A basic scaling program using LSM will thus take a starting set of scaling parameters (which will in most cases will be the default values) and determine a refined set of scaling parameters which will be used to scale the intensity data and which will be written out to an updated LSM parameters file. The basic procedure followed in an LSM based program is illustrated in the following figure: Figure 1.1 Flowchart of LSM based scaling (at end of chapter) The LSM allows for internal wavelength normalisation using symmetry equivalents data and also for wavelength normalisation against a reference data set. It also allows the determination of plate/plate scaling factors where required. Routines are also supplied to carry out the deconvolution of multiple reflections using symmetry equivalent data and the variation of the wavelength normalisation function. This is also combined with any data from multiple plates data if present. The multiples data is stored along with the singles data in the internal reflections list so that it is available when required. A summary of the basic options is as follows with an indication of how they are carried out where this is not immediately obvious. 1) Lorentz, Polarisation and Obliquity corrections. 2) Plate to plate scaling - several wavelength ranges may be used. 3) Pack to pack scaling (scale and temperature factor). 4) Wavelength normalisation withoutbinning the data. The normalisation curve is modelled using Chebyshev polynomials. Several wavelength ranges may be used. 5) Scaling against a reference set of data (scale and temperature factor) This may be used for determining the scaling parameters against the set of reference data or just to provide statistics with respect to a reference set of data after an internal refinement of the scaling parameters. 6) Absorption correction.There are options for a local (pack by pack) absorption correction or a global absorption correction for the dataset. These are described in detail in Chapter 2 . 7) Sign separated data may be used if required. 8) Wavelength separated reference data may be used. This is done by storing the appropriate reference intensity alongside the reflection in the LIRL which allows for such a value to be stored for each reflection. If the parameters are then refined against reference data, the requirement will automatically be taken care of by the nature of the function minimised (see below) 9) The LIRL contains some additional columns for use exclusively by the LSM routines. These store pre-calculated terms to provide maximum efficiency for the calculation of scaling factors which are critical to the performance of the refinement procedure. Note:The LSM routines assume that all packs refer to the same crystal orientation with the packs being related by a rotation around the spindle axis. This condition mustbe satisfied if the global absorption correction is to be applied. The related development of the Laue Integrated Reflection List (LIRL), described in more detail below, provides a simpler and more flexible way of handling the reflection data internally and this is used within the LSM routines. 1.3 THE LAUE SCALING MODULE PARAMETERS The following table specifies the keywords and data items for the LSM parameters. The keywords are case insensitive. They may be abbreviated in some cases and in the following list the upper case portion of the name indicates the minimum number of characters which must be given (any keyword with a range number must be given in full). Keyword names followed by one or two pairs of square brackets indicate pack or plate dependent parameters respectively as in the LDM specification. POL_Type code Polarisation correction type Alternative codes: xray neutron (default = 'xray' as currently used in AFSCALE/LAUENORM) POL_Fac tau Polarisation factor (default = 1.0 as currently used in AFSCALE/LAUENORM) COVER_Fac ut Factor to take account of front sheet(s). Factor applied is: exp(ut/cos(2*theta)) (default = 0.0 cf value of .105 currently used in AFSCALE/LAUENORM). PLATE_SCALE_r[][] almin almax kappa ups Plate to top plate scaling factors of the form: kappa*exp(ups*lam**3) 'r' is a wavelength range number and almin and almax are the wavelength limits for that range. (default 0.0 0.0 1.0 0.0 - note that a lambda range of 0.0 to 0.0 is taken to mean undefined) IMAGE_SCale[] scal Relative scale factor for the pack (image). (default = 1.0) IMAGE_BFac[] bfac Relative temperature factor for the pack (image). (default = 0.0) REFSET_Scale scal Scale factor from reference data set. (default = 1.0) REFSET_Bfac bfac Temperature factor from reference data set. (default = 0.0) NORM_Lamref alam Reference wavelength for wavelength normalisation curve (in Angstroms). (default = 1.0) NORM_COEFF_r nord almin almax P{...} Wavelength normalisation parameters. 'r' is a wavelength range number, nord is the order for the Chebyshev polynomial and almin and almax are the wavelength limits for the range. P{...} are the Chebyshev polynomial coefficients (nord+1 values). The specified wavelength range also determines the range used to normalise the coordinates for the Chebyshev polynomials. (default = 0 0.5 1.5 2.0 for range 1 or 0 0.0 0.0 2.0 (= un-defined) for the other ranges) The maximum allowed number of polynomial coefficients is a program parameter set at 200 in the standard version. ABSCOR_Lamref alam Reference wavelength for absorption correction (in Angstroms) (default = 1.0) ABSCOR_Mu C [A] or ABSCOR_Mu alam1 mu1 alam2 mu2 ... Parameters used in determining the wavelength dependent linear absorption coefficient used in the absorption correction. If one value is given, it is taken as being the coefficient 'C' with mu = C*lam**3. If two values are given, they are taken as being the coefficients 'C' and 'A' with mu = A + C*lam**3. If more than two values are given, they are interpreted as a table of pairs of lambda and mu values and the value for a particular wavelength will be interpolated linearly from this table. This option allows for the treatment of cases where there may be absorption edges within the Laue wavelength range. The lambda values must be in ascending order of magnitude. The maximum allowed number of pairs is a program parameter set at 100 in the standard version. The pairs of values should cover the complete wavelength range required but linearly extrapolated values from the two nearest end points of the range will be used for any reflections found with lambda values outside the range defined by the table. (default = 1.0 i.e. mu = lam**3) ABSCOR_Thick[] t0 General path length in mm through crystal at nu=0.0, psi=0.0 (local to the pack) (default = 1.0) ABSCOR_Local[i] nord mord psimin_loc psimax_loc numin numax P{...} Local (pack based) absorption correction. See Appendix 1 for details. P{...} are the Chebyshev polynomial coefficients excluding the P(0,0) term ((nord+1)*(mord+1)-1 coefficients) The minimum and maximum psi values are the local values relative to the pattern centre for the pack in question (in degrees). If a pair of angle range values are input as 0.0 0.0 then the LSM routines will calculate values based on the current data. (default = 0 0 0.0 0.0 0.0 0.0) The maximum allowed number of polynomial coefficients is a program parameter set at 200 in the standard version. ABSCOR_Global 1 nord mord psimin_glob psimax_glob numin numax P{...} or ABSCOR_Global 2 nord mord P{...} Q{...} Global absorption correction. See Appendix 1 for details. The first term is a flag which determines the surface fitting option =1 Chebyshev polynomials, =2 Fourier coefficients P{...} are the Chebyshev coefficients or P{...}, Q{...} are the Fourier Coefficients. P(0,0) and Q(0,0) are not present. The minimum and maximum psi values are the global values relative to the pattern centre for the first pack in the dataset (in degrees). If a pair of angle range values are input as 0.0 0.0 then the LSM routines will calculate values based on the current data. (default = 1 0 0 0.0 0.0 0.0 0.0) The maximum allowed number of polynomial coefficients is a program parameter set at 200 in the standard version. Notes: 1) For the wavelength range based parameters, PLATE_SCALE and NORM_COEFF, the wavelength ranges input by the user should not overlap. The LSM routines do not check that this condition is met. For any given reflection, the parameters from the first range which includes its wavelength will be used. 2) For the absorption corrections (local or global), polynomial orders of 0 and 0 imply no absorption correction. Where an absorption correction is being used the appropriate non-default parameter values will normally be set for either the global or the local correction. However if non-default values are set for both, then both corrections will be applied. 1.4 THE FUNCTION MINIMISED The function minimised when refining any/all of the LSM scaling parameters is as follows: Sigma ((1/sig(I_laue))*(I_laue - I_mean;reference))**2 For an internal refinement, the sum is over all Laue reflections which belong to a set containing 2 or more equivalent reflections (of the same sign if using sign separated data) passing any required selection criteria. For an external refinement, the sum is over all Laue reflections which have an equivalent reference intensity value input. For internal scaling, the mean;reference intensity value is a weighted mean of the intensities (scaled using the current values of the scaling parameters) for all the equivalent reflections passing any required selection criteria. For sign separated data, the equivalents must be of the same sign to be included in the mean. For external scaling, the mean;reference intensity value is the reference intensity value which has been stored for the reflection in question in the LIRL. This could be the same value for all the symmetry equivalents or could come from sign and/or wavelength separated reference data. The main difference in the scaling parameters refinement procedure between the internal and external cases is the choice of the value used for the mean reference intensity used in the function being minimised. The reflections included will also, in general, be different as the internal method requires symmetry equivalents whereas this is not a requirement for the external method. 1.5 THE LAUE INTEGRATED REFLECTIONS LIST (LIRL) For collating reflection data after integration, and for use in scaling or normalisation or multiples deconvolution, an internal data storage format, the Laue Integrated Reflection List (LIRL) has been defined. This is implemented via routines written in 'C' and makes use of the 'DML' memory allocation routines so that large fixed size arrays need not be allocated. Allowance is made for several such internal reflection lists to be used simultaneously where this is required. The items stored are divided into three categories, standard items, additional optional items and LSM specific temporary items. 1) The standard items h, k, l Indices (as measured) (for lowest harmonic present for a multiple) ksym No. of symmetry operation which converts measured indices to unique indices. 0 if not yet determined. pack Pack number (>0) (or index to pack list) (0-65535) plate Plate number (max 255) xfd X coordinate (for units see below) yfd Y coordinate (for units see below) lambda Wavelength (for lowest harmonic present for a multiple) intensity Integrated intensity sigint sig(Intensity) mult_flags Multiplicity flags (includes multiplicity, minimum harmonic, maximum harmonic and harmonic increment) spov Spatial overlap flag clos Too close to deconvolute flag measured Spot has been integrated flag ovld Overload flag bad Bad intensity (other than overload) flag icode Integration program specific code 0-255 Coordinate units may either be in mm from the pattern centre (ideal or distortion corrected) or in detector raster units. A flag in the header of the list will indicate which type is currently to be used. To allow the continued use of .ge1/.ge2 files, the ideal coordinates in mm from the pattern centre should be those normally used. 2) The additional optional items novpix No. of overloaded pixels stored flag =1 yes, =0 no (if yes value is stored in num_ovpix) num_ovpix This may be used to store the number of pixels in the spot above the overload threshold (0-255). A value of 255 indicates 255 or more overloaded pixels. reference_intensity Reference e.g. monochromatic intensity (may be sign separated as values can be stored for each individual reflection) reference_sigma sigma(reference_intensity) 0.0 if reference intensity value not present. outlier_flag A reflection may be marked as an outlier for use within a program. The use of this flag will be program specific. The flag must be in the range 0-255; 0 indicates that the reflection is OK and any value > 0 indicates an outlier. 3) The temporary items specifically for the LSM routines use_reflection A flag set by LSM_TOP_LIRL indicating, for each reflection, whether or not it is to be returned by routines such as LSM_NEXT_REFLN and LSM_NEXT_REFOBS as determined by the current reflection selection criteria. (For single spots) hkl_unq; Packed unique reflection indices 2**20(h+512)+2**10(k+512)+l+512 norm_range Range no. of normalisation curve to use filmsc_range Range to use for 'plate to plate' scaling abscor_nu 'nu' coordinate for absorption correction surface (in degrees) psi_local 'psi' coordinate for absorption correction surface (local to pack) (in degrees) psi_global 'psi' coordinate for absorption correction surface (global i.e. relative to 1'st pack) (in degrees) stol2 sin(theta)**2/lambda**2 al3c2t lambda**3/(cos(2*theta)) abscor_lamfn Lambda based function as used in absorption correction mu(lam)/mu(lam_ref) or mu(lam) ob_lpfac Combined obliquity factor, Lorentz and Polarisation factor Note: For spots which are multiples, lambda dependent values are those based on the wavelength of the lowest harmonic present for the spot. The scope of the LIRL has been extended to allow for storage of deconvoluted multiple reflections along with the singles and multiples. As the deconvoluted multiples are effectively merged data, many of the items normally stored for a reflection are not relevant and zero values are stored for these. Of the optional items only the reference intensity and its sigma value should need to be used. The special LSM items should not need to be used. Of the standard items, the following are used: h, k, l Indices (as measured or normally, in this case the unique indices) ksym No. of symmetry operation which converts measured indices to unique indices. 0 if not yet determined. Normally 1 for the deconvoluted multiples. intensity Integrated intensity (already normalised and scaled) sigint sig(Intensity) (already normalised and scaled) mult_flags Multiplicity flag = 0 for deconvoluted multiple. measured Spot has been deconvoluted (fixed). Storing the deconvoluted multiples in a LIRL enables them to be easily included in the calculation of statistics (where relevant) or in generating output files from a scaling program. The LIRL handling routines are documented separately. 1.6 THE MTZ INTEGRATED REFLECTION DATA FILE The original Laue suite was based on the generation of .ge1/.ge2 files which served both as a predicted reflection (spot) list and as a permanent storage for the integrated intensities. Their use was retained in the LDM based version of the program LAUEGEN. The .ge1/.ge2 files are rigid in structure, in particular because they assume a six plate pack. The coordinates are stored for the top plate and it is assumed that the spatial overlaps are the same for each plate in the pack, an assumption which causes problems when trying to process data from a 'toastrack' detector arrangement. There is also a problem with intensity values overflowing the limit of 32767 imposed by storing them as two byte integers. A new MTZ reflection file has been specified and, in the first instance, a separate MTZ file will output for each pack.An option will be retained in the LAUEGEN program to output .ge1/.ge2 files to maintain compatibility with other programs in the Laue suite particularly those which are unlikely to be modified to use the new MTZ files or any new features which they may provide. Any new normalisation code will need to be able to merge the data for a reflection from the various plates when needed. Having said this, it is likely that most new Laue data will be measured on a device such as image-plate with only a single plate in a pack and no such merging would be needed. The structure allows for more than one pack of data to be stored in a single file. The file has the following columns: H Measured 'h' index K Measured 'k' index L Measured 'l' index PACK_ID Pack identifier PLATE Plate number within pack XF 'x' coordinate of spot in mm from pattern centre (ideal) YY 'y' coordinate of spot in mm from pattern centre (ideal) LAMBDA Wavelength (Angstroms) I Integrated intensity (real) SIGI Sig(I) (0.0 = not integrated) MULT Multiplicity MINHARM Minimum harmonic number MAXHARM Maximum harmonic number NOVPIX The number of overloaded pixels found in the spot when being integrated (-1 if not determined) FLAGS bit 0 spatial overlap bit 1 too close to integrate bit 2 overload bit 3 bad spot (other than overload) Note: for a multiple h, k, l lambda are for lowest harmonic present. The storage of coordinates as ideal ones in mm from the pattern centre will make it easier to allow for the continued use of .ge1/.ge2 files alongside the new MTZ files. The file may contain additional columns if desired e.g. an integration program may wish to store other flags giving more details on why measurements were rejected. Figure 1.1 Flowchart of LSM based scaling CHAPTER 2: THE SCALING FUNCTION =============================== 2.1 INTRODUCTION The overall scaling factor applied to a raw integrated intensity value is given by: foverall = fL * fP * fOb * fPlate * fPack * fReference * fLambda * fAbs where fL is the Lorentz factor fP is the Polarisation factor fOb is the Obliquity correction fPlate is the Plate scaling factor fPack is the Pack scaling factor fReference is the Reference scaling factor fLambda is the Wavelength normalisation curve fAbs is the Absorption correction List of sections: The Lorentz Factor The Polarisation factor The Obliquity Correction The Plate Scaling Factor The Pack Scaling Factor The Reference Scaling Factor The Wavelength Normalisation Curve The Absorption Correction 2.2 THE LORENTZ FACTOR The Lorentz factor is given by the expression: fL = sin**2(theta) LSM parameters: none 2.3 THE POLARISATION FACTOR The polarisation scaling factor may be one of the following: 1) For X-rays (synchrotron) fP = 2/(1+cos**2(2*theta) - tau*cos (2*psi)*sin**2(2*theta) where 'psi' is the polar angle i.e. psi = acrtan(xf/yf) and 'tau' is the degree of polarisation. 2) For neutrons fP = 1.0 LSM parameters: POL_TYPE and POL_FAC (not refineable) 2.4 THE OBLIQUITY CORRECTION This is a correction made to allow for a covering on the front of the detector. The obliquity scaling factor is: fOb = exp(ut/cos(2*theta)) where 'ut' is the product of the linear absorption coefficient and thickness of the cover material. LSM parameters: COVER_FAC (not refineable) 2.5 THE PLATE SCALING FACTOR The plate to plate scaling factor which scales up the intensities on a lower plate to those on the top plate is given by: fPlate = kappa * exp(ups/cos(2*theta)) where 'kappa' and 'ups' are the coefficients determined for the plate in question and the plate to plate scaling wavelength range appropriate to the wavelength of the reflection being scaled. The scaling factor for the top plate is fixed at 1.0. LSM parameters: PLATE_SCALE_r[][] almin almax kappa ups (plate based parameters with multiple wavelength ranges - 'kappa' and 'ups' are refineable except for the top plate for which any values are, in any case, ignored) 2.6 THE PACK SCALING FACTOR The pack scaling factor scales the intensities to those of the first pack and is calculated from the expression: fPack = Spack * exp(-2.0*Bpack*sin**(theta)/lambda**2) where 'Spack' is the linear scale factor and 'Bpack' is a temperature factor. The scaling factor for the first pack is fixed at 1.0. LSM parameters: PACK_SCALE[], PACK_BFAC[] (pack based parameters - refineable except for the first pack) 2.7 THE REFERENCE SCALING FACTOR This is a scaling factor to scale the Laue data to a reference set of data and is calculated from the expression: fReference = Sreference * exp(-2.0*Breference*sin**(theta)/lambda**2) where 'Sreference' is a linear scale factor and 'Breference' is a temperature factor. LSM parameters: REFSET_SCALE, REFSET_BFAC (refineable) 2.8 THE WAVELENGTH NORMALISATION CURVE The wavelength normalisation curve is modelled in one or more wavelength ranges using Chebyshev polynomials. A reference wavelength 'lamref' (which must lie within one of the ranges) is defined and the wavelength normalisation scaling factor is taken to be 1.0 at that wavelength. For a wavelength range 'lmin' to 'lmax', the normalisation curve is modelled using the following function: nord Sigma Pi*Ti(lam') i=0 whete 'Ti()' are the Chebyshev polynomials and 'Pi' are the polynomial coefficients. Note that the first term of the sum is divided by two following the common convention for Chebyshev polynomials. The normalised wavelength coordinate, lam', is calculated from the wavelength 'lam' as follows: lam' = (2*lam - lmax - lmin)/(lmax - lmin) The normalisation factor for a given value of 'lam' is calculated using the expression: nord nord fLambda = Sigma Pi*Ti(lam') / Sigma Prefi*Ti(lam'ref) i=0 i=0 where 'Pi' are the polynomial coefficients for the normalisation wavelength containing the 'lam' value of the reflection being scaled and 'Prefi' are the polynomial coefficients for the range containing the normalisation reference wavelength 'lamref' Note that the LSM refinement routines will scale any refined polynomial coefficients, for all the ranges, such that the ploynomial expression for the range containing the reference wavelength will evaluate to 1.0 at that reference wavelength; input polynomial coefficients need not, however, already be normalised in such a manner. LSM parameters: NORM_LAMREF, NORM_COEFF_r nord almin almax Pi{...} (dataset based but in wavelength ranges - 'Pi' are refineable) 2.9 THE ABSORPTION CORRECTION The path dependent component of the absorption scaling factor fAbs(lambda) (not taken care of by the wavelength normalisation factor fLambda) is a (lambda, psi, nu) dependent function based on polar coordinates as shown in the following diagram: Figure 2.1 Diagram of Absorption Correction Coordinates (at end of chapter) The function may be expressed as: fAbs = exp (mu(lam)*Pg) where 'mu(lam)' is the wavelength dependent linear absorption coefficient and where 'Pg' is a general path length through the crystal (a function of 'psi', 'nu'). Int the Laue Scaling Module mu(lam) may be calculated for input coefficients using the expression: A + C*lam**3 or interpolated from a table of input values. In the LSM there are options to carry out a global correction for the whole dataset or a local absorption correction for each individual pack. For the global correction, all 'psi' values are relative to the pattern centre for the first pack. For a local correction, the 'psi'values are relative to the pattern centre for the pack in question. Two options for the actual function to be modelled are allowed. The first of these models the (normalised) general path length 'Pgnorm' as a function of 'psi' and 'nu'. This will have a value of 1.0 at psi=0.0, nu=0.0. The second option models the actual (normalised) absorption scaling factor itself 'Nlamref'with respect to a reference wavelength. This will also have a value of 1.0 at psi=0.0, nu=0.0. This latter option should have the advantages that it relates directly to the scaling and should be potentially more stable in a refinement as it does not need to be related to the applied scaling factor through an exponential. For a global absorption correction, the selected function may be modelled using either Chebyshev polynomials, within angular ranges of 'psimin' to 'psimax' and 'numin' to 'numax' matched to the range of angles actually present, or using Fourier coefficients which model the whole of angular space. For a local absorption correction, the selected function will be modelled using Chebyshev polynomials within an angular range of 'psimin' to 'psimax' and 'numin' to 'numax' matched to each individual pack. If the normalised general path length 'Pgnorm' is modelled, the scaling factor required is calculated from the expression: fAbs(lam) = exp (mu(lam)*t0*Pgnorm) where 't0' is the (general) path length through the crystal at psi=0.0, nu=0.0. If the normalised absorption scaling factor 'Nlamref' is modelled, the scaling factor required is calculated from the expression: fAbs(lam) = (knorm*Nlamref)**(mu(lam)/mu(lamref)) where knorm = exp(mu(lamref)*t0) and where 't0' is the (general) path length through the crystal at psi=0.0, nu=0.0. Options are available to model these functions using either Chebyshev or Fourier coefficients. 1) Chebyshev Polynomials This option may be used with a global or local absorption correction. The functions are modelled as follows: nord mord Pgnorm(psi,nu) = Sigma Sigma Pij*Ti(psi')*Tj(nu') i=0 j=0 or nord mord Nlamref(psi,nu) = Sigma Sigma Pij*Ti(psi')*Tj(nu') i=0 j=0 where 'Ti()', 'Tj()' are the Chebyshev polynomials and 'Pij' are the polynomial coefficients. Note that the first terms for each half of the sum are divided by two following the common convention for Chebyshev polynomials and hence the first term of the overall summation is divided by four. The function is calculated within bounds 'psimin' to 'psimax' and 'numin' to 'numax'. The normalised coordinates psi', nu' are calulated from psi, nu as follows: psi' = (2*psi - psimax - psimin)/(psimax - psimin) nu' = (2*nu - numax - numin)/(numax - numin) To ensure that the value at psi=0.0, nu=0.0 is 1.0, the first coefficient is calculated from the values of the remaining coefficients as follows: nord mord P(0,0) = 4.0*(1.0 - Sigma Sigma Pij*Ti(psi'(0,0))*Tj(nu'(0,0)) ) i=0 j=0 calculated with P(0,0) set to 0.0. P(0,0) is not refined or input/output as an LSM parameter. 2) Fourier Coefficients This option may only be used with a global absorption correction. The functions are modelled as follows: nord mord Pgnorm(psi,nu) = Sigma Sigma [Pij*sin(i*psi+j*nu) + Qij*cos(i*psi+j*nu)] i=0 j=0 or nord mord Nlamref(psi,nu) = Sigma Sigma [Pij*sin(i*psi+j*nu) + Qij*cos(i*psi+j*nu)] i=0 j=0 To ensure that the value at psi=0.0,nu=0.0 is 1.0, the coefficient Q(0,0) is calculated from the values of the remaining coefficients as follows: nord mord Q(0,0) = 1.0 - Sigma Sigma [Pij*sin(i*psi+j*nu) + Qij*cos(i*psi+j*nu)] i=0 j=0 calculated with Q(0,0) set to 0.0. Note also that P(0,0) can make no contribution to the function. Thus these two parameters are not refined or input/output as LSM parameters. LSM parameters: ABSCOR_MU C [A] or ABSCOR_MU alam1 mu1 alam2 mu2 ... (fixed) ABSCOR_THICK[] (pack based - fixed) plus 1) For a global absorption correction Chebyshev modelling ABSCOR_GLOBAL 1 nord mord psimin_glob psimax_glob numin numax p{...} P{...} refineable except for P(0,0) (omitted), others all fixed. Fourier modelling ABSCOR_GLOBAL 2 nord mord P{...} Q{...} P{...} refineable except for P(0,0) (omitted), Q{...} refineable except for Q(0,0) (omitted), others all fixed. 2) For a local absorption correction ABSCOR_LOCAL[] nord mord psimin_loc psimax_loc numin numax P{...} P{...} refineable except for P(0,0) (omitted), others all fixed. Figure 2.1 Diagram of Absorption Correction Coordinates CHAPTER 3: LAUE SCALING MODULE (LSM) ROUTINES ============================================= 3.1 INTRODUCTION These are sets of routines which provide some machine independent functions for implementing the Laue Scaling Module (LSM). The LSM routines are designed so that they can be used in a number of different contexts including that of the Laue Data Module (LDM). Also included are an associated set of Laue Scaling Parameter (LSP) routines designed to form the basis of a stand-alone Laue scaling, normalisation and absorption correction program. The following sets of routines are available: Setting up the Laue Scaling Module (LSM) Copy KDM Stored LSM Data to/from Internal Scaling Arrays Select and Find Reflection Sets LSM Refinement Routines Multiples deconvolution Miscellaneous LSM Routines Setting up the Laue Scaling Parameters LSP LSP Based Convenience Routines Analysing the Intensity Statistics after Scaling 3.2 SETTING UP THE LAUE SCALING MODULE (LSM) 3.2.1 Introduction Routines are available to set up the LSM scaling parameters and related data prior to using the other LSM based routines provided. LSM_KEYSETUP needs to be called to set up the LSM keyworded scaling parameters, LSM_PARSETUP (or an associated routine) needs to be called to set up other parameters required by the LSM routines and LSM_KDMCOPY needs to be called to copy the read in LSM parameter values to a set of internal scaling arrays (SCP) used by the LSM routines. The following routines are available: Set up keyworded parameters - LSM_KEYSETUP Set up other LSM parameters - LSM_PARSETUP Select absorption option - LSM_ABSOPT 3.2.2 Set up keyworded parameters - LSM_KEYSETUP This routine defines the LSM (Laue Scaling Module) set of keyworded parameters. These are considered to be a set of parameters to be used in addition to some other keyworded set of parameters (e.g. an LDM set of parameters) which contains parameters such as the number of packs and plates, symmetry, crystal to image distances and spindle angles etc. (Values of such parameters will be passed to the LSM using a routine such as LSM_PARSETUP, again prior to using the other sets of LSM routines) Fortran call: SUBROUTINE LSM_KEYSETUP (KDX) Parameters: KDX i (R) The index of the keyword set to which the LSM keyworded scaling parameters are to be added) 3.2.3 Set up other LSM parameters - LSM_PARSETUP This routine (or one of its alternatives) needs to be called to set up the parameters required by the LSM routines in addition to those defined within the LSM parameter set itself. Remember to call this routine again if any of the previously passed parameter values have changed. Fortran call: SUBROUTINE LSM_PARSETUP (NPACK, NPLATES, SPIN, CTF, IDIM, CELL) Parameters: NPACK i (R) Number of packs NPLATES() i (R) Number of plates/pack for each pack SPIN() r (R) 'spindle' value for each pack (cf LDM parameters) CTF() r (R) 'ctof' value for each plate and pack - dimensioned CTOF(IDIM, *) - IDIM must be at least NPACK. First index packs, 2'nd index plates IDIM i (R) First dimension of CTF array CELL(6) r (R) Cell parameters A, B, C, ALPHA, BETA, GAMMA 3.2.4 Select absorption option - LSM_ABSOPT This routine is used to select the absorption correction option. The options are to model eitherthe gerneral path length, pg, or a normalised absorption scaling factor. It must be called prior to carrying out any LSM scaling or refinement. Fortran call: SUBROUTINE LSM_ABSOPT (IOPT) Parameters: IOPT i (R) Flag =1 model absorption general path length (pg) =2 model normalised absorption scaling factor 3.3 COPY KDM STORED LSM DATA TO/FROM INTERNAL SCALING ARRAYS 3.3.1 Introduction A routine is available to copy the LSM data as stored by the keyword handling routines to and from a set of internal scaling arrays (SCP) which are used to provide temporary storage during a refinement and to provide efficient access during scaling. The following routines are available: Copy LSM parameters to/from internal storage - LSM_KDMCOPY 3.3.2 Copy LSM parameters to/from internal storage - LSM_KDMCOPY This routine is used to copy the current values of the LSM parameters as held in the associated KDM arrays to or from the internal scaling arrays (SCP) used internally by the scaling and refinement functions of the LSM set of routines. Fortran call: SUBROUTINE LSM_KDMCOPY (IOPT, IERR, ERRSTR) Parameters: IOPT i (R) Flag =1 copy from KDM to internal scaling arrays (e.g. prior to using any scaling functions) =2 copy from internal scaling arrays to KDM (e.g. after refining any scaling parameters) IERR i (W) Error flag = 0 OK = 1 Error ERRSTR c (W) Error string if IERR is non-zero 3.4 SELECT AND FIND REFLECTION SETS 3.4.1 Introduction These are a series of routines to set which classes of singles reflections are to be retrieved from a Laue Integrated Reflection List (LIRL) for use in LSM parameter refinement or analysis or scaling of the reflection data. The following routines are available: Omit packs - LSM_OMIT Select packs and plates - LSM_SELECT_PKPL Add packs and plates to selection - LSM_ADD_PKPL Clear packs and plates from selection - LSM_CLR_PKPL Select reflection types - LSM_SELECT_SCREFS Reset to top of LIRL - LSM_TOP_LIRL Get reflection set from LIRL - LSM_NEXT_REFLN Get LIRL reflection index- LSM_INDX Get scaling factor for a reflection - LSM_SCFAC 3.4.2 Omit packs - LSM_OMIT This routine is used to omit selected packs from the scaling process. The reflections from such packs will not be used in determining or refining any scaling parameters and will not be included in any R-factor analyses done using the supplied LSM routines. It is intended to provide a simple means of excluding poor packs without having to make extensive modifications to the input LSM containing data file. This will normally be called before using routines LSM_SELECT_PKPL (and related routines), LSM_SET_RFLAGS (and related routines) and LSC_RFACTS (and related routines). Such routines will need to be called again if the list of omitted packs is changed. The routine may also be used to clear the omitted packs list. On program startup, there will be no omitted packs Fortran call: SUBROUTINE LSM_OMIT (NOMIT, IPACKS) Parameters: NOMIT i (R) No. of packs to be omitted (0 clears the omitted packs list) IPACKS() i (R) If NOMIT > 0 then this array gives a list of the NOMIT packs to be omitted; if NOMIT = 0, a dummy array may be given. 3.4.3 Select packs and plates - LSM_SELECT_PKPL This routine is used to select the packs and plates for which data are to be retrieved from the LIRL. This must be called prior to using routines such as LSM_NUM_NEXT or LSM_NEXT_REFLN and the LSM service routines LSM_NEXT_REFOBS. After calling this routine, the selection may be modified using LSM_ADD_PKPL or LSM_CLR_PKPL. This routine overrides any previous selections. Remember also to select the required reflection classes using LSM_SELECT_SCREFS. Note that packs defined via LSM_OMIT will always be omitted. Fortran call: SUBROUTINE LSM_SELECT_PKPL (IPACK, IPLATE) Parameters: IPACK i (R) No. of pack to select (0 = all packs) IPLATE i (R) No. of plate to select (0 = all plates) 3.4.4 Add packs and plates to selection - LSM_ADD_PKPL This routine is used to add further packs/plates to the selection made by LSM_SELECT_PKPL. Note that packs defined via LSM_OMIT will always be omitted. Fortran call: SUBROUTINE LSM_ADD_PKPL (IPACK, IPLATE) Parameters: IPACK i (R) No. of pack to add to the current packs/plates selection (0 = all packs) IPLATE i (R) No. of plate to add to the current packs/plates selection (0 = all plates) 3.4.5 Clear packs and plates from selection - LSM_CLR_PKPL This routine is used to clear packs/plates from the selection made by LSM_SELECT_PKPL. Fortran call: SUBROUTINE LSM_CLR_PKPL (IPACK, IPLATE) Parameters: IPACK i (R) No. of pack to clear from the current packs/plates selection (0 = all packs) IPLATE i (R) No. of plate to clear from the current packs/plates selection (0 = all plates) 3.4.6 Select reflection types - LSM_SELECT_SCREFS This routine is used to select the types of scaleable reflection that are to be retrieved from a Laue Integrated Reflections List (LIRL). This must be called prior to using routines such as LSM_NUM_NEXT or LSM_NEXT_REFLN and the LSM service routines LSM_NEXT_REFOBS. Any reflections which are flagged in the LIRL as not measured, bad or outliers will be omitted and any reflections, for which sclaing parameters lie outside the ranges defined, will also be omitted on retrieval. Remember also to select the required packs/plates using LSM_SELECT_PKPL and associated routines. Fortran call: SUBROUTINE LSM_SELECT_SCREFS (SIGN_SEP, REFERENCE, SIGMA_CUT, + SPOV, OVLD) Parameters: SIGN_SEP l (R) If .true. the I+ and I- measurements will be returned as separate reflection sets; if .false. all symmetry equivalents bot I+ and I- will be returned together. REFERENCE l (R) If .true. then only reflections which have a reference intensity stored will be returned; if .false., reflections will be returned whether or not a reference intensity is present. SIGMA_CUT r (R) Omit reflections for which the intensity I is less than SIGMA_CUT*sig(I). SPOV l (R) Flag = .true. include spatially overlapped reflections which have been integrated, = .false. do not. OVLD l (R) Flag = .true. include intensity overloads, = .false. do not. 3.4.7 Reset to top of LIRL - LSM_TOP_LIRL Prepare for LIRL access via LSM routines and reset the current retrieval position in the LIRL to the start of the list. Must be called before calling routines such LSM_NEXT_REFLN, LSM_NUM_NEXT, LSM_SCFAC and the LSM service routine LSM_NEXT_REFOBS and whenever the list needs to be re-read using these routines. Note that the routine sets various internal flags and calculates various intermediate values used in the scaling functions if any parameters etc. have been changed which could affect these. Fortran call: SUBROUTINE LSM_TOP_LIRL (LINDX, IERR) Parameters: LINDX i (R) The index of the Laue Integrated Reflections List IERR i (W) Error flag =0 OK =1 invalid LINDX or no spots present =2 Error in sorting data =3 Error from LSM_KDMCOPY 3.4.8 Get reflection set from LIRL - LSM_NEXT_REFLN Gets the next singles reflection set from the LIRL. The reflection set includes only those reflections of the selected packs and plates (LSM_SELECT_PKPL, LSM_ADD_PKPL, LSM_CLR_PKPL) and classes (LSM_SELECT_SCREFS). The function returns the number of individual reflections in the set or -1 when the end of the list is reached. The LIRL indices of the individual reflections in the set can be obtained using the supplied function LSM_INDX and using this the reflection details can be retrieved using the normal LIRL set of routines. Fortran call: INTEGER FUNCTION LSM_NEXT_REFLN (IERR) Parameters: IERR i (R) Error flag =0 OK, =1 error (markup_required flag or select_required flag found to be set) Returns >=1 the number of reflections in the set -1 when the end of the list is reached 3.4.9 Get LIRL reflection index- LSM_INDX Gets the LIRL index of a reflection in the latest set of reflections returned by the routine LSM_NEXT_REFLN. The index may then be used to access the individual reflection data from the LIRL next singles reflection set from the LIRL using the normal LIRL set of routines. Fortran call: INTEGER FUNCTION LSM_INDX (IR) Parameters: IR i (R) The reflection number within the range of 1 to the value returned by the last call to LSM_NEXT_REFLN Returns the index number for the reflection in the LIRL 3.4.10 Get scaling factor for a reflection - LSM_SCFAC Gets the required intensity scaling factor for a given reflection intensity of a reflection in the LIRL. Note that the current values of the scaling parameters must have been copied to the internal scaling arrays (using LSM_KDMCOPY) before using this routine and the routine LSM_TOP_LIRL must also have been called. The reflection list accessed is that selected when LSM_TOP_LIRL was called. **Note** Remember to declare this as a REAL function wherever used. Fortran call: REAL FUNCTION LSM_SCFAC (IREF, IERR) Parameters: IREF i (R) The reflection index within the LIRL IERR i (W) Error flag =0 OK =1 Cannot get scaling factor =-1 'markup_required' flag found to be set =-100 LINDX is invalid. 3.5 LSM REFINEMENT ROUTINES 3.5.1 Introduction These routines are used to set up the list of LSM parameters which are to be refined and to carry out the refinement of such parameters. The following routines are available: Set LSM parameter refinement flags - LSM_SET_RFLAGS Add a LSM parameter refinement flag - LSM_ADD_RFLAG Clear a LSM parameter refinement flag - LSM_CLR_RFLAG General LSM refinement routine - LSM_REFINE Refine local absorption correction - LSM_ABSCOR_RFN 3.5.2 Set LSM parameter refinement flags - LSM_SET_RFLAGS This routine sets which parameters are to be refined using the next call to the refinement routine LSM_REFINE. For special cases it may also be necessary to call the associated routines LSM_ADD_RFLAG and LSM_CLR_RFLAG may to 'fine tune' the list of parameters set by LSM_SET_RFLAGS. Plate scaling factors for the top plate of a pack are ignored and the pack scale and temperature factors for pack 1 are never refined. Note that parameters based on packs defined via LSM_OMIT will always be omitted. Fortran call: SUBROUTINE LSM_SET_RFLAGS (IPLATE_SC1, IPACK_SC1, + IPACK_BFAC1, NORM1, ABSCORGLOB1, ABSCORLOC1, REF_SC1, + REF_BFAC1) Parameters: IPLATE_SC1 i (R) Flag >0 Refine plate scaling parameters for plate IPLATE_SC (for all packs). =0 Refine plate scaling parameters for all plates with valid data present in LIRL. (for all packs) =-1 Do not refine plate scaling parameters. IPACK_SC1 i (R) Flag >0 Refine pack scaling factor for pack IPACK_SC (must not be pack 1). =0 Refine pack scaling factors for all packs (except pack 1) with valid data present in LIRL. =-1 Do not refine pack scale factors. IPACK_BFAC1 i (R) Flag >0 Refine pack temperature factor for pack IPACK_SC (must not be pack 1), =0 Refine pack temperature factors for all packs (except pack 1) with valid data present in LIRL. =-1 Do not refine pack temperature factors. NORM1 l (R) Flag =.true. Refine normalisation curves for all defined ranges. =.false. Do not refine normalisation curves. ABSCORGLOB1 l (R) Flag =.true. Refine global absorption correction. =.false. Do not refine absorption correction. ABSCORLOC1 l (R) Flag =.true. Refine local absorption correction. =.false. Do not refine local absorption REF_SC1 l (R) Flag =.true. Refine scale factor to reference data. =.false. Do not refine scale factor to reference data. REF_BFAC1 l (R) Flag =.true. Refine temperature factor to reference data. correction. =.false. Do not refine temperature factor to reference data. 3.5.3 Add a LSM parameter refinement flag - LSM_ADD_RFLAG This routine can be used to add a further parameter to the list of scaling parameters to refine set up by the routine LSM_SET_RFLAGS. Note that parameters based on packs defined via LSM_OMIT will always be omitted. Fortran call: SUBROUTINE LSM_ADD_RFLAG (ITYP, IPACK, IPLATE, IRANGE) Parameters: ITYP i (R) Parameter type =1 Plate scaling parameters =2 Pack scale factor =3 Pack temperature factor =4 Normalisation curve IPACK i (R) Pack number (ignored if ITYP=4) IPLATE i (R) Plate number >1 (for ITYP=1 only) IRANGE i (R) Range for normalisation curve (for ITYP=4 only) 3.5.4 Clear a LSM parameter refinement flag - LSM_CLR_RFLAG This routine can be used to clear a parameter from the list of scaling parameters to refine set up by the routine LSM_SET_RFLAGS Fortran call: SUBROUTINE LSM_CLR_RFLAG (ITYP, IPACK, IPLATE, IRANGE) Parameters: ITYP i (R) Parameter type =1 Plate scaling parameters =2 Pack scale factor =3 Pack temperature factor =4 Normalisation curve IPACK i (R) Pack number (ignored if ITYP=4) IPLATE i (R) Plate number >1 (for ITYP=1 only) IRANGE i (R) Range for normalisation curve (for ITYP=4 only) 3.5.5 General LSM refinement routine - LSM_REFINE This routine allows for a general refinement of any selection of the LSM scaling parameters including the global (but not local) absorption surface. The parameters to be refined by the current call to the routine are set via LSM_SET_RFLAGS (and LSM_ADD_RFLAG, LSM_CLR_RFLAG if required) which must be called prior to calling LSR_REFINE. The classes of data to be used must also be set up prior to calling LSM_REFINE by calls to LSM_SELECT_PKPL and LSM_SELECT_SCREFS. Fortran call: SUBROUTINE LSM_REFINE (LINDX, REFERENCE, IRFTYP, TUNE, FMIN, + IERR, MESSAGE) Parameters: LINDX i (R) The index of the Laue Integrated Reflections List REFERENCE l (R) Flag = .true. Refine against reference data - cf LAUESCALE. (Must have called LSM_SELECT_SCREFS with REFERENCE = .true.) l = .false. Refine against current scaled mean intensities (internal scaling - cf LAUENORM. IRFTYP i (R) Refinement routine type =1 Use LSQMIN =2 Use LSQMQL TUNE() r (R) Tuning parameters specific to the refinement type If IRFTYP=1 TUNE(1) = shift limit e.g.0.001 TUNE(2) = step parameter e.g. 1.0E-10 TUNE(3) = damping factor e.g. 0.5 If IRFTYP=2 TUNE(1) = tolerance (ACC) TUNE(2) = step size (H) FMIN r (W) The refined function value (sum of squares) IERR i (W) Error flag = 0 OK =-1 Too little work spce for LSQMIN - try LSQMQL instead = 1 Too little work space for LSQMQL MESSAGE c (W) Message string from refinement (up to 80 chars) 3.5.6 Refine local absorption correction - LSM_ABSCOR_RFN This routine allows for the refinement of the local absorption correction parameters for a pack. The classes of data to be used must be set up prior to calling LSM_ABSCOR_RFN by calls to LSM_SELECT_PKPL and LSM_SELECT_SCREFS. Fortran call: SUBROUTINE LSM_ABSCOR_RFN (LINDX, IPACK, REFERENCE, IRFTYP, TUNE, + FMIN, IERR, MESSAGE) Parameters: LINDX i (R) The index of the Laue Integrated Reflections List IPACK i (R) The pack number of the pack for which the local absorption correction parameters are to be refined. REFERENCE l (R) Flag = .true. Refine against reference data - cf LAUESCALE. (Must have called LSM_SELECT_SCREFS with REFERENCE = .true.) l = .false. Refine against current scaled mean intensities (internal scaling - cf LAUENORM. IRFTYP i (R) Refinement routine type =1 Use LSQMIN =2 Use LSQMQL TUNE() r (R) Tuning parameters specific to the refinement type If IRFTYP=1 TUNE(1) = shift limit e.g.0.001 TUNE(2) = step parameter e.g. 1.0E-10 TUNE(3) = damping factor e.g. 0.5 If IRFTYP=2 TUNE(1) = tolerance (ACC) TUNE(2) = step size (H) FMIN r (W) The refined function value (sum of squares) IERR i (W) Error flag = 0 OK =-1 Too little work spce for LSQMIN - try LSQMQL instead = 1 Too little work space for LSQMQL MESSAGE c (W) Message string from refinement (up to 80 chars) 3.6 MULTIPLES DECONVOLUTION 3.6.1 Introduction These are routines for retrieving the reflections makrked as multiples from the LIRL-list for multiples deconvolution. The deconvoluted multiples are then added with scaled intensities to the LIRL-reflection list The following routines are available: Multiples deconvolutions LSM_MULTIPLES_DECONV Reset to top of LIRL - LSM_TOP_MULTS_LIRL 3.6.2 Multiples deconvolutions LSM_MULTIPLES_DECONV This routine deconvolutes reflections marked as multiples (energy overlapps) and adds their scaled(!) intensities to the LIRL used. The wavelength will be stored as 0.0 and the multiples flag with be set to MULT=0 to identify deconvoluted multiples when needed. Fortran call: SUBROUTINE LSM_MULTIPLES_DECONV (LINDX, TUNE, + IRFTYP, NUMOUT, IERR, MESSAGE) Parameters: LINDX i (R) The index of the Laue Integrated Reflections List TUNE() r (R) Tuning parameters specific to the refinement type If LSQMQL TUNE(1) = tolerance (ACC) TUNE(2) = step size (H) IRFTYP i (R) Refinement routine type =1 Use LSQMIN =2 Use LSQMQL NUMOUT() i (W) Array containing various details of the deconvolution IERR i (W) Error flag = 0 OK = 1 Error MESSAGE c (W) Error message if IERR is non-zero 3.6.3 Reset to top of LIRL - LSM_TOP_MULTS_LIRL Prepare for LIRL access via LSM routines and reset the current retrieval position in the LIRL to the start of the list. Must be called before calling routines such LSM_NEXT_REFLN, LSM_NUM_NEXT, LSM_SCFAC and the LSM service routine LSM_NEXT_REFOBS and whenever the list needs to be re-read using these routines. Note that the routine sets various internal flags and calculates various intermediate values used in the scaling functions if any parameters etc. have been changed which could affect these. Fortran call: SUBROUTINE LSM_TOP_MULTS_LIRL (LINDX, SIGMA_CUT, + SPOV, OVLD, IERR) Parameters: LINDX i (R) The index of the Laue Integrated Reflections List SIGMA_CUT r (R) Omit reflections for which the intensity I is less than SIGMA_CUT*sig(I). SPOV l (R) Flag = .true. include spatially overlapped reflections which have been integrated, = .false. do not. OVLD l (R) Flag = .true. include intensity overloads, = .false. do not. IERR i (W) Error flag =0 OK =1 invalid LINDX or no spots present =2 Error in sorting data =3 Error from LSM_KDMCOPY 3.7 MISCELLANEOUS LSM ROUTINES 3.7.1 Introduction These are a miscellaneous set of routines to be used in conjunction with the Laue Scaling Module (LSM). The following routines are available: Return maximum numbers of plates and packs - LSM_MAXPKPL Set up other LSM parameters - LSM_PARSETUP_LDM 3.7.2 Return maximum numbers of plates and packs - LSM_MAXPKPL This routine returns the maximum number of packs and plates for which the Laue Scaling Module is currently set up. Fortran call: SUBROUTINE LSM_MAXPKPL (MAXPK, MAXPL) Parameters: MAXPK i (W) The maximum number of packs defined for the LSM MAXPL i (W) The maximum number of plates defined for the LSM 3.7.3 Set up other LSM parameters - LSM_PARSETUP_LDM This routine may be used instead of LSM_PARSETUP if the program using the LSM is based on an LDM file from which the required parameter values are to be taken. Remember to call this routine again if any of the relevant LDM parameter values may have changed. Fortran call: SUBROUTINE LSM_PARSETUP_LDM (IERR) Parameters: IERR i (W) Error flag =0 OK, =1 Number of packs is zero =2 A zero CTOF value found 3.8 SETTING UP THE LAUE SCALING PARAMETERS LSP 3.8.1 Introduction A routine is provided to defines a set of Laue Scaling Parameters (LSP) which together with the Laue Scaling Module (LSM) parameters (and SYMM parameters) form a complete set of parameters for use in a standalone Laue scaling program. It makes use of the Keyword Data Module (KDM) for defining and handling the keyworded data. The following routines are available: Set up LSP Parameters - LSM_SETLSP 3.8.2 Set up LSP Parameters - LSM_SETLSP This routine defines a set of Laue scaling parameters which together with the Laue Scaling Module (LSM) parameters (and SYMM parameters) form a complete set of parameters for use in a standalone Laue scaling, normalisation and absorption correction program. Fortran call: SUBROUTINE LSM_SETLSP (KDX) Parameters: KDX i (W) Returns the index of the keyword set of LSP parameters 3.9 LSP BASED CONVENIENCE ROUTINES 3.9.1 Introduction These are a set of routines used to call various Laue Scaling Module (LSM) routines with parameters derived internally from the Laue Scaling Parameter (LSP) set of keywords. The following routines are available: Set up other LSM parameters - LSM_PARSETUP_LSP Select absorption option - LSM_ABSOPT_LSP Select reflection types - LSM_SELECT_SCREFS_LSP Omit packs from processing - LSM_OMIT_LSP 3.9.2 Set up other LSM parameters - LSM_PARSETUP_LSP This routine may be used instead of LSM_PARSETUP if the program using the LSM is based on an LSP keyworded file from which the required parameter values are to be taken. Remember to call this routine again if any of the relevant LSP parameter values may have changed. Fortran call: SUBROUTINE LSM_PARSETUP_LSP (KDX, IERR, ERRSTR) Parameters: KDX i (R) The index of the LSP keyworded parameter set. IERR i (W) Error flag = 0 OK = 1 Error ERRSTR c (W) Error string if IERR is non-zero (max 80 characters) 3.9.3 Select absorption option - LSM_ABSOPT_LSP This routine calls LSM_ABSOPT with its parameter derived from the LSP parameter set. Fortran call: SUBROUTINE LSM_ABSOPT_LSP Parameters: none 3.9.4 Select reflection types - LSM_SELECT_SCREFS_LSP This routine calls LSM_SELECT_SCREFS with its parameters derived from the LSP parameter set. Fortran call: SUBROUTINE LSM_SELECT_SCREFS_LSP (IERR, REFERENCE, ERRSTR) Parameters: IERR i (W) Error flag = 0 OK = 1 Error REFERENCE l (R) If .true. then only reflections which have a reference intensity stored will be returned; if .false., reflections will be returned whether or not a reference intensity is present. ERRSTR c (W) Error string if IERR is non-zero (max 80 characters) 3.9.5 Omit packs from processing - LSM_OMIT_LSP This routine is equivalent to a call to LSM_OMIT with its parameter derived from the LSP parameter set. Fortran call: SUBROUTINE LSM_OMIT_LSP (IERR, ERRSTR) Parameters: IERR i (W) Error flag = 0 OK = 1 Error ERRSTR c (W) Error string if IERR is non-zero (max 80 characters) 3.10 ANALYSING THE INTENSITY STATISTICS AFTER SCALING 3.10.1 Introduction Routines are available to collect R-factor statistics data and routines are available to print the gathered information to a Fortran output channel or to return it for alternative use e.g. within a windows based program. The following routines are available: Prepares graphic windows for statistics output - LSC_GRAPHSETUP Calculates and outputs statistical data - LSC_ANALYSES Refines reference set scale factors - LSC_SCALESTAT_OUT Output of reference set scaling results - LSC_HIST Graphical output of scaling results - LSC_MENU1 Graphical output of scaling results - LSC_MENU1ABS Graphical output of scaling results - LSC_MENU2 Graphical output of scaling results - LSC_MENU2ABS Graphical output of scaling results - LSC_MENU3 Graphical output of scaling results - LSC_MENU3ABS Get R-factor tables data - LSC_RFACTS_LSP Output of RSCALE of multiples vs. reference data - LSC_MULT_ANALOG Outputs mtz- and/or shelx-files - LSC_FILE_OUTPUT 3.10.2 Prepares graphic windows for statistics output - LSC_GRAPHSETUP This routines sets the size and layout for the graphics output windows and menus. Fortran call: SUBROUTINE LSC_GRAPHSETUP (IERR, MESSAGE) Parameters: IERR i (W) Error flag = 0 OK = 1 Error MESSAGE c (W) Error message if IERR = 1 3.10.3 Calculates and outputs statistical data - LSC_ANALYSES This routine calculates and prepares various statistical graphs and marks reflections as outliers according to the input cutoff criteria. Fortran call: SUBROUTINE LSC_ANALYSES (LINDX, REFERENCE, IFL1, IFL2, + EXOUT, CUTOFF) Parameters: LINDX i (R) The index of the Laue Integrated Reflections List REFERENCE l (R) If .true. then only reflections which have a reference intensity stored will be returned; if .false., reflections will be returned whether or not a reference intensity is present. IFL1,IFL2 i (R) Output flags IFL1 = 0, IFL2 = 0 no winows output IFL1 = 1, IFL2 = 1 internal refinement, no refset IFL1 = -1, IFL2 = 1 external refinement, refset IFL1 = 1, IFL2 = -1 internal refinement, refset scaling CUTOFF r (R) Outlier cutoff EXOUT l (R) Outlier exclusion flag (if .true. then exclude outliers) 3.10.4 Refines reference set scale factors - LSC_SCALESTAT_OUT This subroutine refines the reference scale factor if a reference set is present and if the scale factors haven't been refined at that point. It calls LSC_REFSET_ANALYSES to output statistical tables of the scaling results to the log-file Fortran call: SUBROUTINE LSC_SCALESTAT_OUT (MINDX, EXOUT, CUTOFF, IRFTYP, + TUNE, IUN) Parameters: MINDX i (R) The index of the Laue Integrated Reflections List CUTOFF r (R) Outlier cutoff EXOUT l (R) Outlier exclusion flag .true. = exclude outliers .false. = include outliers IRFTYP i (R) Refinement routine type =1 Use LSQMIN =2 Use LSQMQL TUNE() r (R) Tuning parameters specific to the refinement type If LSQMQL TUNE(1) = tolerance (ACC) TUNE(2) = step size (H) IUN i (R) Output number for log-file 3.10.5 Output of reference set scaling results - LSC_HIST This routine is called by LSC_HIST_RES, LSC_HIST_INT, LSC_HIST_THETA, and LSC_HIST_LAMBDA and outputs histogramms of the reference set scaling statistics prpared by those calling routines Fortran call: SUBROUTINE LSC_HIST (IOPT, OUTPUT, NUMBINS, BIN_WIDTH, + VAL_MIN, VAL_MAX, RBIN) Parameters: IOPT i (R) Option flag =1 lambda, =2 resolution, =3 intensity, = 4 theta OUTPUT i (R) Option flag =1 no. of relections per bin vs IOPT flag =2 mean IL/IS ratio per bin vs IOPT flag =3 mean IL per bin vs IOPT flag =4 mean IS per bin vs IOPT flag =5 R-factor per bin vs IOPT flag =6 log(IL/IS) per bin vs resolution NUMBINS i (R) Number of bins BIN_WIDTH r (R) Bin width VAL_MIN r (R) Minimum soft limits value VAL_MAX r (R) Maximum soft limits value RBIN() r (R) Significant/Measured intensity ratios for NUMBINS bins 3.10.6 Graphical output of scaling results - LSC_MENU1 This subroutine outputs statistics after internal scaling when no reference data set is present and no absorption correction has been refined. It is called by the main programm LSCALE. Fortran call: SUBROUTINE LSC_MENU1 (MINDX, EXOUT, CUTOFF) Parameters: MINDX i (R) The index of the Laue Integrated Reflections List CUTOFF r (R) Outlier cutoff EXOUT l (R) Outlier exclusion flag .true. = exclude outliers .false. = include outliers 3.10.7 Graphical output of scaling results - LSC_MENU1ABS This subroutine outputs statistics and the abssorption surface after internal scaling when no reference data set is present and an absorption correction has been refined. It is called by the main programm LSCALE. Fortran call: SUBROUTINE LSC_MENU1ABS (MINDX, EXOUT, CUTOFF) Parameters: MINDX i (R) The index of the Laue Integrated Reflections List CUTOFF r (R) Outlier cutoff EXOUT l (R) Outlier exclusion flag .true. = exclude outliers .false. = include outliers 3.10.8 Graphical output of scaling results - LSC_MENU2 This subroutine outputs statistics after external scaling when no reference data set is present and no absorption correction has been refined. It is called by the main programm LSCALE. Fortran call: SUBROUTINE LSC_MENU2 (MINDX, EXOUT, CUTOFF, MULTDECONV, IUN) Parameters: MINDX i (R) The index of the Laue Integrated Reflections List CUTOFF r (R) Outlier cutoff EXOUT l (R) Outlier exclusion flag .true. = exclude outliers .false. = include outliers MULTDECONV l (R) multiples deconvolution flag .true. = deconvolute multiples .false. = don't deconvolute multiples IUN i (R) Output number for log-file 3.10.9 Graphical output of scaling results - LSC_MENU2ABS This subroutine outputs statistics and the abssorption surface after external scaling when no reference data set is present and an absorption correction has been refined. It is called by the main programm LSCALE. Fortran call: SUBROUTINE LSC_MENU2ABS (MINDX, EXOUT, CUTOFF, MULTDECONV, IUN) Parameters: MINDX i (R) The index of the Laue Integrated Reflections List CUTOFF r (R) Outlier cutoff EXOUT l (R) Outlier exclusion flag .true. = exclude outliers .false. = include outliers MULTDECONV l (R) multiples deconvolution flag .true. = deconvolute multiples .false. = don't deconvolute multiples IUN i (R) Output number for log-file 3.10.10 Graphical output of scaling results - LSC_MENU3 This subroutine outputs statistics after internal scaling when a reference data set is present and no absorption correction has been refined. It is called by the main programm LSCALE. Fortran call: SUBROUTINE LSC_MENU3 (MINDX, EXOUT, CUTOFF, IRFTYP, + TUNE, MULTDECONV, IUN) Parameters: MINDX i (R) The index of the Laue Integrated Reflections List CUTOFF r (R) Outlier cutoff EXOUT l (R) Outlier exclusion flag .true. = exclude outliers .false. = include outliers IRFTYP i (R) Refinement routine type =1 Use LSQMIN =2 Use LSQMQL TUNE() r (R) Tuning parameters specific to the refinement type If LSQMQL TUNE(1) = tolerance (ACC) TUNE(2) = step size (H) MULTDECONV l (R) multiples deconvolution flag .true. = deconvolute multiples .false. = don't deconvolute multiples IUN i (R) Output number for log-file 3.10.11 Graphical output of scaling results - LSC_MENU3ABS This subroutine outputs statistics and the abssorption surface after internal scaling when a reference data set is present and an absorption correction has been refined. It is called by the main programm LSCALE. Fortran call: SUBROUTINE LSC_MENU3ABS (MINDX, EXOUT, CUTOFF, IRFTYP, + TUNE, MULTDECONV, IUN) Parameters: MINDX i (R) The index of the Laue Integrated Reflections List CUTOFF r (R) Outlier cutoff EXOUT l (R) Outlier exclusion flag .true. = exclude outliers .false. = include outliers IRFTYP i (R) Refinement routine type =1 Use LSQMIN =2 Use LSQMQL TUNE() r (R) Tuning parameters specific to the refinement type If LSQMQL TUNE(1) = tolerance (ACC) TUNE(2) = step size (H) MULTDECONV l (R) multiples deconvolution flag .true. = deconvolute multiples .false. = don't deconvolute multiples IUN i (R) Output number for log-file 3.10.12 Get R-factor tables data - LSC_RFACTS_LSP Calls LSC_RFACTS with parameters derived from LSP and then calls LSC_RFACTS_OUT with flags derived from LSP. Fortran call: SUBROUTINE LSC_RFACTS_LSP (LINDX, IUN, PLATEMERGE, IERR) Parameters: LINDX i (R) Index for LIRL IUN i (R) Unit no. for tables output IERR i (W) Error flag as returned from LSC_RFACTS PLATEMERGE l (R) .true. = Merge plate data prior to statistics .false. = keep all data seperate 3.10.13 Output of RSCALE of multiples vs. reference data - LSC_MULT_ANALOG This routine writes RSCALE of deconvoluted multiples reflections against the reference set to the log-file. Fortran call: SUBROUTINE LSC_MULT_ANALOG (LINDX, IUN) Parameters: LINDX i (R) The index of the Laue Integrated Reflections List IUN i (R) Output unit number of log-file Fortran call: SUBROUTINE LSC_DECONV_LOGOUTPUT(IUN, NUMOUT) Parameters: IUN i (R) Output unit number of log-file NUMOUT() i (R) Array containing various details of the deconvolution 3.10.14 Outputs mtz- and/or shelx-files - LSC_FILE_OUTPUT This routine gets various data output options and criteria and writes scaled reflections merged or unmerged to mtz- and/or shelx-files. It refines the reference scale and temperature factor if a reference data set is present and if they have not been refined so far. If reference intensities are present they will be stored in the mtz.-output files. If multiples reflections have been deconvoluted they will be added to the output files. Fortran call: SUBROUTINE LSC_FILE_OUTPUT (KDX, MTZ_IDX, MINDX, + IUNOUT, IUNLOG, REFSET) Parameters: KDX i (R) The index of the keyword set to which the LSM keyworded scaling parameters are to be added) MTZ_IDX i (R) indicates which MTZ file - one index points to both input and output files MINDX i (R) The index of the Laue Integrated Reflections List IUNOUT i (R) output unit number for shelx-file IUNLOG i (R) output unit number for log-file REFSET l (R) .true. = Reference data set exist .false. = no reference data present