
CD-Section: Get Individual Spot Data from Laue Reflection List
C This section describes a set of routines to get information about
C individual spots from the Laue Reflection List.
CD-end

C LAST UPDATE: 
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C**************************
C**     LRL_GET          **
C**************************
C
CD-Routine: Get Spot Details - LRL_GET
C This routine returns the basic details of a spot from the Laue Reflections 
C List. Additional routines are available to get other information as 
C described below.
CD-end
CD-Fortran:
      SUBROUTINE LRL_GET (ISPOT, IH, IK, IL, XD, YD, ALAM, DMTHR2,
     +                    MULT, OKNOD, SPOV, IERR)
CD-end
      INCLUDE 'implicit_none.finc'
C
C Purpose: Return spot details
C
C Author:  John W. Campbell, July 1993
C
C Arguments:
C
      INTEGER ISPOT
      INTEGER IH
      INTEGER IK
      INTEGER IL
      REAL XD
      REAL YD
      REAL ALAM
      REAL DMTHR2
      INTEGER MULT
      LOGICAL OKNOD
      LOGICAL SPOV
      INTEGER IERR
CD-Parameters:
C ISPOT  i (R)   Spot index number (in current sort order)
C IH     i (W)   Reflection 'h' index (lowest harmonic present for 
C                a multiple)
C IK     i (W)   Reflection 'k' index (lowest harmonic present 
C                for a multiple)
C IL     i (W)   Reflection 'l' index (lowest harmonic present for 
C                a multiple)
C XD     r (W)   'x' position on detector in raster units (corrected for
C                distortion and centre) wrt image origin
C YD     r (W)   'y' position on detector in raster units (corrected for
C                distortion and centre) wrt image origin
C ALAM   r (W)   Reflection lambda value (lowest harmonic for a multiple)
C DMTHR2 r (W)   Reflection dmin_thresold2 (lowest harmonic for a multiple)
C MULT   i (W)   Multiplicity
C OKNOD  l (W)   Flag = .true.  non-spatially overlapped nodal spot
C                     = .false. not
C SPOV   l (W)   Flag = .true. spatially overlapped spot, = .false. not
C IERR   i  (W)   Error flag =  0,  OK
C                            =  1,  Invalid spot number
C                            = -1,  Plate centre was not set (coordinates 
C                                   will be returned wrt. predicted pattern 
C                                   centre)
CD-end
C
C====== GLOBALS:
C
      INCLUDE 'lrl_data.finc'
C
C====== FUNCTION TYPES:
C
      INTEGER NBITST
      EXTERNAL LRL_BDAT
C
C====== LOCALS:
C   
      INTEGER J
      INTEGER NTWO20
      REAL XFD
      REAL YFD

      DATA NTWO20/1048576/
C
C-------------------------------------------------------------------------------
C
      IERR = 0
      IF (ISPOT.LT.1.OR.ISPOT.GT.NUM_SPOTS) THEN
         IERR = 1
         RETURN
      END IF
      J = INDX(ISPOT)
      CALL LRL_GETHKL (HKL(J), IH, IK, IL)
      IF (DISTOR_CORR) THEN
         XD = GXCEN + XF_D(J)*GMM_RAST_X
         YD = GYCEN + YF_D(J)*GMM_RAST_Y
      ELSE
         CALL LDM_CORR (IPK, IPL, GCOS_WC, GSIN_WC, GCTOF,
     +                  XF_D(J), YF_D(J), XFD, YFD)
         XD = GXCEN + XFD*GMM_RAST_X
         YD = GYCEN + YFD*GMM_RAST_Y
      END IF
      IF (GXCEN.LE.0.0.OR.GYCEN.LE.0.0) IERR = -1
      ALAM = LAMBDAS(J)
      DMTHR2 = DMIN_THR2(J)
      IF (MULTS(J).EQ.1) THEN
         MULT = 1
      ELSE
         MULT = MULTS(J)/NTWO20
      END IF
      OKNOD = .FALSE.
      IF (NBITST(FLAGS(J),4,1).NE.0) OKNOD = .TRUE.
      SPOV = .FALSE.
      IF (NBITST(FLAGS(J),0,1).NE.0) SPOV = .TRUE.
      RETURN
      END
