      subroutine ipointer0(ipf,ipb,nla,ix,ns,is,nd) ! Bernd Berg. 
c     include '../../Libs/Fortran_par/lat0.par'
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 open bounday conditions:
        ix(id)=mod(ix(id)+1,nla(id))
        if (ix(id).eq.0) then
          ipf(id,is)=ns+1
        else
          ipf(id,is)=isfun(ix,nla,nd)
        endif
      end do
C
      do id=1,nd
        call ixcor(ix,nla,is,nd)
C Backward pointer (notice open boundary conditions):
        ix(id)=mod(ix(id)-1+nla(id),nla(id))
        if (ix(id).eq.(nla(id)-1)) then
          ipb(id,is)=ns+1
        else
          ipb(id,is)=isfun(ix,nla,nd)
        endif
      end do
C
      return
      end
