      subroutine cbsu3_bnd1b_mpi(idg,my_id) ! Bernd Berg Mar 25 2008. 
C Collect corners from checkerboard 1 for SU3 action.
      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'
      include '../../Libs/MPI_par/common_cblat.f'
      include '../../Libs/MPISU3/common_cbsu3.f'
      include '../../Libs/MPI_par/common_mpi.f'
      parameter(ns1fbb18=n18*ns1fbb)
      ltest=.true.  
      ltest=.false.
C
C Gather corners from checkerboard 1:
      ismpi=my_id+1
      iddmpi=0 ! Corner sites as needed:
      itag=idg
      do id1mpi=1,ndmpi
        do id2mpi=1,ndmpi
          if(id1mpi.ne.id2mpi) then
            iddmpi=iddmpi+1
            do icnt=1,ns1fbb
              do isu3=1,n18
               a1su3fbb(isu3,icnt)=a1su3(isu3,igathbb1(icnt,iddmpi),idg)
              enddo 
            enddo 
            ircv=ipb_mpi(id1mpi,ismpi)-1 ! To receive process ircv
            isnd=ipf_mpi(id1mpi,ismpi)-1 ! from send process isnd.
C Send link variables:
            call mpi_send(a1su3fbb,ns1fbb18,mpi_double_precision,
     &                    ircv,itag,mpi_comm_world,ierr)
C Receive link variables:              
            i1=1+msc+mbcs+(iddmpi-1)*ns1fbb
            call mpi_recv(a1su3(1,i1,idg),ns1fbb18,mpi_double_precision,
     &                     isnd,itag,mpi_comm_world,istatus,ierr)
          endif
        enddo
      enddo
C
      if(iddmpi.ne.nddmpi) then
        write(iud2,'(/,"cbsu3_bnd1_mpi: iddmpi.ne.nddmpi error.",/)')
        if(my_id.eq.0) write(iuo,'(/,"cbsu3_bnd1_mpi: iddmpi error.")')
      ltest=.true.        
      endif
C 
      if(ltest.and.my_id.eq.0) print*,
     &  "cbsu3_bnd1b_mpi: idg,ns1fbb,ns1fbb18 =",idg,ns1fbb,ns1fbb18
      if(ltest) write(iud2,'(" act  =",1F10.5)') act
      if(ltest) then ! ----------------------------------------
        if(my_id.eq.0) write(iuo,'(/,"cbsu3_bnd1b_mpi: ltest.",/)')
        write(iud2,'(/,"cbsu3_bnd1b_mpi: ltest.",/)')
        close(iud2)
        call mpi_finalize(ierr)
      stop
      endif ! --------------------------------------------------
C
      return
      end
