      subroutine scalar_start(phi,xmfactor,ns,istart,phisum) 
C Bernd Berg Mar 27 2009. Start configuration for free scalar field.
c istart<=1 -- ordered configuration all phi=xstart.
c istart>=2 -- Gaussian probability density in a mean field
c              xstart: e^{xstart-xmfactor*phi**2).
      include '../../Libs/Fortran/implicit.sta'
      include '../../Libs/Fortran/constants.par'
      dimension phi(ns)
      xstart=phisum/ns
      if(istart.le.1) then ! Ordered start configuration.
        do is=1,ns
          phi(is)=xstart
        end do
      else                 ! Gaussian start configuration.
        phisum=zero
        a2=sqrt(two*xmfactor)
        do is=1,ns
          phi(is)=freehb_supdt(xstart,a2)
          phisum=phisum+phi(is)
        end do
      endif
      return
      end
