CHAPTER 3 - LAUE REFLECTION LIST (LRL) ROUTINES

3.1 INTRODUCTION

These are a set of routines for generating and accessing a Laue Reflection List (LRL) for the current pack and plate based on the current values in the Laue Data Module (LDM). The list is actually a list of spots rather than individual reflections and each spot has a slot in which an integrated intensity may be stored. Spot details include multiplicity information which enables generatation of the individual reflection data if required. Functions are available to sort the spot list in a number of ways.

The following sets of routines are available:

Generating the Laue Reflection List
Sort the Laue Reflection List
Calculate an Individual Spot Position
Get Global Laue Reflection List Data Items
Get Individual Spot Data from Laue Reflection List
Set Global Laue Reflection List Data Items
Set Individual Spot Data in Laue Reflection List
Interface for XDL_VIEW Laue Simulations
Re-assign Spatial Overlaps and Multiplicities
Determine Spatial Overlap Between Two Spots
Miscellaneous Routines

3.2 GENERATING THE LAUE REFLECTION LIST

3.2.1 Introduction

A high level routine is available which checks whether a list needs to be generated or whether the relevant LDM parameters are unchanged since the last call to the function; this also calls routines to calculate the orientation and 'A' matrices prior to the actual generation of the list. The lower level functions for these tasks may also be accessed directly if desired.

The following routines are available:

Generate Laue Reflection List (High Level) - LRL_GEN
Generate Laue Reflection List (Low Level) - LRL_GNR
Calculate Orientation Matrix - LDM_MK_ORIENT
Calculate the Master 'A' Matrix - LRL_A_CALC
Find and Mark Spatial Overlaps - LRL_OVLP
Find All Spatial Overlaps - LRL_OVALL

3.2.2 Generate Laue Reflection List (High Level) - LRL_GEN

This routine checks whether a new reflection list needs to be generated or whether the relevant LDM parameters are unchanged since the last call to the function. If required it calls routines to calculate the orientation and 'A' matrices prior to the actual generation of the list. Normally distortion corrected coordinates are calculated for the spot positions but there is an option to omit the distortion correction. Various ways of determining the criterion for spatially overlapped spots are available.
 
Fortran call:
 
      SUBROUTINE LRL_GEN (IPACK, IPLATE, DISTOR, IOVTYP, IERR, ERRSTR)
 
Parameters:
 
IPACK     i (R)   Pack number
IPLATE    i (R)   Plate number
DISTOR    l (R)   Flag = .true.  Include distortion corrections 
                                 (normal case)
                       = .false. Do not include distortion corrections
IOVTYP    i (R)   Flag for calculation of spatial overlaps
                       = 0, do not calculate these
                       = 1, analytical calculation (spot + unused
                            pixel + border) v spot
                       = 2, analytical calculation (spot + border) v spot
                       = 3, analytical calculation spot v spot
                       = 4, mask method (spot + unused pixel + border) 
                            v spot
                       = 5, mask method (spot + border) v spot
                       = 6, mask method spot v spot

                   Note: If radial masking is not used (SPOT_WIDTH = 0.0)
                         then if IOVTYP > 0, the overlaps are calculated
                         on the basis of SPOT_DELTA

IERR      i (W)    Returned error flag = 0, OK
                                       =-1, Invalid pack (outside 
                                            program limits)
                                       =-2, Invalid plate (outside 
                                            program limits)
                                       = 1, Too many reflections to store    
                                       = 2, Invalid overlap type flag
                                       = 3, Too many spots in a strip for
                                            overlaps calculation.

ERRSTR    c (W)    Returned error message string (max 80 chars)

3.2.3 Generate Laue Reflection List (Low Level) - LRL_GNR

This routine performs the actual generation of a Laue Reflection List using the current LDM parameters and Orientation and 'A' matrices. Normally distortion corrected coordinates are calculated for the spot positions but there is an option to omit the distortion correction. This is used as a service routine to LRL_GEN but may also be called directly if required.
 
Fortran call:
 
      SUBROUTINE LRL_GNR   (IPACK, IPLATE, A, DISTOR, IERR, ERRSTR)
 
Parameters:
 
 IPACK    i (R)   Pack number (pre-check before calling this routine)
 IPLATE   i (R)   Plate number (pre-check before calling this routine)
 A(3,3)   r (R)   'A' matrix
 DISTOR   l (R)   Flag = .true. apply distortion correction to stored
                  coordinates (normal case), =.false. do not.
 IERR     i (W)   Error flag, =0 OK, =1 too many reflections for arrays
                  (list truncated)
 ERRSTR   c (W)   Error message string (max 80 chars)

3.2.4 Calculate Orientation Matrix - LDM_MK_ORIENT

This routine calculates the orientation matrix based on the current LDM parameters. This is normally used as a service routine to the subroutine LRL_GEN but may be called directly if required.
 
Fortran call:
 
      SUBROUTINE LRL_MK_ORIENT (ORIENT)
 
Parameters:
 
 ORIENT(3,3) r (W)    Returns the orientation matrix

3.2.5 Calculate the Master 'A' Matrix - LRL_A_CALC

This routine calculates the master matrix, a_mat, from the crystal system, crystal alignment and cell parameters. This is then premultiplied by the phi matrices. It is used as a service routine for the subroutine LRL_GEN but may be called directly if required.
 
