Next, we initialize the pseudorandom number generator r
by setting the seed value using Seed
. Then the number of spins is computed assuming a square magnet. We then allocate memory needed to hold the magnet; this is a standard method of allocating a 2D array of integers. Next we call our init()
function, and finally we convert to since multiplication is more efficient than division.
/* Seed the random number generator */
gsl_rng_set(r,Seed);
/* Compute the number of spins */
N=L*L;
/* Allocate memory for the system */
M=(int**)malloc(L*sizeof(int*));
for (i=0;i<L;i++) M[i]=(int*)malloc(L*sizeof(int));
/* Generate an initial state */
init(M,L,r);
/* For computational efficiency, convert T to reciprocal T */
T=1.0/T;
cfa22@drexel.edu