
C LAST UPDATE:
C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++C
C***************************
C**     LSM_NEXT_REFLN    **
C***************************
C
C
CD-Routine: Get reflection set from LIRL - LSM_NEXT_REFLN
C Gets the next singles reflection set from the LIRL. The reflection set
C includes only those reflections of the selected packs and plates
C (LSM_SELECT_PKPL, LSM_ADD_PKPL, LSM_CLR_PKPL) and classes
C (LSM_SELECT_SCREFS). The function returns the number of individual
C reflections in the set or -1 when the end of the list is reached.
C The LIRL indices of the individual reflections in the set can be
C obtained using the supplied function LSM_INDX and using this the
C reflection details can be retrieved using the normal LIRL set of
C routines.
CD-end
CD-Fortran:
      INTEGER FUNCTION LSM_NEXT_REFLN (IERR)
CD-end
C
      INCLUDE 'implicit_none.finc'
C
C Purpose: Get Reflection Set from LIRL  
C
C Author:  Steffi Arzt, John Campbell, July 1997
C
C Arguments:
C
      INTEGER IERR
C
CD-Parameters:
C
C  IERR        i (R)   Error flag =0 OK, =1 error (markup_required flag
C                      or select_required flag found to be set)
C
C         Returns >=1   the number of reflections in the set
C                  -1   when the end of the list is reached
CD-end
C
C Implementation note: Checks that 'markup required' flag not set

C
C====== PARAMETERS:
C
      INCLUDE 'limits.finc'
C
C====== GLOBALS:
C
      INCLUDE 'next_refl.finc'
      INCLUDE 'lsm_flags.finc'
C
C====== LOCALS:
C
      INTEGER IFLAG

C
C
C-------------------------------------------------------------------------------
C
      IERR = 0
      IF (MARKUP_REQUIRED.OR.SELECT_REQUIRED) THEN
         IERR = 1
         RETURN
      END IF
      CALL LIRLF_LSM_NEXT (INDX_ARR, MAX_SYMEQ, NREFS, 0, IFLAG)
      IF (IFLAG.GE.0) THEN
         LSM_NEXT_REFLN = NREFS
         RETURN
      ELSE
         LSM_NEXT_REFLN = -1
         RETURN
      END IF
      END
