      subroutine su3_ploop(imeas) ! Bazavov / Berg Mar 6 2008.
C Polyakov loops for SU(3). Populates array of Ploops and calculates 
C their lattice averages:   Re<L> -> tspr, Im<L> -> tspi.
      include '../../Libs/Fortran/implicit.sta'
      include '../../Libs/Fortran/constants.par'
      include '../../Libs/Fortran_par/lat.par'
      include '../../Libs/Fortran_par/mc.par'
      include '../../Libs/Fortran_par/common_lat.f'
      include '../../Libs/SU3_par/common_su3.f'
      dimension am(1:18,1:2)
      ltest=.true.
      ltest=.false.
      avplreal=zero
      avplimag=zero
      do is=1,mxs
        do i=1,18
          am(i,1)=alsu3(i,nd,is)
        enddo
        isf=is
        i=1
        j=2
        do il=2,nla(nd) ! Time in nd direction.
          isf=ipf(nd,isf)
          call su3mult_m_m_m(am(1,i),alsu3(1,nd,isf),am(1,j))
          i=j 
          j=i
        end do
        plreal(is)=(am(1,j)+am(5,j)+am(9,j))/three
        plimag(is)=(am(10,j)+am(14,j)+am(18,j))/three
        if(ltest) print*,is,plreal(is),plimag(is)
      if(ltest) stop "su3_ploop: ltest."
        avplreal=avplreal+plreal(is)
        avplimag=avplimag+plimag(is)
      end do
      tspr(imeas)=avplreal/mxs ! Real part.
      tspi(imeas)=avplimag/mxs ! Imaginary part.
      return
      end
