c
c @(#)light.f	1.2
c
      subroutine light(ip)

      include 'mladv.inc'
      include 'trc.inc'

      real ktot

      e0 = qsw(ip)

      do 1 k=1,l

         icurtrace = ipon
         phyto = trace(ip,k,mlcur,ipon) + trcqgofk(ip,k)

         ktot = kw + (kc * phyto)

         e1 = e0 * exp(-ktot * dzml(k))

         if (ktot .ne. 0.0) then
            epar(k) = ( 1.0 / (dzml(k) * ktot) ) * (e0 - e1)
           else
            epar(k) = e0
          endif

         e0 = e1

         eparnd = epar(k) / emax

  1    continue

      return
      end
