/****************************************************************/ /*** Simulates d-dim percolation ***/ /*** A.K. Hartmann June 2004 ***/ /*** Rechnergestütztes Wissenschaftliches Rechnen ***/ /*** University of Goettingen, Germany 2004 ***/ /****************************************************************/ #include #include #include #include "stacks.h" #define INDEX(t, r, nn) ((t)*(nn)+r) #define NEXT(t, r) next[INDEX(t, r, num_n)] /******************* mf_init_arr() **********************/ /** Allocates and initialises 'next[][]' For simple **/ /** hypercubic lattice. Use macro **/ /** 'NEXT' to access. NEXT(t,r) gives neighbour of **/ /** element 't'=1,2,... in direction 'r' with **/ /** 'r'=0,1,..,num_n-1 correspond to **/ /** +x,-x,+y,-y,... **/ /** PARAMETERS: (*)= return-paramter **/ /** dim: dimension of system **/ /** l: size of system in x,y,.. **/ /** (*) n_p: ptr to number of sites **/ /** RETURNS: **/ /** pointer to neighbour array **/ /** next: gives neighbours next[0..N][0..num_n-1] **/ /********************************************************/ int *percol_init_next(int dim, int *l, int *n_p) { int t, t2; /* loop counter */ int N; /* number of sites */ int *n; /* n[d]= # of sites in subsystem of dim. d */ int *next; /* contains neighbours of all sites */ int num_n; /* number of neighbours */ num_n = 2*dim; n = (int *) malloc((dim+1)*sizeof(int)); n[0] = 1; /* calculates sizes of subsytems */ for(t=1; t= 0) && (cluster[t] < num_cl)) size[cluster[t]]++; max_size = size[0]; /* determine maximum */ for(cl=1; cl max_size) max_size = size[cl]; free(size); return(max_size); } /******************* percol_analysis() ******************/ /** Performs evaluation with given data array **/ /** PARAMETERS: (*)= return-paramter **/ /** num_pts: number of points **/ /** value: data **/ /** RETURNS: **/ /** Binder parameter **/ /********************************************************/ double percol_analysis(int num_pts, double *value) { double sum, sum2, sum4; int t; sum = 0; sum2=0; sum4=0; for(t=0; t