74 |
|
percentComplete = |
75 |
|
(int)( 100.0 * (double)framesFinished / (double) corrFrames ); |
76 |
|
|
77 |
< |
// fprintf( stdout, |
78 |
< |
// "\rDirector bilayer corr %3d%% complete.", |
79 |
< |
// percentComplete ); |
80 |
< |
// fflush( stdout ); |
77 |
> |
fprintf( stdout, |
78 |
> |
"\rDirector bilayer corr %3d%% complete.", |
79 |
> |
percentComplete ); |
80 |
> |
fflush( stdout ); |
81 |
|
|
82 |
|
readFrame( i, atoms, Hmat ); |
83 |
|
|
88 |
|
framesFinished++; |
89 |
|
} |
90 |
|
|
91 |
< |
// sprintf( outName, "%s.dirHead", outPrefix ); |
92 |
< |
// outFile = fopen( outName, "w" ); |
91 |
> |
sprintf( outName, "%s.dirWhole", outPrefix ); |
92 |
> |
outFile = fopen( outName, "w" ); |
93 |
|
|
94 |
+ |
fprintf( outFile, |
95 |
+ |
"#time\torderParam\tx\ty\tz\n"); |
96 |
+ |
|
97 |
+ |
for(i=0;i<corrFrames;i++){ |
98 |
+ |
fprintf( outFile, |
99 |
+ |
"%6G\t%6G\t%6G\t%6G\t%6G\n", |
100 |
+ |
directorWhole[i].time, |
101 |
+ |
directorWhole[i].order, |
102 |
+ |
directorWhole[i].u[0], |
103 |
+ |
directorWhole[i].u[1], |
104 |
+ |
directorWhole[i].u[2]); |
105 |
+ |
} |
106 |
|
|
107 |
|
|
108 |
|
|
109 |
< |
// fflush(outFile); |
110 |
< |
// fclose(outFile); |
109 |
> |
fflush(outFile); |
110 |
> |
fclose(outFile); |
111 |
|
|
112 |
|
percentComplete = |
113 |
|
(int)( 100.0 * (double)framesFinished / (double) corrFrames ); |
139 |
|
|
140 |
|
double oMat[3][3]; |
141 |
|
double iMat[3][3]; |
142 |
+ |
double matWrap[9]; |
143 |
|
double com[3]; |
144 |
|
double totMass; |
145 |
|
double lenPrinc, distl; |
185 |
|
for(j=0;j<nLipAtoms;j++){ |
186 |
|
l=k+j; |
187 |
|
|
188 |
< |
for(m=0;m<3;m++){ |
188 |
> |
for(m=0;m<3;m++) |
189 |
|
com[m] += atoms[l].mass * atoms[l].pos[m]; |
190 |
< |
totMass += atoms[l].mass; |
191 |
< |
} |
190 |
> |
|
191 |
> |
totMass += atoms[l].mass; |
192 |
|
} |
193 |
|
for(m=0;m<3;m++) com[m] /= totMass; |
194 |
|
|
210 |
|
|
211 |
|
|
212 |
|
} |
213 |
+ |
|
214 |
+ |
// fprintf(stderr, "iMat (before) = %6G, %6G, %6G\n" |
215 |
+ |
// " %6G, %6G, %6G\n" |
216 |
+ |
// " %6G, %6G, %6G\n\n", |
217 |
+ |
// iMat[0][0], iMat[0][1], iMat[0][2], |
218 |
+ |
// iMat[1][0], iMat[1][1], iMat[1][2], |
219 |
+ |
// iMat[2][0], iMat[2][1], iMat[2][2]); |
220 |
|
|
221 |
+ |
// matWrap to fortran convention |
222 |
+ |
|
223 |
+ |
for(j=0;j<3;j++) |
224 |
+ |
for(l=0;l<3;l++) |
225 |
+ |
matWrap[l+3*j] = iMat[l][j]; |
226 |
+ |
|
227 |
|
ifail = 0; |
228 |
< |
dsyev(&job, &uplo, &nfilled, iMat, &ndiag, evals, work, &lWork, &ifail); |
228 |
> |
dsyev(&job, &uplo, &nfilled, matWrap, &ndiag, evals, work, &lWork, &ifail); |
229 |
|
|
230 |
|
if (ifail) { |
231 |
|
fprintf(stderr, "dsyev screwed something up!\n"); |
232 |
|
exit(0); |
233 |
|
} |
234 |
|
|
235 |
< |
fprintf(stderr, "evals = %6G, %6G, %6G\n\n", |
210 |
< |
evals[0], evals[1], evals[2]); |
235 |
> |
// matWrap from fortran convention |
236 |
|
|
237 |
< |
fprintf(stderr, "iMat = %6G, %6G, %6G\n" |
238 |
< |
" %6G, %6G, %6G\n" |
239 |
< |
" %6G, %6G, %6G\n\n", |
215 |
< |
iMat[0][0], iMat[0][1], iMat[0][2], |
216 |
< |
iMat[1][0], iMat[1][1], iMat[1][2], |
217 |
< |
iMat[2][0], iMat[2][1], iMat[2][2]); |
237 |
> |
for(j=0;j<3;j++) |
238 |
> |
for(l=0;l<3;l++) |
239 |
> |
iMat[l][j] = matWrap[l+3*j]; |
240 |
|
|
241 |
+ |
// fprintf(stderr, "evals = %6G, %6G, %6G\n\n", |
242 |
+ |
// evals[0], evals[1], evals[2]); |
243 |
|
|
244 |
+ |
// fprintf(stderr, "iMat (after) = %6G, %6G, %6G\n" |
245 |
+ |
// " %6G, %6G, %6G\n" |
246 |
+ |
// " %6G, %6G, %6G\n\n", |
247 |
+ |
// iMat[0][0], iMat[0][1], iMat[0][2], |
248 |
+ |
// iMat[1][0], iMat[1][1], iMat[1][2], |
249 |
+ |
// iMat[2][0], iMat[2][1], iMat[2][2]); |
250 |
+ |
|
251 |
+ |
|
252 |
|
|
253 |
|
smallest = fabs(evals[0]); |
254 |
|
which = 0; |
262 |
|
lenPrinc = 0.0; |
263 |
|
for(j=0;j<3;j++) |
264 |
|
lenPrinc += iMat[j][which] * iMat[j][which]; |
265 |
+ |
lenPrinc = sqrt( lenPrinc ); |
266 |
|
|
267 |
|
for(j=0;j<3;j++) |
268 |
|
principal[i].u[j] = iMat[j][which]/lenPrinc; |
292 |
|
for(j=0;j<3;j++) |
293 |
|
oMat[i][j] /= (double)nLipids; |
294 |
|
|
295 |
+ |
// matWrap to fortran convention |
296 |
+ |
|
297 |
+ |
for(j=0;j<3;j++) |
298 |
+ |
for(l=0;l<3;l++) |
299 |
+ |
matWrap[l+3*j] = oMat[l][j]; |
300 |
+ |
|
301 |
|
ifail = 0; |
302 |
+ |
dsyev(&job, &uplo, &nfilled, matWrap, &ndiag, evals, work, &lWork, &ifail); |
303 |
|
|
264 |
– |
dsyev(&job, &uplo, &nfilled, oMat, &ndiag, evals, work, &lWork, &ifail); |
265 |
– |
|
304 |
|
if (ifail) { |
305 |
|
fprintf(stderr, "dsyev screwed something up!\n"); |
306 |
|
exit(0); |
307 |
|
} |
308 |
+ |
|
309 |
+ |
// matWrap from fortran convention |
310 |
|
|
311 |
+ |
for(j=0;j<3;j++) |
312 |
+ |
for(l=0;l<3;l++) |
313 |
+ |
oMat[l][j] = matWrap[l+3*j]; |
314 |
+ |
|
315 |
|
max = 0.0; |
316 |
|
for (i=0; i<3;i++) { |
317 |
|
if (fabs(evals[i]) > max) { |
326 |
|
|
327 |
|
directorWhole[index].order = 1.5 * max; |
328 |
|
|
329 |
< |
fprintf(stderr, |
330 |
< |
"frame[%d] => order = %6G; < %6G, %6G, %6G >\n", |
331 |
< |
index, |
332 |
< |
directorWhole[index].order, |
333 |
< |
directorWhole[index].u[0], |
334 |
< |
directorWhole[index].u[1], |
335 |
< |
directorWhole[index].u[2] ); |
329 |
> |
// fprintf(stderr, |
330 |
> |
// "frame[%d] => order = %6G; < %6G, %6G, %6G >\n", |
331 |
> |
// index, |
332 |
> |
// directorWhole[index].order, |
333 |
> |
// directorWhole[index].u[0], |
334 |
> |
// directorWhole[index].u[1], |
335 |
> |
// directorWhole[index].u[2] ); |
336 |
|
|
337 |
|
// fprintf(stdout, |
338 |
|
// "%6g\t%6G\n", |