Fortran call:
 
      SUBROUTINE  LRL_A_CALC (IPACK, ORIENT, A_MAT)
 
Parameters:
 
IPACK        i (R)   Pack number
ORIENT(3,3)  r (R)   Orientation matrix from crystal setting & cell 
                     parameters
A_MAT(3,3)   r (W)   The master matrix

3.2.6 Find and Mark Spatial Overlaps - LRL_OVLP

This routine is used to determine an mark the spatial overlaps in a Laue Reflection List. A number of ways of specifying the overlap criterion are available.
 
Fortran call:
 
      SUBROUTINE  LRL_OVLP (IOVTYP, IERR, ERRSTR)
 
Parameters:
 
IOVTYP    i (R)   Flag for calculation of spatial overlaps
                       = 1, analytical calculation (spot + unused
                            pixel + border) v spot
                       = 2, analytical calculation (spot + border) v spot
                       = 3, analytical calculation spot v spot
                       = 4, mask method (spot + unused pixel + border) 
                            v spot
                       = 5, mask method (spot + border) v spot
                       = 6, mask method spot v spot

IERR      i (W)  Error flag = 0, OK
                            = 1, Invalid overlaps type flag
                            = 2, Too many spots in a strip for overlaps 
                                 check
ERRSTR    c (W)  Error message string (max 80 characters)

3.2.7 Find All Spatial Overlaps - LRL_OVALL

This routine is used to find all the spots (up to a requested limit) which overlap with a given spatially overlapped spot. A number of ways of specifying the overlap criterion are available (as in LRL_OVLP). The Laue Reflection List (LRL) must be sorted on 'xfd' or 'yfd' before this routine is called.
 
Fortran call:
 
      SUBROUTINE  LRL_OVALL (IOVTYP, N, NSPOT, SPOT_L, SPOT_W, 
     +                       SPOTFAC, SPOT_B, SPOT_D, RMAX, CTOF, 
     +                       MM_RAST_X, MM_RAST_Y, MAX_OVLPS, 
     +                       NUM_OV, X_OV, Y_OV, IERR, ERRSTR)
 
Parameters:
 
IOVTYP    i (R)   Flag for calculation of spatial overlaps
                       = 1, analytical calculation (spot + unused
                            pixel + border) v spot
                       = 2, analytical calculation (spot + border) v spot
                       = 3, analytical calculation spot v spot
                       = 4, mask method (spot + unused pixel + border) 
                            v spot
                       = 5, mask method (spot + border) v spot
                       = 6, mask method spot v spot
N         i (R)    Spot number in sorted LRL
NSPOT     i (R)    Number of spots in the LRL
SPOT_L    r (R)    Spot length (mm)
SPOT_W    r (R)    Spot width (mm)
SPOTFAC   r (R)    Spot expansion factor (See LDM parameter defns.)
SPOT_B    r (R)    Spot border width (pixels)
SPOT_D    r (R)    Spot delta (mm)
RMAX      r (R)    Maximum radius (mm)
CTOF      r (R)    Crystal to image diastance
MM_RAST_X r (R)    Conversion factor mm to x-rasters
MM_RAST_Y r (R)    Conversion factor mm to y-rasters
MAX_OVLPS i (R)    Maximum number of overlaps to return
NUM_OV    i (W)    Number of overlapping spots found
X_OV()    r (W)    'x' coordinates of the NUM_OV overlapping spots (rasters)
Y_OV()    r (W)    'y' coordinates of the NUM_OV overlapping spots (rasters)
IERR      i (W)     Error flag = 0, OK
                               = 1, Spot list not sorted on 'xfd' 
                                    or 'yfd'
                               = 2, Spot was not found to be overlapped
                                 
ERRSTR    c (W)  Error message string (max 80 characters)

3.3 SORT THE LAUE REFLECTION LIST

3.3.1 Introduction

A routine is available to sort the Laue Reflection List in a number of ways. In actual fact an internal index list is generated through which the spots in the 'sorted' list are accessed though the actual generated spot data remains in situ.

The following routines are available:

Sort Reflections List - LRL_SORT

3.3.2 Sort Reflections List - LRL_SORT

This routine sorts the Laue Reflection List in a number of ways. In actual fact an internal index list is generated through which the spots in the 'sorted' list are accessed; the actual generated spot data remains in situ. Spots may be sorted by index, detector position, lambda or resolution.
 
Fortran call:
 
      SUBROUTINE LRL_SORT (ISOR)
 
Parameters:
 
ISOR    i (R)   Sort order flag
                     = 1,  sort on k, k, l
                     = 2,  sort on nodal h, k, l
                     = 3,  sort on XFD (stored x-coordinate)
                     = 4,  sort on YFD (stored y-coordinate)
                     = 5,  sort on lambda
                     = 6,  sort on dmin_thr2

3.4 CALCULATE AN INDIVIDUAL SPOT POSITION

3.4.1 Introduction

A routine is available to calculate the predicted detector position for an individual Laue reflection.

The following routines are available:

Calculate Individual Reflection Position - LRL_CALC_POS

3.4.2 Calculate Individual Reflection Position - LRL_CALC_POS

