//simulates the contact process on a 1D lattice with PBC //written (in bad style) by Stefan Grosskinsky #include //#include #include #include #include #include #include #include #define n 128 //system size #define runs 500 //number of averages #define steps 200 //number of outputs in the file #define tmax 1280 //total (real) simulation time #define l 1.65 //infection rate lambda FILE *output_ptr; char *output_file; char dataname[80]; const gsl_rng_type * T; gsl_rng * r; int x[n], sum; //array of individuals and sum double t, pr, pi; //time counter void init(); void update(); void file(); int main(void) { int k,i, j,imax; time_t t1 = time(NULL); //random seed with system time t1 gsl_rng_env_setup(); T = gsl_rng_default; r = gsl_rng_alloc (T); gsl_rng_set(r,t1); printf("This is a very good program for the contact process...\n"); pr=1./(2.*l); // recovery probability for l>=1 pi=0.5; // infection prob for l>=1 imax=tmax*n*2*l/steps; // number of update steps between outputs file(); output_ptr = fopen(output_file,"a"); for(j=0; j