      subroutine smooth(nl,mver)
*
* this subroutine is a quick and dirty way to fix the jump in
* in derivative quants. at the core-envelope boundary.
* If the jump is greater than a pre-set limit (see eprep),
* we come here and replace the jump by a linear interpolation
* of delad between the last core point and some predetermined
* point out in the envelope.
* This is not a terribly physical subroutine, but adjusting the
* stop mass (where it's possible) show this assumption isn't
* too awful.
*
      implicit double precision(a-h,o-z)

      common/dprep/aa(20,500), ecv(400), ext(400), exr(400)
*
* set upper limit to smoothing function at 10 points (for now)
*
      nup = nl + 20
*
* determine quant. to be smoothed and mass 
* at top and bottom of smoothing interval
*
      if(mver.eq.1)then
        delbot = aa(16,nl)
        deltop = aa(16,nup)
      endif
      if(mver.eq.2)then
        delbot = aa(15,nl)
        deltop = aa(15,nup)
      endif
      if(mver.eq.3)then
        delbot = aa(10,nl)
        deltop = aa(10,nup)
      endif
      if(mver.eq.4)then
        delbot = aa(9,nl)
        deltop = aa(9,nup)
      endif
      botmass = aa(2,nl)
      topmass = aa(2,nup)
*
* determine size of mass and delad difference
*
      rmass = topmass - botmass
      deladr = dabs(delbot - deltop)
      do 10 n=nl+1,nup
*
* special case, deltop = delbot
*
        if(deltop.eq.delbot)then
          if(mver.eq.1)then
            aa(16,n) = delbot
          endif
          if(mver.eq.2)then
            aa(15,n) = delbot
          endif
          if(mver.eq.3)then
            aa(10,n) = delbot
          endif
          if(mver.eq.4)then
            aa(9,n) = delbot
          endif
        endif
*
* determine step size in mass
*
        frac = (aa(2,n) - botmass) / rmass
*
* determine stepsize in delad
*
        delfrac = deladr * frac
*
* compute new value of delad
* delad(top) < delad(bot)
*
        if(deltop.lt.delbot)then
          if(mver.eq.1)then
            aa(16,n) = delbot - delfrac
          endif
          if(mver.eq.2)then
            aa(15,n) = delbot - delfrac
          endif
          if(mver.eq.3)then
            aa(10,n) = delbot - delfrac
          endif
          if(mver.eq.4)then
            aa(9,n) = delbot - delfrac
          endif
        endif
*
* delad(top) > delad(bot)
*
        if(deltop.gt.delbot)then
          if(mver.eq.1)then
            aa(16,n) = delbot + delfrac
          endif
          if(mver.eq.2)then
            aa(15,n) = delbot + delfrac
          endif
          if(mver.eq.3)then
            aa(10,n) = delbot + delfrac
          endif
          if(mver.eq.4)then
            aa(9,n) = delbot + delfrac
          endif
        endif
10    continue

      return
      end

************************************************************************