This routine calculates the predicted detector position for an individual reflection. Distortion corrections are applied.
 
Fortran call:
 
      SUBROUTINE LRL_CALC_POS (IPACK, IPLATE, X_CEN, Y_CEN, 
     +                         COSOM, SINOM,
     +                         AMAT, H, K, L, XFD, YFD, IERR)
 
Parameters:
 
IPACK     i (R)  Pack number
IPLATE    i (R)  Plate number
X_CEN     r (R)  Corrected x centre value (raster units)
Y_CEN     r (R)  Corrected y centre value (raster units)
COSOM     r (R)  cos (omega)
SINOM     r (R)  sin (omega)
AMAT(3,3) r (R)  A matrix calculated using current LDM parameters
H         i (R)  Reflection h index
K         i (R)  Reflection k index
L         i (R)  Reflection l index
XFD       r (W)  Predicted x position (raster units) (distortion 
                 corrected)
YFD       r (W)  Predicted y position (raster units) (distortion 
                 corrected)
IERR      i (W)  = 0 OK
                 =-1, Invalid pack (outside program limits)
                 =-2, Invalid plate (outside program limits)
                 = 1 could not be recorded with current detector position

3.5 GET GLOBAL LAUE REFLECTION LIST DATA ITEMS

3.5.1 Introduction

A series of routines are available to access data from the Laue Reflection List which refer to the list as a whole.

The following routines are available:

Return the Number of Spots - LRL_NUMSPOTS
Get Spot Counts - LRL_COUNTS
Return Status of Laue Reflection List - LRL_STATUS
Get Corrected Centre Position - LRL_GET_XYCEN
Number of Reflection Tries - LRL_TRIES
Get Pack and Plate Number - LRL_GET_PLATE
Return the Nodal Index Limit - LRL_NODMAX

3.5.2 Return the Number of Spots - LRL_NUMSPOTS

This routine returns the number of spots in a Laue Reflection List (LRL)
 
Fortran call:
 
      SUBROUTINE LRL_NUMSPOTS (NUMSPOTS)
 
Parameters:
 
NUMSPOTS  i (W)  The number of spots in the Laue Reflection List

3.5.3 Get Spot Counts - LRL_COUNTS

This routine returns counts of the number of spots/reflections in the Laue Reflection List in a number of different categories.
 
Fortran call:
 
      SUBROUTINE LRL_COUNTS (NUMSPOTS, NUMREFL, NUMSING, NUMMULT,
     +                       NUMSPAT, NUMCLOS)
 
Parameters:
 
NUMSPOTS  i (W)  The number of spots in the Laue Reflection List
NUMREFL   i (W)  The number of reflections in the Laue Reflection List
NUMSING   i (W)  The number of single spots in the Laue Reflection List
NUMMULT   i (W)  The number of multiple spots in the Laue Reflection List    
NUMSPAT   i (W)  The number of spots marked as spatially overlapped in
                 in the Laue Reflection List
NUMCLOS   i  (W) The number of spots marked as too close to spatially 
                 deconvolute at integration time in the Laue Reflection 
                 List

3.5.4 Return Status of Laue Reflection List - LRL_STATUS

This routine returns status information from the Laue Reflection List including the number of spots, the current sort order, the spatial overlap criterion, whether or not the coordinates were distortion corrected and whether or not intensity integration has been carried out.
 
Fortran call:
 
      SUBROUTINE LRL_STATUS (NUMSPOTS, ISORTED, IOVTYP, DISTOR, 
     +                       INTEG, INTCOD)
 
Parameters:
 
NUMSPOTS   i (W)  The number of spots in the Laue Reflection List
ISORTED    i (W)  Sort order 0 = none
                             1 = sorted on h, k, l
                             2 = sorted on nodal h, k, l
                             3 = sorted on 'xfd'
                             4 = sorted on 'yfd'
                             5 = sorted on lambda
                             6 = sorted on dminthr2
IOVTYP    i (W)    Overlaps calculation option used (0=none calculated)
                   (Value as used in call to LRL_GEN)
DISTOR    l (W)    Distortion correction flag 
                   = .true.  distortion correction was applied to stored
                             coordinates
                   = .false. distortion correction was not applied
                   Note: LRL_GET routine returns distortion corrected 
                         coordinates in either case; LRL_GET_XFYFD will
                         return stored coordinates.
INTEG     l (W)   Integration done flag =.true. yes, =.false. no
INTCOD    i (W)   Integration code type flag = 0 if not known to the
                  LRL routines.
                  =1 Integration using Q. Hao's routine LFN_SAINT as
                     used in INTLDM/LAUEGEN

3.5.5 Get Corrected Centre Position - LRL_GET_XYCEN

This routine returns the corrected centre position used when the Laue Reflection List was generated. Note that it is only valid after such a list has been generated and does not provide a means of calculating the corrected centre position.
 
Fortran call:
 
      SUBROUTINE LRL_GET_XYCEN (XCEN, YCEN)
 
Parameters:
 
XCEN   r (W)  Corrected 'x' centre position in rasters (wrt image origin)    
YCEN   r (W)  Corrected 'y' centre position in rasters (wrt image origin)

3.5.6 Number of Reflection Tries - LRL_TRIES

this routine returns the number of reflection tried when generating the Laue Reflection List and the indices of the last reflection tried.
 
