        subroutine CHEMIN(CHEM1)
      include 'SIZE.INC'
      include 'GLOBAL.INC'
      include 'LOCAL.INC'
      include 'UNITS.INC'
      integer I, J, K, KSTART, KSTOP
      character*3 CHEM1(NCHEM),CHEM2(NCHEM)
      if (CHEM1(1).eq.'QQQ') then
         KSTART = MCHEMG
         KSTOP = MCHEMG
      else
         KSTART = 1
         KSTOP = KCHEM
      endif
      if (CHEM1(1).eq.'QQQ') go to 100
      if (KCHEM.le.0.or.KCHEM.gt.NCHEM) then
         write (TTYOUT(MACHNO),5000) NCHEM,KCHEM
5000  format (/1X,'This version of EXAMS was set up for',I3/1X,'chemical
     &s at most; the run request for',I3/1X,'chemicals has been cancelle
     &d.')
         IFLAG = 8
         go to 170
      endif
5010  format (A3)
5020  format (8F10.0)
      open (unit=CHELUN(MACHNO),FILE='CHEMDAT.DAT',status='OLD')
      if (.not.(TOPOPN(MACHNO))) rewind CHELUN(MACHNO)
100   continue
      do 140 K = KSTART, KSTOP
         if (CHEM1(1).eq.'QQQ') go to 120
110      continue
         read (CHELUN(MACHNO),5010,end=150) CHEM2(K)
         if (CHEM2(K).ne.CHEM1(K)) go to 110
120      continue
         read (CHELUN(MACHNO),5030) (CHEMNA(I,K),I=1,50)
5030     format (50A1)
         read (CHELUN(MACHNO),5040) (SPFLGG(I,K),I=1,7)
5040     format (7(I1,1X))
         read (CHELUN(MACHNO),5020) MWTG(K),KOCG(K),KOWG(K)
         read (CHELUN(MACHNO),5020) KVOG(K),HENRYG(K),EHENG(K),VAPRG(K),
     &      EVPRG(K)
         do 130 J = 1, 7
            if (SPFLGG(J,K).ne.1) go to 130
            read (CHELUN(MACHNO),5020) SOLG(J,K),ESOLG(J,K),KPSG(J,K),
     &         KPBG(J,K),KPDOCG(J,K)
            if (J.gt.1) read (CHELUN(MACHNO),5020) PKG(J-1,K),EPKG(J-1,K
     &         ),KIECG(J-1,K)
            read (CHELUN(MACHNO),5020) (QUANTG(I,J,K),I=1,3)
            read (CHELUN(MACHNO),5020) (ABSORG(I,J,K),I=1,46)
            read (CHELUN(MACHNO),5020) KDPG(J,K),RFLATG(J,K),LAMAXG(J,K)
            read (CHELUN(MACHNO),5020) (KAHG(I,J,K),I=1,3)
            read (CHELUN(MACHNO),5020) (EAHG(I,J,K),I=1,3)
            read (CHELUN(MACHNO),5020) (KNHG(I,J,K),I=1,3)
            read (CHELUN(MACHNO),5020) (ENHG(I,J,K),I=1,3)
            read (CHELUN(MACHNO),5020) (KBHG(I,J,K),I=1,3)
            read (CHELUN(MACHNO),5020) (EBHG(I,J,K),I=1,3)
            read (CHELUN(MACHNO),5020) (KOXG(I,J,K),I=1,3)
            read (CHELUN(MACHNO),5020) (EOXG(I,J,K),I=1,3)
            read (CHELUN(MACHNO),5020) (K1O2G(I,J,K),I=1,3)
            read (CHELUN(MACHNO),5020) (EK1O2G(I,J,K),I=1,3)
            read (CHELUN(MACHNO),5020) (KREDG(I,J,K),I=1,3)
            read (CHELUN(MACHNO),5020) (EREDG(I,J,K),I=1,3)
            read (CHELUN(MACHNO),5020) (KBACWG(I,J,K),I=1,4)
            read (CHELUN(MACHNO),5020) (QTBAWG(I,J,K),I=1,4)
            read (CHELUN(MACHNO),5020) (KBACSG(I,J,K),I=1,4)
            read (CHELUN(MACHNO),5020) (QTBASG(I,J,K),I=1,4)
130      continue
         if (KSTART.ne.KSTOP) rewind CHELUN(MACHNO)
140   continue
      go to 160
150   continue
      write (TTYOUT(MACHNO),5050) CHEM1(K)
5050  format (' Error in chemical identifier--'/' No data found for comp
     &ound ',A3/' -- execution terminated.')
      IFLAG = 8
160   continue
      close (unit=CHELUN(MACHNO))
170   continue
      return
      end
