      MODULE Var
      IMPLICIT NONE
      INTEGER dim, dimm1, Nproc, MAXINT, Maxiter
      REAL*4  fdim, vol
      PARAMETER (dim     = 8)
      PARAMETER (fdim    = 8.0)
      PARAMETER (Nproc   = 8)
      PARAMETER (dimm1   = dim - 1)
      PARAMETER (vol     = fdim*fdim)
      PARAMETER (MAXINT  = 2147483647)
      PARAMETER (Maxiter = 10000000)

      integer, dimension(0:dimm1, 0:dimm1) :: spin
      real,    dimension(0:dimm1, 0:dimm1) :: ranum
      logical, dimension(0:dimm1, 0:dimm1) :: cluster, new_cluster
      logical, array(0:3, 0:dimm1, 0:dimm1) :: neighbor


      INTEGER therm_sweeps, sweeps, measurements
      INTEGER nits, size
      REAL*4  beta, p
      REAL*8  sum_energy, sum_enersq, sum_spins, sum_spinsq
      REAL*8  sum_nits, sum_nitsq, sum_size, sum_sizesq
      END MODULE Var


!**********************************************************************
!
!      Main Program
!
!**********************************************************************

 


      PROGRAM Wolff_Cluster
      USE Var

!
!  Read in parameters, initialize spins, etc.
!
      CALL initialize
 

      CALL random
      sum_size = 100

 
      END program Wolff_Cluster


!********************************************************************
!
!  Initialize parameters and spins.
!
!********************************************************************

      SUBROUTINE initialize
      USE Var
      INTEGER i, j, start, seed44
      LOGICAL ordered
      integer mode

      PRINT *, ' ' 
!      PRINT *, ' input the number of thermalization sweeps'
!      READ *,  therm_sweeps
!      PRINT *, ' input the number of sweeps per measurement'
!      READ *,  sweeps
!      PRINT *, ' input the number of measurements'
!      READ *,  measurements
!      PRINT *, ' input the beta value'
!      READ *,  beta
!      PRINT *, ' ordered start (0) or random start (1)?'
!      READ *,  start
!      PRINT *, ' input seed for random number generator'
!      READ *,  seed

      p = 1 - EXP(-2.0*beta)


!
!  Initialize random number generator.

      CALL set_init_seed(1234, 8)


      RETURN
      END