Fortran call:
 
      SUBROUTINE LRL_TRIES (NUMTRIES, LAST_HKL)
 
Parameters:
 
NUMTRIES    i (W)  The number reflections tried during the reflection 
                   list generation.
LAST_HKL(3) i (W)  The indices of the last reflection tried

3.5.7 Get Pack and Plate Number - LRL_GET_PLATE

This routine returns the pack and plate number used when the Laue Reflection List was generated. Note that it is only valid after such a list has been generated.
 
Fortran call:
 
      SUBROUTINE LRL_GET_PLATE (IPACK, IPLATE)
 
Parameters:
 
IPACK  i (W)  Pack number
IPLATE i (W)  Plate number

3.5.8 Return the Nodal Index Limit - LRL_NODMAX

This routine returns the maximum nodal index for which a spot may be considered to be a nodal spot. This value is used in flagging nodal spots in the LRL.
 
Fortran call:
 
      SUBROUTINE LRL_NODMAX (NODMAX)
 
Parameters:
 
NODMAX  i (W)  The maximum nodal index for which a spot may be
               considered to be a nodal spot. This value is used 
               in flagging nodal spots in the LRL.

3.6 GET INDIVIDUAL SPOT DATA FROM LAUE REFLECTION LIST

3.6.1 Introduction

This section describes a set of routines to get information about individual spots from the Laue Reflection List.

The following routines are available:

Get Spot Details - LRL_GET
Get Harmonics Data for a Spot - LRL_GET_HARM
Return Coordinates for a Spot - LRL_GET_XFYFD
Return Integrated Intensity of a Spot - LRL_GET_INT
Get Nodal Index for a Spot - LRL_GET_NIDX
Return Spatial Overlaps Flags for a Spot - LRL_GET_OVLP
Return No. of Overload Pixels for a Spot - LRL_GET_OVPIX

3.6.2 Get Spot Details - LRL_GET

This routine returns the basic details of a spot from the Laue Reflections List. Additional routines are available to get other information as described below.
 
Fortran call:
 
      SUBROUTINE LRL_GET (ISPOT, IH, IK, IL, XD, YD, ALAM, DMTHR2,
     +                    MULT, OKNOD, SPOV, IERR)
 
Parameters:
 
ISPOT  i (R)   Spot index number (in current sort order)
IH     i (W)   Reflection 'h' index (lowest harmonic present for 
               a multiple)
IK     i (W)   Reflection 'k' index (lowest harmonic present 
               for a multiple)
IL     i (W)   Reflection 'l' index (lowest harmonic present for 
               a multiple)
XD     r (W)   'x' position on detector in raster units (corrected for
               distortion and centre) wrt image origin
YD     r (W)   'y' position on detector in raster units (corrected for
               distortion and centre) wrt image origin
ALAM   r (W)   Reflection lambda value (lowest harmonic for a multiple)
DMTHR2 r (W)   Reflection dmin_thresold2 (lowest harmonic for a multiple)
MULT   i (W)   Multiplicity
OKNOD  l (W)   Flag = .true.  non-spatially overlapped nodal spot
                    = .false. not
SPOV   l (W)   Flag = .true. spatially overlapped spot, = .false. not
IERR   i  (W)   Error flag =  0,  OK
                           =  1,  Invalid spot number
                           = -1,  Plate centre was not set (coordinates 
                                  will be returned wrt. predicted pattern 
                                  centre)

3.6.3 Get Harmonics Data for a Spot - LRL_GET_HARM

This routine returns the harmonics data for a spot in the Laue Reflections List. All the component reflections of a multiple may easily be generated from this information if required.
 
Fortran call:
 
      SUBROUTINE LRL_GET_HARM (ISPOT, IH, IK, IL, H_N, K_N, L_N,
     +                         MULT, MINHARM, MAXHARM, INCHARM,
     +                         ALNOD, DTHR2NOD, IERR)
 
Parameters:
 
ISPOT   i (R)   Spot index number (in current sort order)
IH      i (W)   Reflection 'h' index (lowest harmonic present 
                for a multiple)
IK      i (W)   Reflection 'k' index (lowest harmonic present 
                for a multiple)
IL      i (W)   Reflection 'l' index (lowest harmonic present 
                for a multiple)
H_N     i (W)   Nodal 'h' index
K_N     i (W)   Nodal 'k' index
L_N     i (W)   Nodal 'l' index
MULT    i (W)   Multiplicity
MINHARM i (W)   Minimum harmonic number
MAXHARM i (W)   Maximum harmonic number
INCHARM i (W)   Harmonics increment (returns 1 for a single)
IERR    i (W)   Error flag =  0,  OK
                           =  1,  Invalid spot number

3.6.4 Return Coordinates for a Spot - LRL_GET_XFYFD

This routine returns the predicted coordinates for a spot in the Laue Reflections List. The spot position may or may not be distortion corrected depending on the option selected when the Laue Reflection List was generated.
 
Fortran call:
 
      SUBROUTINE LRL_GET_XFYFD (ISPOT, XFD, YFD, IERR)
 
Parameters:
 
ISPOT   i (R)   Spot index number (in current sort order)
XFD     r (W)   Predicted 'x' coordinate of stored spot along 'xd' ('xf')
                wrt. predicted pattern centre
