      subroutine cbsu3_iba_mpi(my_id) ! Bernd Berg Jun 20 2008. 
C MPI checkerboard study of deconfinement: Initialize ba and iba arrays.
C This serves to assign a unique beta-value to each plaquetter on the
C double layered torus. Each plaquette with a link from the second 
C torus gets beta1 assigned. The others beta0.
C Start subroutine has to be called AFTER this routine.
C Kept in common_2cbsu3.f:
C iab1, iab2:  0 and 1 tags for links.
C ba(0:4):     beta values corresponding to the sum of the tags of 
C              a plaquette.
      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/MPISU3/common_2cbsu3.f'
      include '../../Libs/MPI_par/common_mpi.f'
      ltest=.true.
      ltest=.false.
c
      ba(0)=beta0
      do i=1,4
        ba(i)=beta1
      enddo
c
      if(ltest) then ! ----------------------------------------
        if(my_id.eq.0) write(iuo,'(/,"cbsu3_iba_mpi: ltest.",/)')
        write(iud2,'(/,"cbsu3_iba_mpi: ltest.",/)')
        close(iud2)
        call mpi_finalize(ierr)
      stop "cbsu3_iba_mpi: ltest."
      endif ! --------------------------------------------------
c
      if(my_id.lt.msmpi) then ! Put them all zero.
        do is=1,nmat        ! Only the first element used.
          do id=1,nd
            do i=1,n18
              a1su3(i,is,id)=zero
              a2su3(i,is,id)=zero
            end do
          end do
        end do
      else                    ! Put them all one.
        do is=1,nmat        ! Only the first element used. 
          do id=1,nd
            do i=1,n18
              a1su3(i,is,id)=one
              a2su3(i,is,id)=one
            end do
          end do
        end do
      endif
c
      call cbsu3_bnd_mpi(my_id) ! Collect all boundaries.
      do is=1,nmat            ! Define iba arrays.
        do id=1,nd ! First element of SU3 arrays used:
          iba1(is,id)=nint(a1su3(1,is,id))
          iba2(is,id)=nint(a2su3(1,is,id))
        end do
      end do ! SU3 arrays will be overwritten by start configuration.
c
      if(my_id.eq.0) write(iuo,'(3X,"cbsu3_iba_mpi ba and iba done.")')
      return
      end
