| 17 |
|
int nFrames; |
| 18 |
|
double *frameTimes; |
| 19 |
|
FILE* inFile; |
| 20 |
+ |
char* inName; |
| 21 |
|
|
| 21 |
– |
|
| 22 |
|
struct linkedPos{ |
| 23 |
|
|
| 24 |
|
fpos_t *myPos; |
| 39 |
|
void setU( double q[4], double u[3] ); |
| 40 |
|
void normalizeQ( double q[4] ); |
| 41 |
|
|
| 42 |
< |
void openFile( char* inName ){ |
| 42 |
> |
void openFile( void ){ |
| 43 |
|
|
| 44 |
< |
inFile = fopen(inName); |
| 44 |
> |
inFile = fopen(inName, "r"); |
| 45 |
|
if(inFile ==NULL){ |
| 46 |
|
fprintf(stderr, |
| 47 |
|
"Error opening file \"%s\"\n", |
| 59 |
|
fileOpen = 0; |
| 60 |
|
} |
| 61 |
|
|
| 62 |
< |
int setFrames( void ){ |
| 62 |
> |
void setFrames( void ){ |
| 63 |
|
|
| 64 |
|
int i,j,k; |
| 65 |
|
struct linkedPos* headPos; |
| 81 |
|
nFrames = 0; |
| 82 |
|
headPos = (struct linkedPos*)malloc(sizeof(struct linkedPos)); |
| 83 |
|
currPos = headPos; |
| 84 |
+ |
|
| 85 |
+ |
currPT = (fpos_t *)malloc(sizeof(fpos_t)); |
| 86 |
+ |
fgetpos(inFile, currPT); |
| 87 |
+ |
|
| 88 |
+ |
fgets( readBuffer, sizeof( readBuffer ), inFile ); |
| 89 |
+ |
lineNum++; |
| 90 |
+ |
if( feof( inFile ) ){ |
| 91 |
+ |
fprintf( stderr, |
| 92 |
+ |
"File \"%s\" ended unexpectedly at line %d\n", |
| 93 |
+ |
inName, |
| 94 |
+ |
lineNum ); |
| 95 |
+ |
exit(0); |
| 96 |
+ |
} |
| 97 |
+ |
|
| 98 |
|
while( !feof( inFile ) ){ |
| 99 |
|
|
| 86 |
– |
currPT = (fpos_t *)malloc(sizeof(fpos_t)); |
| 87 |
– |
fgetpos(inFile, currPT); |
| 88 |
– |
|
| 89 |
– |
fgets( readBuffer, sizeof( readBuffer ), inFile ); |
| 90 |
– |
lineNum++; |
| 91 |
– |
if( feof( inFile ) ){ |
| 92 |
– |
fprintf( stderr, |
| 93 |
– |
"File \"%s\" ended unexpectedly at line %d\n", |
| 94 |
– |
inName, |
| 95 |
– |
lineNum ); |
| 96 |
– |
exit(0); |
| 97 |
– |
} |
| 98 |
– |
|
| 100 |
|
currPos->next = (struct linkedPos*)malloc(sizeof(struct linkedPos)); |
| 101 |
|
currPos = currPos->next; |
| 102 |
|
currPos->myPos = currPT; |
| 230 |
|
exit(0); |
| 231 |
|
} |
| 232 |
|
} |
| 233 |
+ |
|
| 234 |
+ |
currPT = (fpos_t *)malloc(sizeof(fpos_t)); |
| 235 |
+ |
fgetpos(inFile, currPT); |
| 236 |
+ |
|
| 237 |
+ |
fgets( readBuffer, sizeof( readBuffer ), inFile ); |
| 238 |
+ |
lineNum++; |
| 239 |
|
} |
| 240 |
|
|
| 241 |
|
// allocate the static position array |
| 310 |
|
if( !fileOpen ){ |
| 311 |
|
|
| 312 |
|
fprintf( stderr, |
| 313 |
< |
"File is closed, cannot read frame %d.\n" |
| 313 |
> |
"File is closed, cannot read frame %d.\n", |
| 314 |
|
theFrame ); |
| 315 |
|
exit(0); |
| 316 |
|
} |
| 318 |
|
// access the frame |
| 319 |
|
|
| 320 |
|
framePos = posArray[theFrame].myPos; |
| 321 |
< |
fsetPos( inFile, framePos ); |
| 321 |
> |
fsetpos( inFile, framePos ); |
| 322 |
|
|
| 323 |
|
for(j=0;j<3;j++){ |
| 324 |
|
for(k=0;k<3;k++){ |
| 377 |
|
|
| 378 |
|
void parseDumpLine( char readLine[BUFFER_SIZE], int i, |
| 379 |
|
struct atomCoord* atoms ){ |
| 380 |
+ |
|
| 381 |
+ |
const int nLipAtoms = NL_ATOMS; |
| 382 |
+ |
const int nBonds = NBONDS; |
| 383 |
+ |
const int nLipids = NLIPIDS; |
| 384 |
+ |
const int nSSD = NSSD; |
| 385 |
+ |
const int nAtoms = nLipAtoms * nLipids + nSSD; |
| 386 |
+ |
|
| 387 |
|
char* foo; |
| 388 |
|
double q[4]; |
| 389 |
|
|
| 398 |
|
case HEAD: |
| 399 |
|
if( strcmp(foo, "HEAD") ){ |
| 400 |
|
fprintf( stderr, |
| 401 |
< |
"Atom %s does not match master array type \"HEAD\".\n" |
| 401 |
> |
"Atom %s does not match master array type \"HEAD\".\n", |
| 402 |
|
foo ); |
| 403 |
|
exit(0); |
| 404 |
|
} |
| 407 |
|
case CH: |
| 408 |
|
if( strcmp(foo, "CH") ){ |
| 409 |
|
fprintf( stderr, |
| 410 |
< |
"Atom %s does not match master array type \"CH\".\n" |
| 410 |
> |
"Atom %s does not match master array type \"CH\".\n", |
| 411 |
|
foo ); |
| 412 |
|
exit(0); |
| 413 |
|
} |
| 416 |
|
case CH2: |
| 417 |
|
if( strcmp(foo, "CH2") ){ |
| 418 |
|
fprintf( stderr, |
| 419 |
< |
"Atom %s does not match master array type \"CH2\".\n" |
| 419 |
> |
"Atom %s does not match master array type \"CH2\".\n", |
| 420 |
|
foo ); |
| 421 |
|
exit(0); |
| 422 |
|
} |
| 425 |
|
case CH3: |
| 426 |
|
if( strcmp(foo, "CH3") ){ |
| 427 |
|
fprintf( stderr, |
| 428 |
< |
"Atom %s does not match master array type \"CH3\".\n" |
| 428 |
> |
"Atom %s does not match master array type \"CH3\".\n", |
| 429 |
|
foo ); |
| 430 |
|
exit(0); |
| 431 |
|
} |
| 434 |
|
case SSD: |
| 435 |
|
if( strcmp(foo, "SSD") ){ |
| 436 |
|
fprintf( stderr, |
| 437 |
< |
"Atom %s does not match master array type \"SSD\".\n" |
| 437 |
> |
"Atom %s does not match master array type \"SSD\".\n", |
| 438 |
|
foo ); |
| 439 |
|
exit(0); |
| 440 |
|
} |
| 519 |
|
|
| 520 |
|
foo = strtok(NULL, " ,;\t"); |
| 521 |
|
if(foo == NULL){ |
| 522 |
< |
sprintf(painCave.errMsg, |
| 523 |
< |
"error in reading quaternion 0 from %s\n" |
| 524 |
< |
"natoms = %d, i = %d\n", |
| 525 |
< |
inName, nAtoms, i ); |
| 522 |
> |
fprintf( stderr, |
| 523 |
> |
"error in reading quaternion 0 from %s\n" |
| 524 |
> |
"natoms = %d, i = %d\n", |
| 525 |
> |
inName, nAtoms, i ); |
| 526 |
|
exit(0); |
| 527 |
|
} |
| 528 |
|
q[0] = atof( foo ); |
| 569 |
|
double q0Sqr, q1Sqr, q2Sqr, q3Sqr; |
| 570 |
|
double A[3][3]; |
| 571 |
|
double rb[3]; |
| 572 |
+ |
int i,j,k; |
| 573 |
|
|
| 574 |
|
// initialize the axis |
| 575 |
|
|
| 619 |
|
for(i=0;i<4;i++) |
| 620 |
|
q[i] /= qSqr; |
| 621 |
|
} |
| 622 |
+ |
|
| 623 |
+ |
double scanSmallestZ(int startFrame){ |
| 624 |
+ |
double smallest; |
| 625 |
+ |
int i; |
| 626 |
+ |
|
| 627 |
+ |
smallest = posArray[startFrame].Hmat[2][2]; |
| 628 |
+ |
for(i=startFrame;i<nFrames;i++) |
| 629 |
+ |
smallest = |
| 630 |
+ |
(smallest<posArray[i].Hmat[2][2])? smallest : posArray[i].Hmat[2][2]; |
| 631 |
+ |
|
| 632 |
+ |
return smallest; |
| 633 |
+ |
} |
| 634 |
+ |
|
| 635 |
+ |
double calcAverageXY( double startTime ){ |
| 636 |
+ |
|
| 637 |
+ |
int i, count, startFrame, startFound; |
| 638 |
+ |
double avg; |
| 639 |
+ |
|
| 640 |
+ |
startFound = 0; |
| 641 |
+ |
startFrame = -1; |
| 642 |
+ |
while( !startFound ){ |
| 643 |
+ |
|
| 644 |
+ |
startFrame++; |
| 645 |
+ |
|
| 646 |
+ |
if(startFrame >= nFrames){ |
| 647 |
|
|
| 648 |
+ |
fprintf( stderr, |
| 649 |
+ |
"Start Time, %G, was not found in the dump file.\n", |
| 650 |
+ |
startTime ); |
| 651 |
+ |
exit(0); |
| 652 |
+ |
} |
| 653 |
+ |
|
| 654 |
+ |
if(startTime <= frameTimes[startFrame]) |
| 655 |
+ |
startFound = 1; |
| 656 |
+ |
|
| 657 |
+ |
|
| 658 |
+ |
} |
| 659 |
+ |
|
| 660 |
+ |
avg = 0.0; |
| 661 |
+ |
count = 0; |
| 662 |
+ |
for(i=startFrame;i<nFrames;i++){ |
| 663 |
+ |
avg += posArray[i].Hmat[0][0] * posArray[i].Hmat[1][1]; |
| 664 |
+ |
count++; |
| 665 |
+ |
} |
| 666 |
+ |
avg /= (double)count; |
| 667 |
+ |
|
| 668 |
+ |
return avg; |
| 669 |
+ |
} |