YFD     r (W)   Predicted 'y' coordinate of stored spot along 'yd' ('yf')
                wrt. predicted pattern centre
                Note: These will be distortion corrected if this option
                      was selected when the reflection list was generated
                      (normal) case (LRL_GEN, LRL_GNR). The distortion
                      correction status can be found by calling the 
                      routine LRL_STATUS
IERR    i (W)   Error flag =  0,  OK
                           =  1,  Invalid spot number

3.6.5 Return Integrated Intensity of a Spot - LRL_GET_INT

This routine will return the integrated intensity of a spot in the Laue Reflection List if this has been measured and stored (LRL_SET_INT).
 
Fortran call:
 
      SUBROUTINE LRL_GET_INT (ISPOT, AI, SIGI, MEASURED, BAD,
     +                        OVERLOAD, ICODE, ICODE_TYPE, IERR)
 
Parameters:
 
ISPOT      i  (R)   Spot index number (in current sort order)
AI         r  (W)   The integrated intensity
SIG I      r  (W)   sig(I)
MEASURED   l  (W)   Spot has been integrated flag .TRUE. yes, .FALSE. no
BAD        l  (W)   Bad spot flagged .TRUE. bad, .FALSE. good
OVERLOAD   l  (W)   Overload flag .TRUE. yes, .FALSE. no
ICODE      i  (W)   Status code fom integration program
                    For ICODE_TYPE=1   bit 0 no non-overlapped peak pixels
                                       bit 1 < 20% of peak pixels are
                                             non-overlapped.
                                       bit 2 <3 non-overlapped background
                                             pixels
                                       bit 4 < 20% of background pixels are
                                             non-overlapped.
ICODE_TYPE i  (W)   Integration code type; should be 0 if of a type 
                    unknown to the 'LRL' routines
                    = 1 Integration using Q. Hao's routines LFN_SAINT
                        as used in INTLDM and LAUEGEN
IERR       i  (W)   Error flag =  0,  OK
                               =  1,  Invalid spot number
                               =  2,  No integration done

3.6.6 Get Nodal Index for a Spot - LRL_GET_NIDX

This routine returns the 'nodal index' for a spot from the Laue Reflections List (i.e. the maximum absolute nodal index for the three indices).
 
Fortran call:
 
      SUBROUTINE LRL_GET_NIDX (ISPOT, NOD_IDX, IERR)
 
Parameters:
 
ISPOT   i (R)   Spot index number (in current sort order)
NOD_IDX i (W)   The nodal index
IERR    i (W)   Error flag =  0,  OK
                           =  1,  Invalid spot number

3.6.7 Return Spatial Overlaps Flags for a Spot - LRL_GET_OVLP

This routine returns the spatial overlaps flags for a spot in the Laue Reflections List.
 
Fortran call:
 
      SUBROUTINE LRL_GET_OVLP (ISPOT, SPOV, CLOS, IERR)
 
Parameters:
 
ISPOT   i (R)   Spot index number (in current sort order)
SPOV    l (W)   Spatially overlapped flag .TRUE. = yes, .FALSE. = no
CLOS    l (W)   Too close for spatial deconvolution flag = .TRUE. yes,
                =. FALSE. no
IERR    i (W)   Error flag =  0,  OK
                           =  1,  Invalid spot number

3.6.8 Return No. of Overload Pixels for a Spot - LRL_GET_OVPIX

This routine returns the number of overloaded pixels in a spot if set by the integration routine for a spot in the Laue Reflections List.
 
Fortran call:
 
      SUBROUTINE LRL_GET_OVPIX (ISPOT, NOVLD, IERR)
 
Parameters:
 
ISPOT   i (R)   Spot index number (in current sort order)
NOVLD   i (W)   Returns the number of overloaded pixels in the
                spot if set by the integration routine (0-255). 
                -1 indicates not set; 255 means 255 or more
                are overloaded. 
IERR    i (W)   Error flag =  0,  OK
                           =  1,  Invalid spot number

3.7 SET GLOBAL LAUE REFLECTION LIST DATA ITEMS

3.7.1 Introduction

The routines described in this section are for setting parameters which apply to the Laue Reflection List as a whole.

The following routines are available:

Clear Intensity Data - LRL_CLR_ALL
Set the 'Integration Done' Flag - LRL_SET_IDONE

3.7.2 Clear Intensity Data - LRL_CLR_ALL

This routine clears (re-initialises) the intensities data for all the spots in the Laue Reflections List. The 'integration done' flag is also cleared.
 
Fortran call:
 
      SUBROUTINE LRL_CLR_ALL
 
Parameters:
 
    none

3.7.3 Set the 'Integration Done' Flag - LRL_SET_IDONE

This routine sets the 'integration done' flag for the Laue Reflections List and also stores the integration code type.
 
Fortran call:
 
      SUBROUTINE LRL_SET_IDONE (ICODE_TYPE)
 
Parameters:
 
ICODE_TYPE  i (R)  Integration code type 0 if not known to LRL routines
                   (Used for interpreting the meanings of the 'ICODE'
                   flags assigned when an intensity is integrated)
                   =1 Integration using Q. Hao's routine LFN_SAINT
                      as used in INTLDM/LAUEGEN

