      subroutine cblgtpointer(iwf1,iwf2,iwb1,iwb2,my_id) 
C Bernd Berg Oct 10 2007. MPI checkerboard: LGT border pointers.
C Calling order: cblat_init (-> cpointer), cblgtpointer, cblgtpnt2.
      include '../../Libs/Fortran/implicit.sta'
      include 'mpif.h'
      include '../../Libs/Fortran/constants.par'
      include '../../Libs/Fortran_par/latmpi.par'
      include '../../Libs/Fortran_par/mc.par'
      parameter(nmax=msc+mbcsh)
      include '../../Libs/MPI_par/common_cblat.f'
      dimension iwf1(ndmpi,msc),iwf2(ndmpi,msc),
     &          iwb1(ndmpi,msc),iwb2(ndmpi,msc)
      ltest=.true.
      ltest=.false.
      if(ltest) then
        write(iud2,'(" cblgtpointer: skipped -> return.")')
      return
      endif
      if(.not.lbcex) stop "cblgtpointer: lbcex should be .true."
      if(ltest) write(iud2,'(/,"cblgtpointer: lbcex =",L2,/)') lbcex
      if(ltest) then ! -------------------------------------------
        if(my_id.eq.0) write(iuo,'(" cblgtpointer: stop ltest.")')
        write(iud2,'(" cblgtpointer: stop ltest.")')
        close(iud2)
        call mpi_finalize(ierr)
      stop "cblgtpointer: ltest."
      endif ! ----------------------------------------------------
C
      do idmpi=1,ndmpi
        do iscbnd=1,mscb 
          isc=ipfb1(iscbnd,idmpi) ! As used in boundary gathering.
          iscf=iwf1(idmpi,isc)
          isbc=ipb2(idmpi,iscf) ! Was set in cbpointer subroutine.
          if(isbc.le.nmax) then ! I do not understand this constraint.
          do id=1,nd            ! But it works!
            istest=ipf2(id,iscf)
            if(istest.le.msc) ipf1(id,isbc)=ipb1(idmpi,ipf2(id,iscf))
          enddo
          endif
          isc=ipfb2(iscbnd,idmpi) ! As used in boundary gathering.
          iscf=iwf2(idmpi,isc)
          isbc=ipb1(idmpi,iscf)
          if(isbc.le.nmax) then
          do id=1,nd
            istest=ipf1(id,iscf)
            if(istest.le.msc) ipf2(id,isbc)=ipb2(idmpi,ipf1(id,iscf))
          enddo
          endif
          isc=ipbb1(iscbnd,idmpi) ! As used in boundary gathering.
          iscb=iwb1(idmpi,isc)
          isbc=ipf2(idmpi,iscb)
          if(isbc.le.nmax) then
          do id=1,nd
            istest=ipb2(id,iscb)
            if(istest.le.msc) ipb1(id,isbc)=ipf1(idmpi,ipb2(id,iscb))
          enddo
          endif
          isc=ipbb2(iscbnd,idmpi) ! As used in boundary gathering.
          iscb=iwb2(idmpi,isc)
          isbc=ipf1(idmpi,iscb)
          if(isbc.le.nmax) then
          do id=1,nd
            istest=ipb1(id,iscb)
            if(istest.le.msc) ipb2(id,isbc)=ipf2(idmpi,ipb1(id,iscb))
          enddo
          endif
        enddo
      enddo
C
      return
      end
