| 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 |
+ |
#include "gofz.h" |
| 16 |
|
|
| 17 |
|
|
| 18 |
|
#define VERSION_MAJOR 0 |
| 35 |
|
|
| 36 |
|
struct atomCoord atoms[nAtoms]; |
| 37 |
|
int i,j,k; |
| 33 |
– |
char* inName; |
| 34 |
– |
int nFrames; |
| 38 |
|
|
| 39 |
|
char* outPrefix; // the output prefix |
| 40 |
|
char currentFlag; // used in parsing the flags |
| 41 |
|
int done = 0; // multipurpose boolean |
| 42 |
|
int havePrefix; // boolean for the output prefix |
| 43 |
+ |
int haveMaxLength; |
| 44 |
|
char* conversionCheck; |
| 45 |
|
int conversionError; |
| 46 |
|
int optionError; |
| 47 |
+ |
char* rmsdName; |
| 48 |
|
char* pair1; |
| 49 |
|
char* pair2; |
| 50 |
|
int scdCorr; |
| 51 |
|
double startTime; |
| 52 |
+ |
double avgXY; |
| 53 |
+ |
double maxLength; |
| 54 |
|
|
| 55 |
+ |
int directorHead, directorWhole, doRMSD, doGofz, doAvgXY; |
| 56 |
+ |
enum atomNames rmsdType; |
| 57 |
+ |
|
| 58 |
|
// system initialization |
| 59 |
|
|
| 60 |
|
isScanned = 0; |
| 65 |
|
outPrefix = NULL; |
| 66 |
|
inName = NULL; |
| 67 |
|
|
| 68 |
+ |
haveMaxLength = 0; |
| 69 |
|
conversionError = 0; |
| 70 |
|
optionError = 0; |
| 71 |
|
havePrefix = 0; |
| 72 |
|
scdCorr = 0; |
| 73 |
|
startTime = 0.0; |
| 74 |
+ |
directorHead = 0; |
| 75 |
+ |
directorWhole = 0; |
| 76 |
+ |
doRMSD = 0; |
| 77 |
+ |
doGofz = 0; |
| 78 |
+ |
doAvgXY = 0; |
| 79 |
|
|
| 80 |
|
|
| 81 |
|
// parse the command line |
| 92 |
|
|
| 93 |
|
// parse long word options |
| 94 |
|
|
| 95 |
< |
if( !strcmp( argV[i], "--gofr" ) ){ |
| 95 |
> |
if( !strcmp( argV[i], "--rmsd" ) ){ |
| 96 |
|
|
| 97 |
+ |
doRMSD = 1; |
| 98 |
|
i++; |
| 99 |
|
if( i>=argC ){ |
| 100 |
|
fprintf( stderr, |
| 101 |
|
"\n" |
| 102 |
< |
"not enough arguments for --gofr\n"); |
| 102 |
> |
"not enough arguments for --rmsd\n"); |
| 103 |
|
usage(); |
| 104 |
|
exit(0); |
| 105 |
|
} |
| 106 |
< |
pair1 = argV[i]; |
| 106 |
> |
rmsdName = argV[i]; |
| 107 |
|
|
| 108 |
< |
i++; |
| 109 |
< |
if( i>=argC ){ |
| 108 |
> |
if( !strcmp(rmsdName, "HEAD") ) rmsdType = HEAD; |
| 109 |
> |
else if( !strcmp(rmsdName, "CH") ) rmsdType = CH; |
| 110 |
> |
else if( !strcmp(rmsdName, "CH2") )rmsdType = CH2; |
| 111 |
> |
else if( !strcmp(rmsdName, "CH3") )rmsdType = CH3; |
| 112 |
> |
else if( !strcmp(rmsdName, "SSD") )rmsdType = SSD; |
| 113 |
> |
else if( !strcmp(rmsdName, "COM") )rmsdType = COM; |
| 114 |
> |
else{ |
| 115 |
|
fprintf( stderr, |
| 116 |
< |
"\n" |
| 117 |
< |
"not enough arguments for --gofr\n"); |
| 96 |
< |
usage(); |
| 116 |
> |
"Unrecognized rmsd atom type \"%s\"\n", |
| 117 |
> |
rmsdName ); |
| 118 |
|
exit(0); |
| 119 |
< |
} |
| 99 |
< |
pair2 = argV[i]; |
| 119 |
> |
} |
| 120 |
|
|
| 121 |
|
} |
| 122 |
|
|
| 251 |
|
case 'l': |
| 252 |
|
// -l <double> set <double> to the maxLength |
| 253 |
|
|
| 254 |
< |
haveMaxLength = true; |
| 254 |
> |
haveMaxLength = 1; |
| 255 |
|
j++; |
| 256 |
|
currentFlag = argV[i][j]; |
| 257 |
|
|
| 312 |
|
break; |
| 313 |
|
|
| 314 |
|
case 's': |
| 315 |
< |
// -s turn on separate output files |
| 315 |
> |
// -s turn on Scd corr |
| 316 |
|
|
| 317 |
|
scdCorr = 1; |
| 318 |
|
break; |
| 319 |
|
|
| 320 |
+ |
case 'h': |
| 321 |
+ |
// -h turn on director head |
| 322 |
|
|
| 323 |
+ |
directorHead = 1; |
| 324 |
+ |
break; |
| 325 |
+ |
|
| 326 |
+ |
case 'w': |
| 327 |
+ |
// -w turn on director head |
| 328 |
+ |
|
| 329 |
+ |
directorWhole = 1; |
| 330 |
+ |
break; |
| 331 |
+ |
|
| 332 |
+ |
case 'g': |
| 333 |
+ |
// -g turn on gofZ |
| 334 |
+ |
|
| 335 |
+ |
doGofz = 1; |
| 336 |
+ |
break; |
| 337 |
+ |
|
| 338 |
+ |
case 'v': |
| 339 |
+ |
// -v turn on average XY |
| 340 |
+ |
|
| 341 |
+ |
doAvgXY = 1; |
| 342 |
+ |
break; |
| 343 |
+ |
|
| 344 |
+ |
|
| 345 |
|
default: |
| 346 |
|
|
| 347 |
< |
sprintf(painCave.errMsg, |
| 347 |
> |
fprintf( stderr, |
| 348 |
|
"\n" |
| 349 |
|
"Bad option \"-%c\"\n", currentFlag); |
| 350 |
|
usage(); |
| 380 |
|
exit(0); |
| 381 |
|
} |
| 382 |
|
|
| 383 |
+ |
if( outPrefix == NULL ) |
| 384 |
+ |
outPrefix = inName; |
| 385 |
|
|
| 386 |
+ |
|
| 387 |
|
// initialize the arrays |
| 388 |
|
|
| 389 |
|
for(i=0;i<nLipids;i++){ |
| 390 |
|
|
| 391 |
|
atoms[nLipAtoms*i+0].type = HEAD; |
| 392 |
+ |
atoms[nLipAtoms*i+0].mass = 72; |
| 393 |
|
atoms[nLipAtoms*i+0].u[0] = 0.0; |
| 394 |
|
atoms[nLipAtoms*i+0].u[1] = 0.0; |
| 395 |
|
atoms[nLipAtoms*i+0].u[2] = 1.0; |
| 396 |
|
|
| 397 |
+ |
|
| 398 |
|
|
| 399 |
|
atoms[nLipAtoms*i+1].type = CH2; |
| 400 |
+ |
atoms[nLipAtoms*i+1].mass = 14.03; |
| 401 |
|
|
| 402 |
|
atoms[nLipAtoms*i+2].type = CH; |
| 403 |
+ |
atoms[nLipAtoms*i+2].mass = 13.02; |
| 404 |
|
|
| 405 |
|
atoms[nLipAtoms*i+3].type = CH2; |
| 406 |
+ |
atoms[nLipAtoms*i+3].mass = 14.03; |
| 407 |
|
|
| 408 |
|
atoms[nLipAtoms*i+4].type = CH2; |
| 409 |
+ |
atoms[nLipAtoms*i+4].mass = 14.03; |
| 410 |
|
|
| 411 |
|
atoms[nLipAtoms*i+5].type = CH2; |
| 412 |
+ |
atoms[nLipAtoms*i+5].mass = 14.03; |
| 413 |
|
|
| 414 |
|
atoms[nLipAtoms*i+6].type = CH2; |
| 415 |
+ |
atoms[nLipAtoms*i+6].mass = 14.03; |
| 416 |
|
|
| 417 |
|
atoms[nLipAtoms*i+7].type = CH2; |
| 418 |
+ |
atoms[nLipAtoms*i+7].mass = 14.03; |
| 419 |
|
|
| 420 |
|
atoms[nLipAtoms*i+8].type = CH2; |
| 421 |
+ |
atoms[nLipAtoms*i+8].mass = 14.03; |
| 422 |
|
|
| 423 |
|
atoms[nLipAtoms*i+9].type = CH2; |
| 424 |
+ |
atoms[nLipAtoms*i+9].mass = 14.03; |
| 425 |
|
|
| 426 |
|
atoms[nLipAtoms*i+10].type = CH3; |
| 427 |
+ |
atoms[nLipAtoms*i+10].mass = 15.04; |
| 428 |
|
|
| 429 |
|
atoms[nLipAtoms*i+11].type = CH2; |
| 430 |
+ |
atoms[nLipAtoms*i+11].mass = 14.03; |
| 431 |
|
|
| 432 |
|
atoms[nLipAtoms*i+12].type = CH2; |
| 433 |
+ |
atoms[nLipAtoms*i+12].mass = 14.03; |
| 434 |
|
|
| 435 |
< |
atoms[nLipAtoms*i+13].type = CH2; |
| 435 |
> |
atoms[nLipAtoms*i+13].type = CH2; |
| 436 |
> |
atoms[nLipAtoms*i+13].mass = 14.03; |
| 437 |
|
|
| 438 |
|
atoms[nLipAtoms*i+14].type = CH2; |
| 439 |
+ |
atoms[nLipAtoms*i+14].mass = 14.03; |
| 440 |
|
|
| 441 |
|
atoms[nLipAtoms*i+15].type = CH2; |
| 442 |
+ |
atoms[nLipAtoms*i+15].mass = 14.03; |
| 443 |
|
|
| 444 |
|
atoms[nLipAtoms*i+16].type = CH2; |
| 445 |
+ |
atoms[nLipAtoms*i+16].mass = 14.03; |
| 446 |
|
|
| 447 |
|
atoms[nLipAtoms*i+17].type = CH2; |
| 448 |
+ |
atoms[nLipAtoms*i+17].mass = 14.03; |
| 449 |
|
|
| 450 |
|
atoms[nLipAtoms*i+18].type = CH3; |
| 451 |
+ |
atoms[nLipAtoms*i+18].mass = 15.04; |
| 452 |
|
} |
| 453 |
|
|
| 454 |
|
for(i=(nLipAtoms*nLipids);i<nAtoms;i++){ |
| 455 |
|
atoms[i].type = SSD; |
| 456 |
+ |
atoms[i].mass = 18.03; |
| 457 |
|
atoms[i].u[0] = 0.0; |
| 458 |
|
atoms[i].u[1] = 0.0; |
| 459 |
|
atoms[i].u[2] = 1.0; |
| 461 |
|
|
| 462 |
|
// read and set the frames |
| 463 |
|
|
| 464 |
< |
openFile( inName ); |
| 464 |
> |
openFile(); |
| 465 |
|
|
| 466 |
|
fprintf( stdout, |
| 467 |
|
"\n" |
| 469 |
|
inName ); |
| 470 |
|
fflush(stdout); |
| 471 |
|
|
| 472 |
< |
setFrames( inName ); |
| 472 |
> |
setFrames(); |
| 473 |
|
|
| 474 |
|
fprintf( stdout, |
| 475 |
|
"done.\n" |
| 476 |
< |
"nFrames = %d\n.", |
| 476 |
> |
"nFrames = %d.\n", |
| 477 |
|
nFrames ); |
| 478 |
|
fflush(stdout); |
| 479 |
|
|
| 483 |
|
"Calculating the Scd correlation\n" ); |
| 484 |
|
fflush( stdout ); |
| 485 |
|
|
| 486 |
< |
calcScdCorr( startTime ); |
| 486 |
> |
calcScdCorr( startTime, atoms, outPrefix ); |
| 487 |
|
} |
| 488 |
+ |
|
| 489 |
+ |
if(directorHead){ |
| 490 |
+ |
|
| 491 |
+ |
fprintf ( stdout, |
| 492 |
+ |
"Calculating the Head director\n" ); |
| 493 |
+ |
fflush( stdout ); |
| 494 |
+ |
|
| 495 |
+ |
calcDirHeadCorr( startTime, atoms, outPrefix ); |
| 496 |
+ |
} |
| 497 |
+ |
|
| 498 |
+ |
if(directorWhole){ |
| 499 |
+ |
|
| 500 |
+ |
fprintf ( stdout, |
| 501 |
+ |
"Calculating the bilayer director\n" ); |
| 502 |
+ |
fflush( stdout ); |
| 503 |
+ |
|
| 504 |
+ |
calcDirWholeCorr( startTime, atoms, outPrefix ); |
| 505 |
+ |
} |
| 506 |
+ |
|
| 507 |
+ |
if(doRMSD){ |
| 508 |
+ |
|
| 509 |
+ |
fprintf ( stdout, |
| 510 |
+ |
"Calculating the RMSD\n" ); |
| 511 |
+ |
fflush( stdout ); |
| 512 |
+ |
|
| 513 |
+ |
rmsd( rmsdType, startTime, outPrefix, rmsdName ); |
| 514 |
+ |
} |
| 515 |
+ |
|
| 516 |
+ |
if(doGofz){ |
| 517 |
+ |
|
| 518 |
+ |
fprintf ( stdout, |
| 519 |
+ |
"Calculating the gofZ\n" ); |
| 520 |
+ |
fflush( stdout ); |
| 521 |
+ |
|
| 522 |
+ |
calcGofz( startTime, atoms, outPrefix ); |
| 523 |
+ |
} |
| 524 |
+ |
|
| 525 |
+ |
if(doAvgXY){ |
| 526 |
+ |
|
| 527 |
+ |
fprintf ( stdout, |
| 528 |
+ |
"Calculating the average XY\n" ); |
| 529 |
+ |
fflush( stdout ); |
| 530 |
+ |
|
| 531 |
+ |
avgXY = calcAverageXY( startTime ); |
| 532 |
+ |
|
| 533 |
+ |
fprintf ( stdout, |
| 534 |
+ |
"Done, average XY = %6G\n", avgXY ); |
| 535 |
+ |
fflush( stdout ); |
| 536 |
+ |
|
| 537 |
+ |
} |
| 538 |
|
|
| 539 |
|
|
| 540 |
+ |
closeFile(); |
| 541 |
+ |
|
| 542 |
|
} |
| 543 |
|
|
| 544 |
|
|
| 560 |
|
" -l <maxLength> set the maximum value of r\n" |
| 561 |
|
" *Defaults to 1/2 smallest length of first frame.\n" |
| 562 |
|
" -s Calculate the Scd chain correlation.\n" |
| 563 |
+ |
" -h Calculate the directors for the head groups\n" |
| 564 |
+ |
" -w Calculate the director from the bilayers\n" |
| 565 |
+ |
" -g Calculate the gofz profile\n" |
| 566 |
|
"\n" |
| 567 |
|
" long:\n" |
| 568 |
|
" -----\n" |
| 569 |
< |
" --gofr <atom1> <atom2> g(r) for atom1 and atom2\n" |
| 569 |
> |
" --rmsd <atom1> rmsd for atom1\n" |
| 570 |
|
" --gofrTheta <atom1> <atom2> g(r, theta) for atom1 and atom2\n" |
| 571 |
|
" --gofrOmega <atom1> <atom2> g(r, omega) for atom1 and atom2\n" |
| 572 |
|
" --version displays the version number\n" |