
CD-Section: Set Individual Spot Data in Laue Reflection List
C The routines described in this section enable the setting of values
C associated with a particular spot in the Laue Reflection List.
CD-end

C LAST UPDATE: 
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C**************************
C**     LRL_SET_INT      **
C**************************
C
CD-Routine: Store Integrated Intensity - LRL_SET_INT
C This routine is used to store an integrated intensity value for a spot
C in the Laue Reflections List.
CD-end
CD-Fortran:
      SUBROUTINE LRL_SET_INT (ISPOT, AI, SIGI, BAD, OVERLOAD, 
     +                        ICODE, IERR)
CD-end
      INCLUDE 'implicit_none.finc'
C
C Purpose: Set integrated intensity data for a spot
C
C Author:  John W. Campbell, July 1993
C
C Arguments:
C
      INTEGER ISPOT
      REAL    AI
      REAL    SIGI
      LOGICAL BAD
      LOGICAL OVERLOAD
      INTEGER ICODE
      INTEGER IERR
CD-Parameters:
C ISPOT      i  (R)   Spot index number (in current sort order)
C AI         r  (R)   The integrated intensity
C SIG I      r  (R)   sig(I)
C BAD        l  (R)   Bad spot flag .TRUE. bad, .FALSE. good
C OVERLOAD   l  (R)   Overload flag .TRUE. yes, .FALSE. no
C ICODE      i  (R)   Status code from integration program (0 to 255)
C                     See for example LFN_SAINT or LRL_GET_INT
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
      EXTERNAL LRL_BDAT
C
C====== LOCALS:
C   
      INTEGER I
      INTEGER J
C
C     INTEGER I        !Index to spot
C     INTEGER J        !Temp value for flag
C
C-------------------------------------------------------------------------------
C
      IERR = 0
      IF (ISPOT.LT.1.OR.ISPOT.GT.NUM_SPOTS) THEN
         IERR = 1
         RETURN
      END IF
      I = INDX(ISPOT)
      AII(I) = AI
      SIGII(I) = SIGI
      CALL STBITS (FLAGS(I),8,1,1)
      J = 0
      IF (BAD) J = 1
      CALL STBITS (FLAGS(I),9,1,J)
      J = 0
      IF (OVERLOAD) J = 1
      CALL STBITS (FLAGS(I),10,1,J)
      CALL STBITS (FLAGS(I),12,8,ICODE)
      RETURN
      END