3.8 SET INDIVIDUAL SPOT DATA IN LAUE REFLECTION LIST

3.8.1 Introduction

The routines described in this section enable the setting of values associated with a particular spot in the Laue Reflection List.

The following routines are available:

Store Integrated Intensity - LRL_SET_INT
Clear Intensity Data for a Spot - LRL_CLR_INT
Set Spatially Overlapped Flag for a Spot - LRL_SET_SPOV
Set 'Too Close' Flag for a Spot - LRL_SET_CLOS
Set No. of Overload Pixels for a Spot - LRL_SET_OVPIX
Set Non-spatially Overlapped Nodal Flag - LRL_SET_OKNOD

3.8.2 Store Integrated Intensity - LRL_SET_INT

This routine is used to store an integrated intensity value for a spot in the Laue Reflections List.
 
Fortran call:
 
      SUBROUTINE LRL_SET_INT (ISPOT, AI, SIGI, BAD, OVERLOAD, 
     +                        ICODE, IERR)
 
Parameters:
 
ISPOT      i  (R)   Spot index number (in current sort order)
AI         r  (R)   The integrated intensity
SIG I      r  (R)   sig(I)
BAD        l  (R)   Bad spot flag .TRUE. bad, .FALSE. good
OVERLOAD   l  (R)   Overload flag .TRUE. yes, .FALSE. no
ICODE      i  (R)   Status code from integration program (0 to 255)
                    See for example LFN_SAINT or LRL_GET_INT
IERR       i  (W)   Error flag =  0,  OK
                               =  1,  Invalid spot number

3.8.3 Clear Intensity Data for a Spot - LRL_CLR_INT

This routine will clear (re-initialise) the integrated intensity data for a spot in the Laue Reflections List.
 
Fortran call:
 
      SUBROUTINE LRL_CLR_INT (ISPOT)
 
Parameters:
 
ISPOT     i  (R)   Spot index number (in current sort order)

3.8.4 Set Spatially Overlapped Flag for a Spot - LRL_SET_SPOV

This routine sets the spatially overlapped flag for a spot in the Laue Reflection List. It is basically written for internal use but may be called by the user if desired.
 
Fortran call:
 
      SUBROUTINE LRL_SET_SPOV (ISPOT)
 
Parameters:
 
ISPOT   i (R)   Spot index number (in current sort order)

3.8.5 Set 'Too Close' Flag for a Spot - LRL_SET_CLOS

This routine sets the 'spots too close for spatial deconvolution' flag for a spot. It is basically written for internal use but may be called by the user if desired.
 
Fortran call:
 
      SUBROUTINE LRL_SET_CLOS (ISPOT)
 
Parameters:
 
ISPOT   i (R)   Spot index number (in current sort order)

3.8.6 Set No. of Overload Pixels for a Spot - LRL_SET_OVPIX

This routine sets the number of overloaded pixels in a spot for use within an integration routine for a spot in the Laue Reflections List.
 
Fortran call:
 
      SUBROUTINE LRL_SET_OVPIX (ISPOT, NOVLD, IERR)
 
Parameters:
 
ISPOT   i (R)   Spot index number (in current sort order)
NOVLD   i (R)   The number of overloaded pixels in the spot. 
                If there are more than 255 pixels overloaded,
                a value of 255 will be stored. -1 clears the 
                count in the list.
IERR    i (W)   Error flag =  0,  OK
                           =  1,  Invalid spot number

3.8.7 Set Non-spatially Overlapped Nodal Flag - LRL_SET_OKNOD

This routine sets the 'non-spatially overlapped nodal spot' flag for a spot. It is basically written for internal use but may be called by the user if desired.
 
Fortran call:
 
      SUBROUTINE LRL_SET_OKNOD (ISPOT)
 
Parameters:
 
ISPOT   i (R)   Spot index number (in current sort order)

3.9 INTERFACE FOR XDL_VIEW LAUE SIMULATIONS

3.9.1 Introduction

Special routines are available for interfacing to the XDL_VIEW X-windows toolkit Laue simulations view-object.

The following routines are available:

Interface to X-windows Laue Simulation - LRL_XDLSIM
Interface to X-windows Gnomonic Simulation - LRL_XDLGNM

3.9.2 Interface to X-windows Laue Simulation - LRL_XDLSIM

This routine provides an interface the the XDL_VIEW Laue simulation view-object routine xdlf_laue_sim. Its use enables the internal arrays storing the reflection data to be accessed directly and hence saves the user having to duplicate such information.
 
Fortran call:
 
      SUBROUTINE LRL_XDLSIM (IVH, IVHPARENT, IX, IY, ICSET, ITYPE,
     +                       ISIZE, IREPL, MINW, MINH, IERR)
 
Parameters:
 
IVH        i (R)  View object handle for laue simulations view-object
IVHPARENT  i (R)  View-object handle for parent, 0 if none
IX         i (R)  X position (may be -1 if no parent to give default)
IY         i (R)  Y position (may be -1 if no parent to give default)
ICSET      i (R)  Colorset number
ITYPE      i (R)  Type of simulation = 1, colour
                                     = 2, interactive (b/w with sliders)
