--- trunk/dp/dp.c 2003/07/10 15:42:41 587 +++ trunk/dp/dp.c 2003/08/04 23:40:54 665 @@ -1,6 +1,7 @@ #include #include #include +#include #define max_sites 15000 #define MYSEED 8973247 @@ -13,7 +14,9 @@ int main() int attemp, nacc; -int main() +int main(argc, argv) +int argc; +char *argv[]; { void getmag(); double eneri(double xi, double yi, double zi, double phii, double thetai, int i, int jb); @@ -27,8 +30,12 @@ int main() int icycl, ncycl, imove, nmoves, nsamp; int nx, ny, which, i, j; + FILE *inFile; + char *endptr, s[100000]; + double ux, uy, uz; + FILE *outFile; - outFile=fopen("dp_file","w"); + outFile=fopen("dp_file1","a"); srand48(MYSEED); @@ -50,7 +57,7 @@ int main() strength = 10.0; ncycl = 1e7; nmoves = 100; - nsamp = 1e4; + nsamp = 100; twopi = 2.0 * M_PI; dtheta = 0.1; kb = 0.0019872198; @@ -61,10 +68,52 @@ int main() kz = kb; ktheta = kb; theta0 = M_PI / 2.0; - + which = 0; xlat = 0; + + if( strcmp(argv[1], "-resume") == 0) { + + inFile = fopen("./l_con","r"); + if (inFile == NULL){ + printf("Error opening file\n"); + exit(-1); + } + + while(!feof(inFile)) + { + fgets(s, 500, inFile); + nsites = atoi(s); + fscanf(inFile,"%s",s); + xlat= atoi(s); + fscanf(inFile,"%s",s); + ylat= atoi(s); + for(i=1; i<=nsites; i++) + { + fscanf(inFile,"%s",s); + fscanf(inFile,"%s",s); + x[i] = strtod(s, &endptr); + fscanf(inFile,"%s",s); + y[i] = strtod(s, &endptr); + fscanf(inFile,"%s",s); + z[i] = strtod(s, &endptr); + fscanf(inFile,"%s",s); + phi[i] = strtod(s, &endptr); + fscanf(inFile,"%s",s); + ux = strtod(s, &endptr); + fscanf(inFile,"%s",s); + uy = strtod(s, &endptr); + fscanf(inFile,"%s",s); + uz = strtod(s, &endptr); + theta[i] = acos(uz); + mu[i] = strength; + } + } + fclose(inFile); + printf("%f\t%f\t%f\t%f\t%f\n", x[nsites], y[nsites], z[nsites], phi[nsites], theta[nsites]); + } + else{ for(i=0; i < nx; i++) { xlat = xlat + 2; @@ -101,6 +150,7 @@ int main() } nsites= which; + } en=toterg(); printf("\nthe initial energy is : \t%f\n\n",en);