C LAST UPDATE: 
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C**************************
C**     LRL_GET_REASS    **
C**************************
C
CD-Routine: Get Re-assigned Spot Flags - LRL_GET_REASS
C This routine enables the reassigned spot flags to be retrieved for
C a given spot in the Laue Reflections List after such re-assignment has
C been done via a call to the routine LRL_REASSIGN
CD-end
CD-Fortran:
      SUBROUTINE LRL_GET_REASS (ISPOT, MULT, MINHARM, MAXHARM, INCHARM,
     +                         SPOV, CLOS, OKNOD, IERR)
CD-end
      INCLUDE 'implicit_none.finc'
C
C Purpose: Get re-assigned data for a spot (after using LRL_REASSIGN)
C
C Author:  John W. Campbell, October 1993
C
C Arguments:
C
      INTEGER ISPOT
      INTEGER MULT
      INTEGER MINHARM
      INTEGER MAXHARM
      INTEGER INCHARM
      LOGICAL SPOV
      LOGICAL CLOS
      LOGICAL OKNOD
      INTEGER IERR
CD-Parameters:
C ISPOT   i (R)   Spot index number (in current sort order)
C MULT    i (W)   Multiplicity  (Note: may be 0 after re-assigning limits
C                 i.e. spot may no longer be recorded
C MINHARM i (W)   Minimum harmonic number
C MAXHARM i (W)   Maximum harmonic number
C INCHARM i (W)   Harmonics increment (returns 1 for a single)
C SPOV    l (W)   Spatially overlapped = .TRUE. yes, = .FALSE. no
C CLOS    l (W)   Too close to deconvolute = .TRUE. yes, = .FALSE. no
C OKNOD   l (W)   Non-spatially overlapped nodal = .TRUE. yes, = .FALSE. no
C IERR    i (W)   Error flag =  0,  OK
C                            =  1,  Invalid spot number
CD-end
C
C====== GLOBALS:
C
      INCLUDE 'lrl_data.finc'
C
C====== FUNCTION TYPES:
C
      INTEGER NBITST
      EXTERNAL LRL_BDAT
C
C====== LOCALS:
C   
      LOGICAL OK
      INTEGER I
      INTEGER IH
      INTEGER IK
      INTEGER IL
      INTEGER H_N
      INTEGER K_N
      INTEGER L_N
      INTEGER IHARM
      INTEGER MINH
      INTEGER MAXH
      REAL LAMBDA
      REAL DTHR2
C
C     LOGICAL OK      !Harmonic still OK flag
C     INTEGER I       !Index to spot
C     INTEGER IH      !'h' index
C     INTEGER IK      !'k' index
C     INTEGER IL      !'l' index
C     INTEGER H_N     !'h' nodal index
C     INTEGER K_N     !'k' nodal index
C     INTEGER L_N     !'l' nodal index
C     INTEGER IHARM   !Loop counter for harmonics
C     INTEGER MINH    !Minimum harmonic (before re-assign)
C     INTEGER MAXH    !Maximum harmonic (before re-assign)
C     REAL LAMBDA     !Lambda
C     REAL DTHR2      !1/dmin**2
C
C-------------------------------------------------------------------------------
C
      IERR = 0
      MINHARM = 0
      MAXHARM = 0
      INCHARM = 1
      SPOV = .FALSE.
      CLOS = .FALSE.
      OKNOD = .FALSE.
      IF (ISPOT.LT.1.OR.ISPOT.GT.NUM_SPOTS) THEN
         IERR = 1
         RETURN
      END IF
      I = INDX(ISPOT)
      CALL LRL_GETHKL (HKL(I), IH, IK, IL)
      CALL LRL_GETHKL (NOD_HKL(I), H_N, K_N, L_N)
      IF (MULTS(I).EQ.1) THEN
         MULT = 1
         IF (LAMBDAS(I).LT.LMIN_NEW.OR.LAMBDAS(I).GT.LMAX_NEW) THEN
            MULT = 0
            RETURN
         END IF
         IF (DMIN_THR2(I).GT.DTHR2_NEW) THEN
            MULT = 0
            RETURN
         END IF
         MINHARM = 0
         IF (H_N.NE.0) THEN
            MINHARM = IH/H_N
         ELSE IF (K_N.NE.0) THEN
            MINHARM = IK/K_N
         ELSE IF (L_N.NE.0) THEN
            MINHARM = IL/L_N
         END IF
         MAXHARM = MINHARM
         INCHARM = 1
      ELSE
         CALL LRL_GETMULT (MULTS(I), MULT, MINH, MAXH, INCHARM)
         MINHARM = MAXH
         MAXHARM = MINH
         MULT = 0
         DO 10 IHARM = MINH, MAXH, INCHARM
            OK = .TRUE.
            LAMBDA = LAMBDAS(I) * FLOAT(MINH) / FLOAT(IHARM)
            DTHR2 = DMIN_THR2(I) * FLOAT(IHARM) / FLOAT(MINH)
            IF (LAMBDA.LT.LMIN_NEW.OR.LAMBDA.GT.LMAX_NEW) OK = .FALSE.
            IF (DTHR2.GT.DTHR2_NEW) OK = .FALSE.
            IF (OK) THEN
               MULT = MULT + 1
               IF (IHARM.LT.MINHARM) MINHARM = IHARM
               IF (IHARM.GT.MAXHARM) MAXHARM = IHARM
            END IF
10       CONTINUE
         IF (MULT.EQ.0) THEN
            MINHARM = 0
            MAXHARM = 0
         END IF
      OKNOD = .FALSE.
      IF (NBITST(FLAGS(I),2,1).NE.0) SPOV = .TRUE.
      IF (NBITST(FLAGS(I),4,1).NE.0) OKNOD = .TRUE.
      IF (SPOV) OKNOD = .FALSE.
      IF (NBITST(FLAGS(I),3,1).NE.0) CLOS = .TRUE.
      END IF
      RETURN
      END