ISIZE      i (R)  Halfwidth size in pixels
IREPL      i (R)  =0 new simulation, =1 replace an existing one
MINW       i (R)  Minimum width for view-object or 0 if no minimum
MINH       i (R)  Minimum height for view-object or 0 if no minimum
IERR       i (W)  Error flag =  0, OK
                             = -1, no spots in list
                             >  0, error code from xdl_laue_sim function

3.9.3 Interface to X-windows Gnomonic Simulation - LRL_XDLGNM

This routine provides an interface the the XDL_VIEW Laue simulation view-object routine xdlf_laue_sim in its mode to display a gnomonic projection of the Laue patters. Its use enables the internal arrays storing the reflection data to be accessed directly and hence saves the user having to duplicate such information.
 
Fortran call:
 
      SUBROUTINE LRL_XDLGNM (IVH, IVHPARENT, IX, IY, ICSET, ITYPE,
     +                       ISIZE, IREPL, GNOMR, MINW, MINH, IERR)
 
Parameters:
 
IVH        i (R)  View object handle for laue simulations view-object
IVHPARENT  i (R)  View-object handle for parent, 0 if none
IX         i (R)  X position (may be -1 if no parent to give default)
IY         i (R)  Y position (may be -1 if no parent to give default)
ICSET      i (R)  Colorset number
ITYPE      i (R)  Type of simulation = 1, colour
                                     = 2, interactive (b/w with sliders)
ISIZE      i (R)  Halfwidth size in pixels
IREPL      i (R)  =0 new simulation, =1 replace an existing one
GNOMR      r (R)  Minimum radius in mm (>0.1) from image centre for 
                  conversion of plot to a gnomonic projection.
                  (If a value <= 0.1 is given a normal Laue 
                  simulation will be given) 
MINW       i (R)  Minimum width for view-object or 0 if no minimum
MINH       i (R)  Minimum height for view-object or 0 if no minimum
IERR       i (W)  Error flag =  0, OK
                             = -1, no spots in list
                             >  0, error code from xdl_laue_sim function

3.10 RE-ASSIGN SPATIAL OVERLAPS AND MULTIPLICITIES

3.10.1 Introduction

A set of routines have been written to enable an alternative assignment of spatially overlapped and multiple spots using revised values of the Laue soft limits. This effectively enables some re-processing of the data without having to re-integrate spot intensities provided that conservative values have been used for the soft limits when the reflection list was generated. The re-assigned flags are held separately from the original flags and are accessed via the routines described in this section.

The following routines are available:

Reassigning spatial overlaps - LRL_REASSIGN
Get Re-assigned Spot Flags - LRL_GET_REASS

3.10.2 Reassigning spatial overlaps - LRL_REASSIGN

This routine enables the spatial overlap/multiplicity flags to be re-assigned for different values of the Laue soft limits (lambda-min, lambda-max, dmin) without regenerating the Laue Reflection List. The re-assigned flags are saved separately from the original flags and may be accessed via the LRL_GET_REASS routine. The LDM values for the soft limits are not reset.
 
Fortran call:
 
      SUBROUTINE  LRL_REASSIGN (IOVTYP, WMIN, WMAX, DMIN,
     +                          IERR, ERRSTR)
 
Parameters:
 
IOVTYP    i (R)   Flag for calculation of spatial overlaps
                       = 1, analytical calculation (spot + unused
                            pixel + border) v spot
                       = 2, analytical calculation (spot + border) v spot
                       = 3, analytical calculation spot v spot
                       = 4, mask method (spot + unused pixel + border) 
                            v spot
                       = 5, mask method (spot + border) v spot
                       = 6, mask method spot v spot

WMIN      r (R)   New value for lambda-min
WMAX      r (R)   New value for lambda-max
DMIN      r (R)   New value for 'dmin'

                  Note: New lambda soft limits must be within range
                        of those used in generating the reflection list 
                        and new 'dmin' must not be lower than that used
                        generating the reflection list; otherwise the
                        limits will be reset to meet these conditions
                        and IERR will be returned with a value of -1

IERR      i (W)  Error flag = 0, OK
                            =-1, New limits reset to be within range
                            = 1, Invalid overlaps type flag
                            = 2, Too many spots in a strip for overlaps 
                                 check
ERRSTR    c (W)  Error message string (max 80 characters)

3.10.3 Get Re-assigned Spot Flags - LRL_GET_REASS

This routine enables the reassigned spot flags to be retrieved for a given spot in the Laue Reflections List after such re-assignment has been done via a call to the routine LRL_REASSIGN
 
Fortran call:
 
      SUBROUTINE LRL_GET_REASS (ISPOT, MULT, MINHARM, MAXHARM, INCHARM,
     +                         SPOV, CLOS, OKNOD, IERR)
 
Parameters:
 
