      subroutine scalar_act(phi,xmfactor,xla,ipf,ns,nd,sact,phisum) 
C Bernd Berg Mar 27 2009. Action for scalar field configuration.
      include '../../Libs/Fortran/implicit.sta'
      include '../../Libs/Fortran/constants.par'
      dimension phi(ns),ipf(nd,ns)
      sact=zero
      phisum=zero
      do is=1,ns        
        phinn=zero
        do id=1,nd
          phinn=phinn+phi(ipf(id,is))
        enddo
        sact=sact+factphi1(phinn,xmfactor,xla,phi(is))
        phisum=phisum+phi(is)
      enddo
      return
      end
