2 |
|
|
3 |
|
#include <stdio.h> |
4 |
|
#include <stdlib.h> |
5 |
+ |
#include <string.h> |
6 |
|
|
7 |
|
|
8 |
|
#include "params.h" |
9 |
|
#include "tcProps.h" |
10 |
|
#include "readWrite.h" |
11 |
|
#include "scdCorr.h" |
12 |
+ |
#include "directorHead.h" |
13 |
+ |
#include "directorWhole.h" |
14 |
+ |
#include "rmsd.h" |
15 |
|
|
16 |
|
|
17 |
|
#define VERSION_MAJOR 0 |
34 |
|
|
35 |
|
struct atomCoord atoms[nAtoms]; |
36 |
|
int i,j,k; |
33 |
– |
char* inName; |
34 |
– |
int nFrames; |
37 |
|
|
38 |
|
char* outPrefix; // the output prefix |
39 |
|
char currentFlag; // used in parsing the flags |
40 |
|
int done = 0; // multipurpose boolean |
41 |
|
int havePrefix; // boolean for the output prefix |
42 |
+ |
int haveMaxLength; |
43 |
|
char* conversionCheck; |
44 |
|
int conversionError; |
45 |
|
int optionError; |
47 |
|
char* pair2; |
48 |
|
int scdCorr; |
49 |
|
double startTime; |
50 |
+ |
double maxLength; |
51 |
+ |
int directorHead, directorWhole, doRMSD; |
52 |
+ |
enum atomNames rmsdType; |
53 |
|
|
54 |
|
// system initialization |
55 |
|
|
61 |
|
outPrefix = NULL; |
62 |
|
inName = NULL; |
63 |
|
|
64 |
+ |
haveMaxLength = 0; |
65 |
|
conversionError = 0; |
66 |
|
optionError = 0; |
67 |
|
havePrefix = 0; |
68 |
|
scdCorr = 0; |
69 |
|
startTime = 0.0; |
70 |
+ |
directorHead = 0; |
71 |
+ |
directorWhole = 0; |
72 |
+ |
doRMSD = 0; |
73 |
|
|
74 |
|
|
75 |
|
// parse the command line |
86 |
|
|
87 |
|
// parse long word options |
88 |
|
|
89 |
< |
if( !strcmp( argV[i], "--gofr" ) ){ |
89 |
> |
if( !strcmp( argV[i], "--rmsd" ) ){ |
90 |
|
|
91 |
+ |
doRMSD = 1; |
92 |
|
i++; |
93 |
|
if( i>=argC ){ |
94 |
|
fprintf( stderr, |
95 |
|
"\n" |
96 |
< |
"not enough arguments for --gofr\n"); |
96 |
> |
"not enough arguments for --rmsd\n"); |
97 |
|
usage(); |
98 |
|
exit(0); |
99 |
|
} |
100 |
|
pair1 = argV[i]; |
101 |
|
|
102 |
< |
i++; |
103 |
< |
if( i>=argC ){ |
102 |
> |
if( !strcmp(pair1, "HEAD") ) rmsdType = HEAD; |
103 |
> |
else if( !strcmp(pair1, "CH") ) rmsdType = CH; |
104 |
> |
else if( !strcmp(pair1, "CH2") )rmsdType = CH2; |
105 |
> |
else if( !strcmp(pair1, "CH3") )rmsdType = CH3; |
106 |
> |
else if( !strcmp(pair1, "SSD") )rmsdType = SSD; |
107 |
> |
else if( !strcmp(pair1, "COM") )rmsdType = COM; |
108 |
> |
else{ |
109 |
|
fprintf( stderr, |
110 |
< |
"\n" |
111 |
< |
"not enough arguments for --gofr\n"); |
96 |
< |
usage(); |
110 |
> |
"Unrecognized rmsd atom type \"%s\"\n", |
111 |
> |
pair1 ); |
112 |
|
exit(0); |
113 |
< |
} |
99 |
< |
pair2 = argV[i]; |
113 |
> |
} |
114 |
|
|
115 |
|
} |
116 |
|
|
245 |
|
case 'l': |
246 |
|
// -l <double> set <double> to the maxLength |
247 |
|
|
248 |
< |
haveMaxLength = true; |
248 |
> |
haveMaxLength = 1; |
249 |
|
j++; |
250 |
|
currentFlag = argV[i][j]; |
251 |
|
|
306 |
|
break; |
307 |
|
|
308 |
|
case 's': |
309 |
< |
// -s turn on separate output files |
309 |
> |
// -s turn on Scd corr |
310 |
|
|
311 |
|
scdCorr = 1; |
312 |
+ |
break; |
313 |
+ |
|
314 |
+ |
case 'h': |
315 |
+ |
// -h turn on director head |
316 |
+ |
|
317 |
+ |
directorHead = 1; |
318 |
+ |
break; |
319 |
+ |
|
320 |
+ |
case 'w': |
321 |
+ |
// -h turn on director head |
322 |
+ |
|
323 |
+ |
directorWhole = 1; |
324 |
|
break; |
325 |
|
|
326 |
|
|
327 |
|
default: |
328 |
|
|
329 |
< |
sprintf(painCave.errMsg, |
329 |
> |
fprintf( stderr, |
330 |
|
"\n" |
331 |
|
"Bad option \"-%c\"\n", currentFlag); |
332 |
|
usage(); |
362 |
|
exit(0); |
363 |
|
} |
364 |
|
|
365 |
+ |
if( outPrefix == NULL ) |
366 |
+ |
outPrefix = inName; |
367 |
|
|
368 |
+ |
|
369 |
|
// initialize the arrays |
370 |
|
|
371 |
|
for(i=0;i<nLipids;i++){ |
372 |
|
|
373 |
|
atoms[nLipAtoms*i+0].type = HEAD; |
374 |
+ |
atoms[nLipAtoms*i+0].mass = 72; |
375 |
|
atoms[nLipAtoms*i+0].u[0] = 0.0; |
376 |
|
atoms[nLipAtoms*i+0].u[1] = 0.0; |
377 |
|
atoms[nLipAtoms*i+0].u[2] = 1.0; |
378 |
|
|
379 |
+ |
|
380 |
|
|
381 |
|
atoms[nLipAtoms*i+1].type = CH2; |
382 |
+ |
atoms[nLipAtoms*i+1].mass = 14.03; |
383 |
|
|
384 |
|
atoms[nLipAtoms*i+2].type = CH; |
385 |
+ |
atoms[nLipAtoms*i+2].mass = 13.02; |
386 |
|
|
387 |
|
atoms[nLipAtoms*i+3].type = CH2; |
388 |
+ |
atoms[nLipAtoms*i+3].mass = 14.03; |
389 |
|
|
390 |
|
atoms[nLipAtoms*i+4].type = CH2; |
391 |
+ |
atoms[nLipAtoms*i+4].mass = 14.03; |
392 |
|
|
393 |
|
atoms[nLipAtoms*i+5].type = CH2; |
394 |
+ |
atoms[nLipAtoms*i+5].mass = 14.03; |
395 |
|
|
396 |
|
atoms[nLipAtoms*i+6].type = CH2; |
397 |
+ |
atoms[nLipAtoms*i+6].mass = 14.03; |
398 |
|
|
399 |
|
atoms[nLipAtoms*i+7].type = CH2; |
400 |
+ |
atoms[nLipAtoms*i+7].mass = 14.03; |
401 |
|
|
402 |
|
atoms[nLipAtoms*i+8].type = CH2; |
403 |
+ |
atoms[nLipAtoms*i+8].mass = 14.03; |
404 |
|
|
405 |
|
atoms[nLipAtoms*i+9].type = CH2; |
406 |
+ |
atoms[nLipAtoms*i+9].mass = 14.03; |
407 |
|
|
408 |
|
atoms[nLipAtoms*i+10].type = CH3; |
409 |
+ |
atoms[nLipAtoms*i+10].mass = 15.04; |
410 |
|
|
411 |
|
atoms[nLipAtoms*i+11].type = CH2; |
412 |
+ |
atoms[nLipAtoms*i+11].mass = 14.03; |
413 |
|
|
414 |
|
atoms[nLipAtoms*i+12].type = CH2; |
415 |
+ |
atoms[nLipAtoms*i+12].mass = 14.03; |
416 |
|
|
417 |
< |
atoms[nLipAtoms*i+13].type = CH2; |
417 |
> |
atoms[nLipAtoms*i+13].type = CH2; |
418 |
> |
atoms[nLipAtoms*i+13].mass = 14.03; |
419 |
|
|
420 |
|
atoms[nLipAtoms*i+14].type = CH2; |
421 |
+ |
atoms[nLipAtoms*i+14].mass = 14.03; |
422 |
|
|
423 |
|
atoms[nLipAtoms*i+15].type = CH2; |
424 |
+ |
atoms[nLipAtoms*i+15].mass = 14.03; |
425 |
|
|
426 |
|
atoms[nLipAtoms*i+16].type = CH2; |
427 |
+ |
atoms[nLipAtoms*i+16].mass = 14.03; |
428 |
|
|
429 |
|
atoms[nLipAtoms*i+17].type = CH2; |
430 |
+ |
atoms[nLipAtoms*i+17].mass = 14.03; |
431 |
|
|
432 |
|
atoms[nLipAtoms*i+18].type = CH3; |
433 |
+ |
atoms[nLipAtoms*i+18].mass = 15.04; |
434 |
|
} |
435 |
|
|
436 |
|
for(i=(nLipAtoms*nLipids);i<nAtoms;i++){ |
437 |
|
atoms[i].type = SSD; |
438 |
+ |
atoms[i].mass = 18.03; |
439 |
|
atoms[i].u[0] = 0.0; |
440 |
|
atoms[i].u[1] = 0.0; |
441 |
|
atoms[i].u[2] = 1.0; |
443 |
|
|
444 |
|
// read and set the frames |
445 |
|
|
446 |
< |
openFile( inName ); |
446 |
> |
openFile(); |
447 |
|
|
448 |
|
fprintf( stdout, |
449 |
|
"\n" |
451 |
|
inName ); |
452 |
|
fflush(stdout); |
453 |
|
|
454 |
< |
setFrames( inName ); |
454 |
> |
setFrames(); |
455 |
|
|
456 |
|
fprintf( stdout, |
457 |
|
"done.\n" |
458 |
< |
"nFrames = %d\n.", |
458 |
> |
"nFrames = %d.\n", |
459 |
|
nFrames ); |
460 |
|
fflush(stdout); |
461 |
|
|
465 |
|
"Calculating the Scd correlation\n" ); |
466 |
|
fflush( stdout ); |
467 |
|
|
468 |
< |
calcScdCorr( startTime ); |
468 |
> |
calcScdCorr( startTime, atoms, outPrefix ); |
469 |
|
} |
470 |
+ |
|
471 |
+ |
if(directorHead){ |
472 |
+ |
|
473 |
+ |
fprintf ( stdout, |
474 |
+ |
"Calculating the Head director\n" ); |
475 |
+ |
fflush( stdout ); |
476 |
+ |
|
477 |
+ |
calcDirHeadCorr( startTime, atoms, outPrefix ); |
478 |
+ |
} |
479 |
+ |
|
480 |
+ |
if(directorWhole){ |
481 |
+ |
|
482 |
+ |
fprintf ( stdout, |
483 |
+ |
"Calculating the bilayer director\n" ); |
484 |
+ |
fflush( stdout ); |
485 |
+ |
|
486 |
+ |
calcDirWholeCorr( startTime, atoms, outPrefix ); |
487 |
+ |
} |
488 |
+ |
|
489 |
+ |
if(doRMSD){ |
490 |
+ |
|
491 |
+ |
fprintf ( stdout, |
492 |
+ |
"Calculating the RMSD\n" ); |
493 |
+ |
fflush( stdout ); |
494 |
+ |
|
495 |
+ |
rmsd( rmsdType, startTime, outPrefix ); |
496 |
+ |
} |
497 |
|
|
498 |
|
|
499 |
+ |
closeFile(); |
500 |
+ |
|
501 |
|
} |
502 |
|
|
503 |
|
|
519 |
|
" -l <maxLength> set the maximum value of r\n" |
520 |
|
" *Defaults to 1/2 smallest length of first frame.\n" |
521 |
|
" -s Calculate the Scd chain correlation.\n" |
522 |
+ |
" -h Calculate the directors for the head groups\n" |
523 |
+ |
" -w Calculate the director fro the bilayers\n" |
524 |
|
"\n" |
525 |
|
" long:\n" |
526 |
|
" -----\n" |
527 |
< |
" --gofr <atom1> <atom2> g(r) for atom1 and atom2\n" |
527 |
> |
" --rmsd <atom1> rmsd for atom1\n" |
528 |
|
" --gofrTheta <atom1> <atom2> g(r, theta) for atom1 and atom2\n" |
529 |
|
" --gofrOmega <atom1> <atom2> g(r, omega) for atom1 and atom2\n" |
530 |
|
" --version displays the version number\n" |