ISPOT   i (R)   Spot index number (in current sort order)
MULT    i (W)   Multiplicity  (Note: may be 0 after re-assigning limits
                i.e. spot may no longer be recorded
MINHARM i (W)   Minimum harmonic number
MAXHARM i (W)   Maximum harmonic number
INCHARM i (W)   Harmonics increment (returns 1 for a single)
SPOV    l (W)   Spatially overlapped = .TRUE. yes, = .FALSE. no
CLOS    l (W)   Too close to deconvolute = .TRUE. yes, = .FALSE. no
OKNOD   l (W)   Non-spatially overlapped nodal = .TRUE. yes, = .FALSE. no
IERR    i (W)   Error flag =  0,  OK
                           =  1,  Invalid spot number

3.11 DETERMINE SPATIAL OVERLAP BETWEEN TWO SPOTS

3.11.1 Introduction

These routines are to determine whether two spots are spatially overlapped. The elliptical LDM spot shapes are used and two different methods are available.

The following routines are available:

Determine Spot Ellipse Overlap (analytical) - LRL_OVQ
Determine Spot Ellipse Overlap (using mask) - LRL_OVM

3.11.2 Determine Spot Ellipse Overlap (analytical) - LRL_OVQ

This routine determines whether two elliptical spots, with or without a background border, overlap using an anlytical procedure. The routine makes the approximation that the two ellipses are the same size and have the same orientation (reasonable as close spots are being considered).
 
Fortran call:
 
      LOGICAL FUNCTION LRL_OVQ (SPOT_L, SPOT_W, SPOTFAC, SPOT_B, CTOF,
     +                          RASTOMM, X1, Y1, X2, Y2, ITYP)
 
Parameters:
 
SPOT_L    r (R)  Spot length in mm.
SPOT_W    r (R)  Spot width in mm.
SPOTFAC   r (R)  Spot expansion factor
SPOT_B    r (R)  Background border width in rasters
CTOF      r (R)  Crystal to plate distance in mm.
RASTOMM   r (R)  Conversion factor rasters to mm (x)
X1        r (R)  'x' position of reference spot in mm. 
Y1        r (R)  'y' position of reference spot in mm.
X2        r (R)  'x' position of second spot in mm.
Y2        r (R)  'y' position of second spot in mm.
ITYP      i (R)  Flag = 1, Check that (spot + unused pixel + background 
                           border) does not overlap with next spot 
                      = 2, Check that (spot + background border) does not    
                           overlap with next spot
                      = 3, Check overlap strictly for spot area

          Return is .TRUE. if spots overlap, otherwise .FALSE.

3.11.3 Determine Spot Ellipse Overlap (using mask) - LRL_OVM

This routine determines whether two elliptical spots, with or without a background border, overlap using a mask procedure based on code from the UPDATE program by T.J. Greenhough and A.K. Shrive.
 
Fortran call:
 
      LOGICAL FUNCTION LRL_OVM (SPOT_L, SPOT_W, SPOTFAC, SPOT_B, CTOF,
     +                      MM_RAST_X, MM_RAST_Y, X1, Y1, X2, Y2, ITYP)
 
Parameters:
 
SPOT_L    r (R)  Spot length in mm.
SPOT_W    r (R)  Spot width in mm.
SPOTFAC   r (R)  Spot expansion factor
SPOT_B    r (R)  Background border width in rasters
CTOF      r (R)  Crystal to plate distance in mm.
MM_RAST_X r (R)  Conversion factor mm to x-rasters 
MM_RAST_Y r (R)  Conversion factor mm to y-rasters
X1        r (R)  'x' position of reference spot in mm. 
Y1        r (R)  'y' position of reference spot in mm.
X2        r (R)  'x' position of second spot in mm.
Y2        r (R)  'y' position of second spot in mm.
ITYP      i (R)  Flag = 1, Check that (spot + unused pixel + background 
                           border) does not overlap with next spot 
                      = 2, Check that (spot + background border) does not
                           overlap with next spot
                      = 3, Check overlap strictly for spot area

          Returns .TRUE. if spots overlap, otherwise .FALSE.

3.12 MISCELLANEOUS ROUTINES

3.12.1 Introduction

This section describes some routines which are basically for internal use but may also be called by the user if desired.

The following routines are available:

Highest Common Factor of Two Numbers - LRL_HCF
Convert Between Real and Reciprocal Cells - LRL_RECCEL
Get Nodal Index from Indices - LRL_NODIDX

3.12.2 Highest Common Factor of Two Numbers - LRL_HCF

This routine, based on code by I.J. Clifton, returns the highest common factor of two integers.
 
Fortran call:
 
      INTEGER FUNCTION  LRL_HCF (II,JJ)
 
Parameters:
 
II    i (R)   First integer
JJ    i (R)   Second integer

      Returns the highest common factor of the two integers

3.12.3 Convert Between Real and Reciprocal Cells - LRL_RECCEL

This routine converts between real and reciprocal cell parameters.
 
Fortran call:
 
      SUBROUTINE LRL_RECCEL(RX ,CX ,WAVE)
 
Parameters:
 
RX(6)   r  (W) Converted cell parameters reciprocal or real
CX(6)   r  (R) Input cell parameters real or reciprocal
WAVE    r  (R) Standard wavelength

3.12.4 Get Nodal Index from Indices - LRL_NODIDX

This routine determines the nodal index from a set of reflection indices.
 
Fortran call:
 
      SUBROUTINE LRL_NODIDX (IH, IK, IL, NODIDX)
 
Parameters:
 
IH      i  (R) 'h' index
IK      i  (R) 'k' index
IL      i  (R) 'l' index
NODIDX  i  (W) Returns nodal index



John W. Campbell
CCLRC Daresbury Laboratory
Last update 16 Jan 1998