      subroutine ipointer(ipf,ipb,nla,ix,ns,is,nd) ! bernd berg. 
c input:   is = number of lattice site
c output:  ipf,ipb: forward and backward pointer (lattice
c                   site numbers in those directions).
      dimension ipf(nd,ns),ipb(nd,ns),nla(nd),ix(nd)
c
      do id=1,nd
        call ixcor(ix,nla,is,nd)
c forward (backward) step with periodic bounday conditions:
        ix(id)=mod(ix(id)+1,nla(id)) 
        ipf(id,is)=isfun(ix,nla,nd)
      end do
c
      do id=1,nd
        call ixcor(ix,nla,is,nd)
c backward pointer (notice periodic boundary conditions):
        ix(id)=mod(ix(id)-1+nla(id),nla(id))
        ipb(id,is)=isfun(ix,nla,nd)
      end do
c
      return
      end
