        subroutine DRIVM2(Y,RUNOPT)
      include 'SIZE.INC'
      include 'GLOBAL.INC'
      include 'LOCAL.INC'
      include 'UNITS.INC'
      include 'LOCAL1.INC'
      include 'WORK.INC'
        double precision Y(KOUNT,KCHEM), TITEST
        real TFIX(4)
        integer RUNOPT, I, K, III, IV, VRAIL
        character PIECE(4)*7
        data PIECE /'Hours. ',' Days. ','Months.','Years. '/
        data TFIX/1.0, 24.0, 730.5, 8766.0/
5000  format ('1','Exposure Analysis Modeling System -- EXAMS Version ',
     &   F4.2,', Mode',I2/' Ecosystem: ',50A1)
5010  format (' Chemical:  ',50A1)
5020  format (1X,63('-'))
5030  format (/' Integrator diagnostics now switched on (IUNIT=1).')
5040  format (' Table 19.  Summary time-trace of chemical concentrations
     & during'/' the period from ',I5,' through ',I5,' ',A7/1X,63('-'))
5050  format (1X,'Time',5X,'Average Chemical Concentrations',4X,'Total C
     &hemical Mass'/1X,5('-'),4X,31('-'),4X,19('-'))
5060  format (1X,A5,2X,' Water Column',6X,'Benthic Sediments',2X,'Water 
     &Col  Benthic')
5070  format (5X,20('-'),1X,19('-'),1X,9('-'),1X,8('-')/5X,'Free-mg/L So
     &rb-mg/kg Pore-mg/L Sed-mg/kg  Total ','kg Total kg')
5080  format (/1X,'The kinetic equations are causing difficulties;'/1X,'
     &the decay simulation has been abbreviated.')
5090  format (/1X,'Integrator failed--proceed with caution')
      go to (100,130,160) IBACK
100   continue
      if (RUNOPT.eq.0) STIFEQ = .false.
      ABEXIT = .false.
      if (ABEXIT) go to 120
      III = VRAIL(ECONAM)
      write (RPTLUN(MACHNO),5000) VERSN,MODEG,(ECONAM(IV),IV=1,III)
      do 110 K = 1, KCHEM
         III = VRAIL(CHEMNA(1,K))
         write (RPTLUN(MACHNO),5010) (CHEMNA(IV,K),IV=1,III)
110   continue
      write (RPTLUN(MACHNO),5020)
      I = TINITG
      K = TENDG
      write (RPTLUN(MACHNO),5040) I,K,PIECE(KDTIME)
      write (RPTLUN(MACHNO),5050)
      write (RPTLUN(MACHNO),5060) PIECE(KDTIME)
      write (RPTLUN(MACHNO),5070)
      write (RPTLUN(MACHNO),5020)
120   continue
      TINIT = T
      NPRINT = -1
      if (STIFEQ) go to 150
      IBACK = 2
      ISOO = 1
      go to 190
130   continue
      if (T.gt.TENDL) TENDL = T
      TENDG = TENDL
      if (IFLAG.eq.2) go to 180
      if (IFLAG.ge.8) go to 170
      if (IFLAG.eq.6) go to 150
      TITEST = TINCRL*dble(float(NPRINT))
      if (TITEST.gt.0.) go to 140
      go to 170
140   continue
      write (TTYOUT(MACHNO),5080)
      if (TITEST.lt.TENDL) TENDL = TITEST
      TENDG = TENDL
      IFLAG = 2
      go to 180
150   continue
      STIFEQ = .true.
      TINIT = T
      IBACK = 3
      ISOO = 2
      go to 190
160   continue
      if (T.gt.TENDL) TENDL = T
      TENDG = TENDL
      if (IFLAG.eq.2) go to 180
      if (IFLAG.ge.8) go to 170
      TITEST = TINCRL*dble(float(NPRINT))
      if (TITEST.gt.0.) go to 140
170   continue
      IFLAG = 9
      IFLAG = 2
      TITEST = TINCRL*dble(float(NPRINT))
      if (TITEST.lt.TENDG) TENDG = TITEST
      write (TTYOUT(MACHNO),5090)
      write (TTYOUT(MACHNO),5030)
      IUNITG = 1
180   continue
      TENDG = TENDG/TFIX(TCODEG)
      ISOO = 0
190   continue
      return
      end
