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 |
|
|
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); |
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 |
|
|
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; |
150 |
|
} |
151 |
|
|
152 |
|
nsites= which; |
153 |
+ |
} |
154 |
|
|
155 |
|
en=toterg(); |
156 |
|
printf("\nthe initial energy is : \t%f\n\n",en); |