      subroutine tun_cnt(namin,namax,iamin,iamax,ntun,ltun0)
c bernd berg, may 28, 2001. tunneling count. 
c none are missed, when` this routine is called after every sweep 
c and (namax-namin) is sufficiently large.
      logical ltun0
      if(ltun0) then
        if(iamin.le.namin) then
          ntun=ntun+1
          ltun0=.false.
        end if
      else
        if(iamax.ge.namax) ltun0=.true.
      end if
      return
      end
