c
c @(#)adjust.f	1.1
c 
      subroutine adjust(ip,kold,hfil,idir,f)

      include 'mladv.inc'

      dimension f(mnmax,lmax), hfil(mnmax)

      if (idir .eq. 1) then

         dz1 = 0.5 * dzml(kold) + (hfil(ip) + zml(kold))
         dz2 = dzml(kold - 1)
         dz3 = dz1 + dz2
         f(ip,kold-1) = (f(ip,kold) * dz1 + f(ip,kold-1) * dz2 ) / dz3
         f(ip,kold) = f(ip,kold+1) 

       else

         dz1 = 0.5 * dzml(kold+1) - (hfil(ip) + zml(kold+1))
         dz2 = dzml(kold+2)
         dz3 = dz1 + dz2
         f(ip,kold+2) = (f(ip,kold+1) * dz1 + f(ip,kold+2) * dz2 ) / dz3
         f(ip,kold+1) = f(ip,kold)

       endif

      return
      end
