!+ Subroutine to find points just with a band.
!
! Method:
!	A spectrum of wavelengths is passed to the routine. The indices
!	of points of the spectrum just within a given band are found
!	by taking the end-points of the spectrum and moving in.
!
! Current Owner of Code: J. M. Edwards
!
! History:
!	Version		Date			Comment
!	1.0		12-04-95		First Version under RCS
!						(J. M. Edwards)
!
! Description of Code:
!   FORTRAN 77  with extensions listed in documentation.
!
!- ---------------------------------------------------------------------
      SUBROUTINE INNER_BRACKET(IERR
     &   , WAVE_LENGTH_SHORTER, WAVE_LENGTH_LONGER
     &   , N_POINTS, SPECTRUM
     &   , I_SHORT, I_LONG)
!
!
      IMPLICIT NONE
!
!
!     INCLUDE HEADER FILES.
      INCLUDE 'incl/def_std_io.icf'
      INCLUDE 'incl/dimensions_pp.ucf'
      INCLUDE 'incl/error.pcf'
!
      INTEGER	!, INTENT(OUT)
     &     IERR
!             ERROR FLAG
     &   , I_SHORT
!             SHORT POINT
     &   , I_LONG
!             LONG POINT
      INTEGER	!, INTENT(IN)
     &     N_POINTS
!             NUMBER OF POINTS IN SPECTRUM
      REAL*8	!, INTENT(IN)
     &     WAVE_LENGTH_SHORTER
!             SHORTER WAVELENGTH
     &   , WAVE_LENGTH_LONGER
!             LONGER WAVELENGTH
     &   , SPECTRUM(NPD_SOLAR_POINTS)
!             SPECTRUM OF WAVELENGTHS
!
!
!     CHECK THE ORDER OF THE INPUTS.
      IF (WAVE_LENGTH_SHORTER.GE.WAVE_LENGTH_LONGER) THEN
         WRITE(IU_ERR, '(/A)')
     &      '*** ERROR: WAVELENGTHS ARE INCORRECTLY ORDERED.'
         IERR=I_ABORT_CALCULATION
         RETURN
      ENDIF
!
!     INITIALIZE I_SHORT AND I_LONG AND THEN SEARCH.
      I_SHORT=1
      I_LONG=N_POINTS
1     IF (WAVE_LENGTH_SHORTER.GE.SPECTRUM(I_SHORT)) THEN
         I_SHORT=I_SHORT+1
         IF (I_SHORT.LE.N_POINTS) GOTO 1
      ENDIF
2     IF (WAVE_LENGTH_LONGER.LE.SPECTRUM(I_LONG)) THEN
         I_LONG=I_LONG-1
         IF (I_LONG.GE.1) GOTO 2
      ENDIF
!
!
      RETURN
      END
