c
c @(#)advfix.f	1.2
c
      subroutine advfix(k,iopt)

      include'mladv.inc'

      common /scrat/ r(mn0), r1(mn0), r2(mn0), r3(mn0)

      common/parm/kz,m,mm1,mm2,mp1,msq,tim,tmax,tstart,hy,rea,dt,
     +   xbasin,yy(mx0),icalc,kzp1,kzm1,iftop,ifbot,iftvv,ifrel,theta,
     +   ifsbl,ifeva

      do 1 ip=1,msq
         if (iopt.eq.1) then

            if (k.le.ihdpth(ip)) then
               r1(ip) = advml(ip,k)
              else
               r1(ip) = advrl(ip,k)
             endif

          else

            if (k.gt.ihdpth(ip)) then
               r1(ip) = advrl(ip,k)
             endif

          endif

  1    continue

      return
      end
