      subroutine freehb0_ssweep ! Bernd Berg Mar 27 2009. 
C One Gaussian heatbath sweep for free scalar field.
      include '../../Libs/Fortran/implicit.sta'
      include '../../Libs/Fortran/constants.par'
      include '../../Libs/Fortran_par/lat0.par'
      include '../../Libs/Fortran_par/mc.par'   
      parameter(cutoff=ten**3)
      include '../../Libs/Fortran_par/common_lat.f'
      include '../../Libs/Scalar_par/common_scalar0.f'
      if(xla.ne.zero) stop "freehb_ssweep: Works only for xla=zero"
      samin=sact
      samax=sact
      a2=sqrt(two*xmfactor)
      do is=1,ms ! Loop over sites.
        samin=min(samin,sact)
        samax=min(samax,sact)
        phinn=zero
        do id=1,nd
          phinn=phinn+phi(ipf(id,is))
          phinn=phinn+phi(ipb(id,is))
        enddo
        sacto=factphi1(phinn,xmfactor,xla,phi(is)) ! Old site action.
        phisum=phisum-phi(is)
        phi(is)=freehb_supdt(phinn,a2)
        phisum=phisum+phi(is)
        sactn=factphi1(phinn,xmfactor,xla,phi(is)) ! New site action.
        sact=sact-sacto+sactn
        if((sact/ms).gt.cutoff) goto 1
      enddo
      sacpt=sacpt+one ! Increment acceptance rate for the sweep.
      sa_min=min(samin,sa_min)
      sa_max=min(samax,sa_max)
      return
1     write(iuo,'(/,"freehb_ssweep routine: Action too large.")')
      write(iuo,'(2X,"sact/ms,phisum/ms =",2G15.6)') sact/ms,phisum/ms
      stop "freehb_ssweep routine: Action too large."
      end
