      subroutine xy_init1(lpr) ! bernd berg, nov 17 2000.
c initializes arrays needed for generalized potts model mc calculation.
      include '../../libs/fortran/implicit.sta'
      include '../../libs/fortran/constants.par'
      include 'lat.par'
      include 'mc.par'
      include '../../libs/fortran_par/common_lat.f'
      include '../../libs/fortran_par/common_xy1.f'
      dimension ix(nd)
      ns=nsfun(nla,nd) ! consistency check.
      if(ns.gt.ms) stop "xy_init1.f: ns.gt.ms."
c
c initialize:
      if(lpr) call rmaset(iuo,iud1,iseed1,iseed2,'nexiste.pa') ! ran-num
      if(.not.lpr) call rmaset(-iuo,iud1,iseed1,iseed2,'nexiste.pa') 
      call ranmar(xr)                              ! first random number
      acpt=zero                                    ! acceptance rate
      a_min=one*mlink
      a_max=zero
      call lat_init(ms,nd,ipf,ipb,nla,ix)                      ! lattice
      call xy_ran1(sta,ms)                   ! xy initial states (random)
      call xy_act1(sta,ipf,ms,nd,act)                         ! xy action
c
      if(.not.lpr) return
      write(iuo,'(" initial randon number: xr =",1f12.6)') xr
      write(iuo,'(" lat.par: nd,nla         =",1i2,3x,8i4)') nd,nla
      write(iuo,'("          ms,mlink       =",2i10)') ms,mlink
      write(iuo,'(" mc.par:")')
      write(iuo,'(1x,"iuo,iud1,iseed1,iseed2,    beta")')
      write(iuo,'(        2i4,          2i7,     1f11.6)')
     &                      iuo,iud1,iseed1,iseed2,beta
      write(iuo,'(" initial action:  act =",g15.6)') act
      return
      end
