
 
C  Read in the parameters for the simulation.
 
	SUBROUTINE input(seed,start)
	INCLUDE "common.h"
	INTEGER seed,start

        WRITE(6,*) 'Length of the lattice? '
	READ(5,*)  globside
	WRITE(6,*) globside
	globisiz = globside
	globjsiz = globside
	globsites = globside * globside
	volume = FLOAT(globsites)
	WRITE(6,*) 'Volume = ', globsites

	WRITE(6,*) 'Number of thermalization sweeps? '
	READ(5,*)  therm_sweeps
	WRITE(6,*) therm_sweeps

	WRITE(6,*) 'Number of sweeps per measurement? '
	READ(5,*)  sweeps
	WRITE(6,*) sweeps

	WRITE(6,*) 'Number of measurements? '
	READ(5,*)  measurements
	WRITE(6,*) measurements

	WRITE(6,*) 'Beta (inverse temperature)? '
	READ(5,*)  beta
	WRITE(6,*) beta

	WRITE(6,*) 'Ordered (0) or random (1) start? '
	READ(5,*)  start
	WRITE(6,*) start

	WRITE(6,*) 'Seed for the random number generator? '
	READ(5,*)  seed
	WRITE(6,*) seed

	RETURN 
	END


C--------------------------------------------------------------------------

 
C  Initialize the spins with an ordered or random start.
 
	SUBROUTINE init_spins(start)
	INCLUDE "common.h"
	INTEGER start
	INTEGER i,j
	REAL ranmar
	INTEGER magn
	
	IF (start.EQ.0) THEN
 
C ------  Ordered (cold) start
	  WRITE(6,*) 'Cold start'
 
	  DO i=1,isiz
	  DO j=1,jsiz
	    spin(i,j) = 1
	  ENDDO
	  ENDDO

	ELSE 
 
C ------  Random (hot) start
	  WRITE(6,*) 'Hot start'
 
	  DO i=1,isiz
	  DO j=1,jsiz
	    IF (ranmar() .LT. 0.5) THEN
	      spin(i,j) = 1
	    ELSE
	      spin(i,j) = -1
	    ENDIF
	  ENDDO
	  ENDDO

	ENDIF
	
C ----  Pass edges to neighboring processors.
        CALL spin_edges
	
	RETURN 
	END

