      SUBROUTINE READSOLSPEC(LSSPC,MSSPC,NVTS,SSPC)
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C READSOLSPEC READS IN THE SOLAR SPECTRUM DATA.
C
C INPUT PARAMETERS:
C  
C   LSSPS --- UNIT NUMBER OF SOLAR SPECTRUM DATA FILE.
C   MSSPC --- MAXIMUM SIZE OF SOLAR SPECTRUM ARRAY.
C   NVTS  --- NUMBER OF SIMULATED VIBRATIONAL BANDS.
C
C OUTPUT PARAMETER:
C
C   SSPC  --- SOLAR SPECTRUM ARRAY.
C
C FORMAT OF SOLAR SPECTRUM ARRAY:
C
C   SSPC(1)   --- BEGINNING WAVENUMBER IN SOLAR SPECTRUM (cm-1).
C   SSPC(2)   --- ENDING WAVENUMBER IN SOLAR SPECTRUM (cm-1).
C   SSPC(3)   --- WAVENUMBER INCREMENT IN SOLAR SPECTRUM DATA (cm-1).
C   SSPC(I>3) --- SOLAR SPECTRUM DATA (W/m^2/cm-1).
C
C FORMAT FOR FIXED SOLAR FLUX: 
C
C   SSPC(1)   --- SET BEGINNING WAVENUMBER LESS THAN ZERO.
C   SSPC(2)   --- SET ENDING WAVENUMBER LESS THAN ZERO.
C   SSPC(3)   --- SET WAVENUMBER INCREMENT LESS THAN ZERO.
C   SSPC(I>3) --- SOLAR FLUX DATA (W/m^2). SPECIFY A SOLAR FLUX VALUE
C                 FOR EACH SIMULATED VIBRATIONAL BAND, IN THE SAME
C                 ORDER AS THE INPUT BAND SIMULATIONS.
C
C SOFTWARE WRITTEN BY Christopher J. Mertens
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C      (c) Copyright 1987-2000 by GATS, Inc.
C          11864 Canon Blvd., Suite 101, Newport News, Virginia, 23606
C          Phone: (757) 873-5920
C
C  All Rights Reserved. No part of this software or publication may be
C  reproduced, stored in a retrieval system, or transmitted, in any form
C  or by any means, electronic, mechanical, photocopying, recording, or
C  otherwise without the prior written permission of GATS, Inc.
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
      DIMENSION SSPC(MSSPC)

      READ(LSSPC,*)
      READ(LSSPC,*) WNMIN,WNMAX,WINC
      READ(LSSPC,*)

      SSPC(1)=WNMIN
      SSPC(2)=WNMAX
      SSPC(3)=WINC

      IF(WNMIN.GT.0.0.AND.WNMAX.GT.0.0.AND.WINC.GT.0.0) THEN

        RSSPC=(WNMAX-WNMIN)/WINC+1.01
        NSSPC=INT(RSSPC)
        NSSPCMX=NSSPC+3
        WRITE(*,*) rsspc,nsspc
        IF(NSSPCMX.GT.MSSPC) THEN
          WRITE(*,*) 'SOLAR SPECTRUM ARRAY IS UNDER DIMENSIONED'
          WRITE(*,*) 'INCREASE SIZE TO AT LEAST ',NSSPCMX
          STOP 'ERROR IN READSOLSPEC'
        ENDIF

        DO ISS=1,NSSPC
          XOLD=XDUM
          READ(LSSPC,*) XDUM,SSPC(ISS+3)
          IF(ISS.GT.1) THEN
            XDIFF=XDUM-XOLD
            IF(XDIFF.GT.1.01) write(*,*) iss,xdum
          ENDIF
        ENDDO
      
      ELSEIF(WNMIN.LT.0.0.AND.WNMAX.LT.0.0.AND.WINC.LT.0.0) THEN
	
        IF(NVTS.GT.MSSPC) THEN
          WRITE(*,*) 'SOLAR FLUX ARRAY IS UNDER DIMENSIONED'
          WRITE(*,*) 'INCREASE SIZE TO AT LEAST ',NVTS
          STOP 'ERROR IN READSOLSPEC'
        ENDIF

        DO ISS=1,NVTS
          READ(LSSPC,*) SSPC(ISS+3)
        ENDDO

      ELSE

        WRITE(*,*) 'INVALID SPECIFICATION OF WNMAX,WNMIN,WINC',
     &                                       WNMAX,WNMIN,WINC
        STOP 'ERROR READING SOLAR SPECTRUM/FLUX FILE IN READSOLSPEC'
	
      ENDIF  	
	
      RETURN
      END
