ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/dp/dp.c
(Generate patch)

Comparing trunk/dp/dp.c (file contents):
Revision 587 by xsun, Thu Jul 10 15:42:41 2003 UTC vs.
Revision 665 by xsun, Mon Aug 4 23:40:54 2003 UTC

# Line 1 | Line 1
1   #include<stdio.h>
2   #include<math.h>
3   #include<stdlib.h>
4 + #include<string.h>
5   #define max_sites 15000
6   #define MYSEED 8973247
7  
# Line 13 | Line 14 | int main()
14   int attemp, nacc;
15  
16  
17 < int main()
17 > int main(argc, argv)
18 > int argc;
19 > char *argv[];
20   {
21    void getmag();
22    double eneri(double xi, double yi, double zi, double phii, double thetai, int i, int jb);
# Line 27 | Line 30 | int main()
30    int icycl, ncycl, imove, nmoves, nsamp;
31    int nx, ny, which, i, j;
32    
33 +  FILE *inFile;
34 +  char *endptr, s[100000];
35 +  double ux, uy, uz;
36 +  
37    FILE *outFile;
38 <  outFile=fopen("dp_file","w");
38 >  outFile=fopen("dp_file1","a");
39    
40    srand48(MYSEED);
41    
# Line 50 | Line 57 | int main()
57    strength = 10.0;
58    ncycl = 1e7;
59    nmoves = 100;
60 <  nsamp = 1e4;
60 >  nsamp = 100;
61    twopi = 2.0 * M_PI;
62    dtheta = 0.1;
63    kb = 0.0019872198;
# Line 61 | Line 68 | int main()
68    kz = kb;
69    ktheta = kb;
70    theta0 = M_PI / 2.0;
71 <    
71 >  
72    which = 0;
73    xlat = 0;
74 +
75 +  if( strcmp(argv[1], "-resume") == 0) {
76 +    
77 +    inFile = fopen("./l_con","r");
78 +    if (inFile == NULL){
79 +            printf("Error opening file\n");
80 +            exit(-1);
81 +    }
82 +    
83 +    while(!feof(inFile))
84 +    {
85 +            fgets(s, 500, inFile);
86 +            nsites = atoi(s);
87 +            fscanf(inFile,"%s",s);
88 +            xlat= atoi(s);
89 +            fscanf(inFile,"%s",s);
90 +            ylat= atoi(s);
91 +            for(i=1; i<=nsites; i++)
92 +            {
93 +                    fscanf(inFile,"%s",s);
94 +                    fscanf(inFile,"%s",s);
95 +                    x[i] = strtod(s, &endptr);
96 +                    fscanf(inFile,"%s",s);
97 +                    y[i] = strtod(s, &endptr);
98 +                    fscanf(inFile,"%s",s);
99 +                    z[i] = strtod(s, &endptr);
100 +                    fscanf(inFile,"%s",s);
101 +                    phi[i] = strtod(s, &endptr);
102 +                    fscanf(inFile,"%s",s);
103 +                    ux = strtod(s, &endptr);
104 +                    fscanf(inFile,"%s",s);
105 +                    uy = strtod(s, &endptr);
106 +                    fscanf(inFile,"%s",s);
107 +                    uz = strtod(s, &endptr);
108 +                    theta[i] = acos(uz);
109 +                    mu[i] = strength;
110 +            }
111 +    }
112 +    fclose(inFile);
113 +    printf("%f\t%f\t%f\t%f\t%f\n", x[nsites], y[nsites], z[nsites], phi[nsites], theta[nsites]);
114 +  }
115  
116 +  else{
117    for(i=0; i < nx; i++) {
118  
119      xlat = xlat + 2;
# Line 101 | Line 150 | int main()
150    }
151  
152    nsites= which;
153 +  }
154    
155    en=toterg();
156    printf("\nthe initial energy is : \t%f\n\n",en);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines