      subroutine DISTRB
      include 'SIZE.INC'
      include 'GLOBAL.INC'
      include 'LOCAL.INC'
      include 'LOCAL1.INC'
      include 'LOCAL2.INC'
      integer I, J, K, K1, K2, K3
      real DISFUN(28), DOCL, KOCL(NCHEM), SUMFUN, TKEL, TOTMAS
      real HPLUS, HPLSQ, HPLCUB, HYDRX, HYDSQ, HYDCUB
      do 110 K = 1, KCHEM
         KOCL(K) = KOCG(K)
         if (KOCG(K).eq.0..and.KOWG(K).gt.0.) KOCL(K) = 0.41*KOWG(K)
         if (KOWG(K).eq.0.0 .and. KOCL(K).gt.0.) KOWG(K) = KOCL(K)/0.41
         do 100 I = 1, 7
            if (SPFLGG(I,K).eq.0 .or. KOWG(K).le.0.0) go to 100
            if (KPBG(I,K) .le. 0.0)   KPBG(I,K) = 0.436*(KOWG(K)**0.907)
            if (KPDOCG(I,K) .le. 0.0) KPDOCG(I,K) = 0.020*KOWG(K)
100      continue
110   continue
      do 120 K = 1, KCHEM
         do 120 J = 1, KOUNT
            do 120 I = 1, 7
               KPSL(I,J,K) = KPSG(I,K)
120   continue
      do 140 J = 1, KOUNT
         WATVOL(J) = 0.0
         SEDMSL(J) = 0.0
         SEDCOL(J) = 0.0
         BIOTOL(J) = 0.0
         if (TYPEG(J).eq.'B') go to 130
         BIOTOL(J) = PLMASG(J,NDAT)*1.0E-06
         BNMASG(J,NDAT) = 0.0
         WATVOL(J) = VOLG(J)*1000.
         SEDCOL(J) = SUSEDG(J,NDAT)*1.E-6
         SEDMSL(J) = SEDCOL(J)*WATVOL(J)
         go to 140
130      continue
         PLMASG(J,NDAT) = 0.0
         TOTMAS = BULKDG(J,NDAT)*VOLG(J)*1.0E+03
         SEDMSL(J) = TOTMAS/(PCTWAG(J,NDAT)/100.)
         WATVOL(J) = TOTMAS-SEDMSL(J)
         SEDCOL(J) = SEDMSL(J)/WATVOL(J)
         BIOTOL(J) = (BNMASG(J,NDAT)*AREAG(J)*0.001)/WATVOL(J)
140   continue
      do 280 J = 1, KOUNT
         do 150 K3 = 1, KCHEM
            if (KOCL(K3).gt.0.) KPSL(1,J,K3) = KOCL(K3)*FROCG(J,NDAT)
            if (KIECG(1,K3).gt.0.) KPSL(2,J,K3)=KIECG(1,K3)*CECG(J,NDAT)
            if (KIECG(2,K3).gt.0.) KPSL(3,J,K3)=KIECG(2,K3)*CECG(J,NDAT)
            if (KIECG(3,K3).gt.0.) KPSL(4,J,K3)=KIECG(3,K3)*CECG(J,NDAT)
            if (KIECG(4,K3).gt.0.) KPSL(5,J,K3)=KIECG(4,K3)*AECG(J,NDAT)
            if (KIECG(5,K3).gt.0.) KPSL(6,J,K3)=KIECG(5,K3)*AECG(J,NDAT)
            if (KIECG(6,K3).gt.0.) KPSL(7,J,K3)=KIECG(6,K3)*AECG(J,NDAT)
150      continue
         TKEL = TCELG(J,NDAT)+273.15
         DOCL = 1.0E-06*DOCG(J,NDAT)
         do 220 K3 = 1, KCHEM
            KB1L(J,K3) = 0.0
            KB2L(J,K3) = 0.0
            KB3L(J,K3) = 0.0
            KA1L(J,K3) = 0.0
            KA2L(J,K3) = 0.0
            KA2L(J,K3) = 0.0
            if (SPFLGG(2,K3).eq.0) go to 160
            KB1L(J,K3) = 10.**(-PKG(1,K3))
            if (EPKG(1,K3).ne.0.) KB1L(J,K3) = 10.**(PKG(1,K3)-((1000.*
     &         EPKG(1,K3))/(4.58*TKEL)))
160         continue
            if (SPFLGG(3,K3).eq.0) go to 170
            KB2L(J,K3) = 10.**(-PKG(2,K3))
            if (EPKG(2,K3).ne.0.) KB2L(J,K3) = 10.**(PKG(2,K3)-((1000.*
     &         EPKG(2,K3))/(4.58*TKEL)))
170         continue
            if (SPFLGG(4,K3).eq.0) go to 180
            KB3L(J,K3) = 10.**(-PKG(3,K3))
            if (EPKG(3,K3).ne.0.) KB3L(J,K3) = 10.**(PKG(3,K3)-((1000.*
     &         EPKG(3,K3))/(4.58*TKEL)))
180         continue
            if (SPFLGG(5,K3).eq.0) go to 190
            KA1L(J,K3) = 10.**(-PKG(4,K3))
            if (EPKG(4,K3).ne.0.) KA1L(J,K3) = 10.**(PKG(4,K3)-((1000.*
     &         EPKG(4,K3))/(4.58*TKEL)))
190         continue
            if (SPFLGG(6,K3).eq.0) go to 200
            KA2L(J,K3) = 10.**(-PKG(5,K3))
            if (EPKG(5,K3).ne.0.) KA2L(J,K3) = 10.**(PKG(5,K3)-((1000.*
     &         EPKG(5,K3))/(4.58*TKEL)))
200         continue
            if (SPFLGG(7,K3).eq.0) go to 210
            KA3L(J,K3) = 10.**(-PKG(6,K3))
            if (EPKG(6,K3).ne.0.) KA3L(J,K3) = 10.**(PKG(6,K3)-((1000.*
     &         EPKG(6,K3))/(4.58*TKEL)))
210         continue
220      continue
         HPLUS = 10.**(-PHG(J,NDAT))
         HYDRX = 10.**(-POHG(J,NDAT))
         HPLSQ = HPLUS*HPLUS
         HPLCUB = HPLSQ*HPLUS
         HYDSQ = HYDRX*HYDRX
         HYDCUB = HYDSQ*HYDRX
         do 270 K3 = 1, KCHEM
            DISFUN(1) = 1.0
            DISFUN(2) = KPSL(1,J,K3)*SEDCOL(J)
            DISFUN(3) = KPDOCG(1,K3)*DOCL
            DISFUN(4) = KPBG(1,K3)*BIOTOL(J)
            DISFUN(5) = KB1L(J,K3)/HYDRX
            DISFUN(6) = DISFUN(5)*KPSL(2,J,K3)*SEDCOL(J)
            DISFUN(7) = DISFUN(5)*KPDOCG(2,K3)*DOCL
            DISFUN(8) = DISFUN(5)*KPBG(2,K3)*BIOTOL(J)
            DISFUN(9) = KB2L(J,K3)*KB1L(J,K3)/HYDSQ
            DISFUN(10) = DISFUN(9)*KPSL(3,J,K3)*SEDCOL(J)
            DISFUN(11) = DISFUN(9)*KPDOCG(3,K3)*DOCL
            DISFUN(12) = DISFUN(9)*KPBG(3,K3)*BIOTOL(J)
            DISFUN(13) = KB1L(J,K3)*KB2L(J,K3)*KB3L(J,K3)/HYDCUB
            DISFUN(14) = DISFUN(13)*KPSL(4,J,K3)*SEDCOL(J)
            DISFUN(15) = DISFUN(13)*KPDOCG(4,K3)*DOCL
            DISFUN(16) = DISFUN(13)*KPBG(4,K3)*BIOTOL(J)
            DISFUN(17) = KA1L(J,K3)/HPLUS
            DISFUN(18) = DISFUN(17)*KPSL(5,J,K3)*SEDCOL(J)
            DISFUN(19) = DISFUN(17)*KPDOCG(5,K3)*DOCL
            DISFUN(20) = DISFUN(17)*KPBG(5,K3)*BIOTOL(J)
            DISFUN(21) = KA1L(J,K3)*KA2L(J,K3)/HPLSQ
            DISFUN(22) = DISFUN(21)*KPSL(6,J,K3)*SEDCOL(J)
            DISFUN(23) = DISFUN(21)*KPDOCG(6,K3)*DOCL
            DISFUN(24) = DISFUN(21)*KPBG(6,K3)*BIOTOL(J)
            DISFUN(25) = KA1L(J,K3)*KA2L(J,K3)*KA3L(J,K3)/HPLCUB
            DISFUN(26) = DISFUN(25)*KPSL(7,J,K3)*SEDCOL(J)
            DISFUN(27) = DISFUN(25)*KPDOCG(7,K3)*DOCL
            DISFUN(28) = DISFUN(25)*KPBG(7,K3)*BIOTOL(J)
            SUMFUN = 0.0
            do 230 I = 1, 28
               SUMFUN = SUMFUN+DISFUN(I)
230         continue
            do 240 I = 1, 28
               ALPHA(I,J,K3) = DISFUN(I)/SUMFUN
240         continue
            do 260 I = 29, 32
               ALPHA(I,J,K3) = 0.0
               K1 = I-28
               K2 = I-4
               do 250 K = K1, K2, 4
                  ALPHA(I,J,K3) = ALPHA(I,J,K3)+ALPHA(K,J,K3)
250            continue
260         continue
270      continue
         if (BIOTOL(J).eq.0.0) BIOTOL(J) = 1.0
280   continue
      return
      end
