
C LAST UPDATE:
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C**************************
C**     LSM_CLR_PKPL     **
C**************************
C
C
CD-Routine: Clear packs and plates from selection - LSM_CLR_PKPL
C This routine is used to clear packs/plates from the selection
C made by LSM_SELECT_PKPL.
CD-end
CD-Fortran:
      SUBROUTINE LSM_CLR_PKPL (IPACK, IPLATE)
CD-end
C
      INCLUDE 'implicit_none.finc'
C
C Purpose: Clear Packs and Plates from Selection
C
C Author:  Steffi Arzt, John Campbell, July 1997
C
C Arguments:
C
      INTEGER IPACK
      INTEGER IPLATE
C
CD-Parameters:
C  IPACK       i (R)   No. of pack to clear from the current packs/plates
C                      selection (0 = all packs)
C  IPLATE      i (R)   No. of plate to clear from the current packs/plates
C                      selection (0 = all plates)
CD-end
C
C Implementation note: Sets 'select required' flag
C
C
C====== PARAMETERS:
C
      INCLUDE 'limits.finc'
C
C====== GLOBALS:
C
      INCLUDE 'use_reflns.finc'
      INCLUDE 'lsm_flags.finc'
C
C====== LOCALS:
C
      INTEGER IPK
      INTEGER IPL
      INTEGER IPK_MIN
      INTEGER IPK_MAX
      INTEGER IPL_MIN
      INTEGER IPL_MAX

C     INTEGER IPK              ! Packs loop counter
C     INTEGER IPL              ! Plates loop counter
C     INTEGER IPK_MIN          ! Minimum pack no. for loop
C     INTEGER IPK_MAX          ! Maximum pack no. for loop
C     INTEGER IPL_MIN          ! Minimum plate no. for loop
C     INTEGER IPL_MAX          ! Maximum plate no. for loop
C
C-------------------------------------------------------------------------------
C
      IF (IPACK.GT.MAXPACK.OR.IPLATE.GT.MAXPLATES) RETURN
C
C====== Note: Use MAXPACK & MAXPLATES here and check against actual limits
C             later (e.g. in LSM_TOP_LIRL
C
      IF (IPACK.GT.0) THEN
         IPK_MIN = IPACK
         IPK_MAX = IPACK
      ELSE
         IPK_MIN = 1
         IPK_MAX = MAXPACK
      END IF
      IF (IPLATE.GT.0) THEN
         IPL_MIN = IPLATE
         IPL_MAX = IPLATE
      ELSE
         IPL_MIN = 1
         IPL_MAX = MAXPLATES
      END IF

      DO 200 IPK = IPK_MIN, IPK_MAX
         DO 100 IPL = IPL_MIN, IPL_MAX
            PKPL_USE(IPK,IPL) = .FALSE.
 100     CONTINUE
 200  CONTINUE
      SELECT_REQUIRED = .TRUE.
      RETURN
      END
