      subroutine lat_init(ns,nd,ipf,ipb,nla,ix) ! bb may 27 2005.
      dimension ipf(nd,ns),ipb(nd,ns),nla(nd),ix(nd)
c initialize number of lattice sites and links. initialize pointer arrays.
      if(ns.ne.nsfun(nla,nd)) then 
        print*,"lat_init stop ns-nla mismatch: nd,ns,nla:",nd,ns,nla
        stop "lat_init: ns-nla mismatch!"
      end if
c initialize pointers:
      do is=1,ns
        call ipointer(ipf,ipb,nla,ix,ns,is,nd)
      end do
      return
      end 
      
