        subroutine UNPBAR(IBUFF)
      include 'SIZE.INC'
      include 'GLOBAL.INC'
      include 'LOCAL.INC'
      include 'UNITS.INC'
      include 'INPAR.INC'
      include 'LOCAL1.INC'
      include 'LOCAL2.INC'
        real BUFF1 ( NPX * (4+47*NCHEM) )
        double precision BUFF2 ( NPX * NCHEM * (2+NPX+NCHEM))
        equivalence (BUFF1(1), BUFF2(1))
        integer IBUFF(VARIEC)
        integer I, J, K, NSP, NSTART, NEND
        integer OFFSET, NVAR, NRECS, FIRREC, LASTRC, ITRAIL, IALPHA(7)
        data IALPHA/1,5,9,13,17,21,25/
      if (NDAT.eq.1) read (WRKLUN(MACHNO),rec=1) (IBUFF(I),I=1,4)
      OFFSET = 1+(NDAT-1)*(IBUFF(1)+IBUFF(3))
      NRECS = IBUFF(1)
      ITRAIL = IBUFF(2)
      FIRREC = OFFSET+1
      LASTRC = FIRREC+NRECS-1
      NSTART = 1
      if (NRECS.eq.1) go to 110
      NEND = VARREC
      do 100 K = FIRREC, LASTRC-1
         read (WRKLUN(MACHNO),rec=K) (BUFF1(I),I=NSTART,NEND)
         NSTART = NEND+1
         NEND = NEND+VARREC
100   continue
110   continue
      NEND = (NRECS-1)*VARREC+ITRAIL
      read (WRKLUN(MACHNO),rec=LASTRC) (BUFF1(I),I=NSTART,NEND)
      NVAR = 1
      do 160 K = 1, KCHEM
         do 150 J = 1, KOUNT
            do 130 NSP = 1, 7
               if (SPFLGG(NSP,K).eq.0) go to 130
               do 120 I = IALPHA(NSP), IALPHA(NSP)+3
                  ALPHA(I,J,K) = ALPHA(I,J,K)+BUFF1(NVAR)
                  NVAR = NVAR+1
120            continue
130         continue
            do 140 I = 29, 32
               ALPHA(I,J,K) = ALPHA(I,J,K)+BUFF1(NVAR)
               NVAR = NVAR+1
140         continue
150      continue
160   continue
      do 180 K = 1, KCHEM
         do 170 J = 1, KOUNT
            BIOLKL(J,K) = BIOLKL(J,K)+BUFF1(NVAR)
            NVAR = NVAR+1
170      continue
180   continue
      do 190 J = 1, KOUNT
         BIOTOL(J) = BIOTOL(J)+BUFF1(NVAR)
         NVAR = NVAR+1
190   continue
      do 210 K = 1, KCHEM
         do 200 J = 1, KOUNT
            EXPOKL(J,K) = EXPOKL(J,K)+BUFF1(NVAR)
            NVAR = NVAR+1
200      continue
210   continue
      do 230 K = 1, KCHEM
         do 220 J = 1, KOUNT
            HYDRKL(J,K) = HYDRKL(J,K)+BUFF1(NVAR)
            NVAR = NVAR+1
220      continue
230   continue
      do 250 K = 1, KCHEM
         do 240 J = 1, KOUNT
            OXIDKL(J,K) = OXIDKL(J,K)+BUFF1(NVAR)
            NVAR = NVAR+1
240      continue
250   continue
      do 270 K = 1, KCHEM
         do 260 J = 1, KOUNT
            PHOTKL(J,K) = PHOTKL(J,K)+BUFF1(NVAR)
            NVAR = NVAR+1
260      continue
270   continue
      do 290 K = 1, KCHEM
         do 280 J = 1, KOUNT
            REDKL(J,K) = REDKL(J,K)+BUFF1(NVAR)
            NVAR = NVAR+1
280      continue
290   continue
      do 310 K = 1, KCHEM
         do 300 J = 1, KOUNT
            S1O2KL(J,K) = S1O2KL(J,K)+BUFF1(NVAR)
            NVAR = NVAR+1
300      continue
310   continue
      do 320 J = 1, KOUNT
         SEDCOL(J) = SEDCOL(J)+BUFF1(NVAR)
         NVAR = NVAR+1
320   continue
      do 330 J = 1, KOUNT
         SEDMSL(J) = SEDMSL(J)+BUFF1(NVAR)
         NVAR = NVAR+1
330   continue
      do 350 K = 1, KCHEM
         do 340 J = 1, KOUNT
            VOLKL(J,K) = VOLKL(J,K)+BUFF1(NVAR)
            NVAR = NVAR+1
340      continue
350   continue
      do 360 J = 1, KOUNT
         WATVOL(J) = WATVOL(J)+BUFF1(NVAR)
         NVAR = NVAR+1
360   continue
      do 390 K = 1, KCHEM
         do 380 J = 1, KOUNT
            do 370 NSP = 1, 7
               if (SPFLGG(NSP,K).eq.0) go to 370
               YSATL(NSP,J,K) = YSATL(NSP,J,K)+BUFF1(NVAR)
               NVAR = NVAR+1
370         continue
380      continue
390   continue
      OFFSET = LASTRC
      NVAR = 1
      NRECS = IBUFF(3)
      ITRAIL = IBUFF(4)
      FIRREC = OFFSET+1
      LASTRC = FIRREC+NRECS-1
      NSTART = 1
      if (NRECS.eq.1) go to 410
      NEND = VARDEC
      do 400 K = FIRREC, LASTRC-1
         read (WRKLUN(MACHNO),rec=K) (BUFF2(I),I=NSTART,NEND)
         NSTART = NEND+1
         NEND = NEND+VARDEC
400   continue
410   continue
      NEND = (NRECS-1)*VARDEC+ITRAIL
      read (WRKLUN(MACHNO),rec=LASTRC) (BUFF2(I),I=NSTART,NEND)
      do 430 K = 1, KCHEM
         do 420 J = 1, KOUNT
            NVAR = NVAR+1
420      continue
430   continue
      do 460 K = 1, KCHEM
         do 450 J = 1, KOUNT
            do 440 I = 1, KOUNT
               INTINL(I,J,K) = INTINL(I,J,K)+BUFF2(NVAR)
               NVAR = NVAR+1
440         continue
450      continue
460   continue
      do 480 K = 1, KCHEM
         do 470 J = 1, KOUNT
            TOTKL(J,K) = TOTKL(J,K)+BUFF2(NVAR)
            NVAR = NVAR+1
470      continue
480   continue
      do 510 J = 1, KOUNT
         do 500 K = 1, KCHEM
            do 490 I = 1, KCHEM
               YIELDL(I,K,J) = YIELDL(I,K,J)+BUFF2(NVAR)
               NVAR = NVAR+1
490         continue
500      continue
510   continue
      return
      end
