      subroutine xy_act(sta,ipf,ns,nd,act) ! bernd berg feb 21 2002.
c calculates action value act of xy model (planar rotator).
c x and y components stored.
      include '../../libs/fortran/implicit.sta'
      include '../../libs/fortran/constants.par'
      dimension sta(2,ns),ipf(nd,ns)
      act=zero
      do is=1,ns
        do id=1,nd
         act=act+sta(1,is)*sta(1,ipf(id,is))+sta(2,is)*sta(2,ipf(id,is))
        end do
      end do
      return
      end
