**==wavebins.spg  processed by SPAG 4.50J  at 14:50 on 30 Jun 1995
      SUBROUTINE WAVEBINS(Nbin,Binmin,Binsyz,Nbln,Blnmin,Blnsyz)
      IMPLICIT NONE
C*** Start of declarations inserted by SPAG
      REAL binmax , Binmin , Binsyz , Blnmin , Blnsyz , wlengthmax , 
     &     wlengthmin
      INTEGER Nbin , Nbln
C*** End of declarations inserted by SPAG
c
      CHARACTER*1 iab
      LOGICAL*4 flag , backflag
c
c  Calculates or reads the wavelenghth limits required.
      binmax = Binmin + Nbin*Binsyz
      wlengthmin = 12400./binmax
      wlengthmax = 12400./Binmin
 100  Nbln = 100
      Blnmin = wlengthmin
      Blnsyz = (wlengthmax-wlengthmin)/100.
 200  PRINT * , ' No. of bins? (' , Nbln , ')'
      READ (*,*,END=100)  , Nbln
 300  PRINT * , ' Lowest wavelength in A ? (' , Blnmin , ')'
      READ (*,*,END=200)  , Blnmin
 400  PRINT * , ' Binsize in A ? (' , Blnsyz , ')'
      READ (*,*,END=300)  , Blnsyz
      IF ( Blnmin.LT.(wlengthmin-0.01) .OR. (Blnmin+Nbln*Blnsyz)
     &     .GT.(wlengthmax+0.01) ) THEN
         iab = 'y'
         WRITE (*,
     &'('' Warning: Wavelength range exceeds that '',            ''of th
     &e calculated energy spectrum.'')')
         CALL QUESTCHAR('Do you want to try again',flag,backflag,iab)
         IF ( backflag ) GOTO 400
         IF ( flag ) GOTO 100
      ENDIF
      RETURN
      END
