      subroutine xy_met0 ! bernd berg, feb 14 2002.
c xy model: sequential metropolis updating.
      include '../../libs/fortran/implicit.sta'
      include '../../libs/fortran/constants.par'
      parameter(n=2)
      include 'lat.par'
      include 'mc.par'
      include '../../libs/fortran_par/common_lat.f'
      include '../../libs/on_par/common_on.f'
      amin=act
      amax=act
      do is=1,ms
        phi=tpi*rmafun()
        xnew=cos(phi)
        ynew=sin(phi)
        dx=xnew-sta(1,is)
        dy=ynew-sta(2,is)
        dact=zero
        do id=1,nd
          dact=dact+sta(1,ipf(id,is))*dx+sta(2,ipf(id,is))*dy
          dact=dact+sta(1,ipb(id,is))*dx+sta(2,ipb(id,is))*dy
        end do
        if(dact.lt.zero) then
        if(rmafun().ge.exp(beta*dact)) go to 1
        end if
          sta(1,is)=xnew
          sta(2,is)=ynew
          act=act+dact
          acpt=acpt+one
          amin=min(amin,act)
          amax=max(amax,act)
 1      continue
      end do
      a_min=min(a_min,amin)
      a_max=max(a_max,amax)
      return
      end
