ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/tcProps/tcProps.c
(Generate patch)

Comparing trunk/tcProps/tcProps.c (file contents):
Revision 1058 by mmeineke, Wed Feb 18 21:20:51 2004 UTC vs.
Revision 1080 by mmeineke, Wed Mar 3 15:16:15 2004 UTC

# Line 2 | Line 2
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
# Line 30 | Line 35 | int main( int argC, char *argV[] ){
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;
# Line 44 | Line 48 | int main( int argC, char *argV[] ){
48    char* pair2;
49    int scdCorr;
50    double startTime;
51 +  double maxLength;
52 +  int directorHead, directorWhole, doRMSD, doGofz;
53 +  enum atomNames rmsdType;
54  
55    // system initialization
56    
# Line 55 | Line 62 | int main( int argC, char *argV[] ){
62    outPrefix = NULL;
63    inName = NULL;
64    
65 +  haveMaxLength = 0;
66    conversionError = 0;
67    optionError = 0;
68    havePrefix = 0;
69    scdCorr = 0;
70    startTime = 0.0;
71 +  directorHead = 0;
72 +  directorWhole = 0;
73 +  doRMSD = 0;
74 +  doGofz = 0;
75    
76  
77    // parse the command line
# Line 76 | Line 88 | int main( int argC, char *argV[] ){
88  
89          // parse long word options
90          
91 <        if( !strcmp( argV[i], "--gofr" ) ){
91 >        if( !strcmp( argV[i], "--rmsd" ) ){
92  
93 +          doRMSD = 1;
94            i++;
95            if( i>=argC ){
96              fprintf( stderr,
97                       "\n"
98 <                     "not enough arguments for --gofr\n");
98 >                     "not enough arguments for --rmsd\n");
99              usage();
100              exit(0);
101            }      
102            pair1 = argV[i];
103  
104 <          i++;
105 <          if( i>=argC ){
104 >          if( !strcmp(pair1, "HEAD") )    rmsdType = HEAD;
105 >          else if( !strcmp(pair1, "CH") ) rmsdType = CH;
106 >          else if( !strcmp(pair1, "CH2") )rmsdType = CH2;
107 >          else if( !strcmp(pair1, "CH3") )rmsdType = CH3;
108 >          else if( !strcmp(pair1, "SSD") )rmsdType = SSD;
109 >          else if( !strcmp(pair1, "COM") )rmsdType = COM;
110 >          else{
111              fprintf( stderr,
112 <                     "\n"
113 <                     "not enough arguments for --gofr\n");
96 <            usage();
112 >                     "Unrecognized rmsd atom type \"%s\"\n",
113 >                     pair1 );
114              exit(0);
115 <          }      
99 <          pair2 = argV[i];
115 >          }
116  
117          }
118  
# Line 231 | Line 247 | int main( int argC, char *argV[] ){
247            case 'l':
248              // -l <double>    set <double> to the maxLength
249  
250 <            haveMaxLength = true;
250 >            haveMaxLength = 1;
251              j++;
252              currentFlag = argV[i][j];
253                
# Line 292 | Line 308 | int main( int argC, char *argV[] ){
308              break;
309  
310            case 's':
311 <            // -s turn on separate output files
311 >            // -s turn on Scd corr
312  
313              scdCorr = 1;
314 +            break;
315 +
316 +          case 'h':
317 +            // -h turn on director head
318 +
319 +            directorHead = 1;
320 +            break;
321 +
322 +          case 'w':
323 +            // -w turn on director head
324 +
325 +            directorWhole = 1;
326 +            break;
327 +
328 +          case 'g':
329 +            // -g turn on gofZ
330 +
331 +            doGofz = 1;
332              break;
333  
334  
335            default:
336  
337 <            sprintf(painCave.errMsg,
337 >            fprintf( stderr,
338                      "\n"
339                      "Bad option \"-%c\"\n", currentFlag);
340              usage();
# Line 336 | Line 370 | int main( int argC, char *argV[] ){
370      exit(0);
371    }
372  
373 +  if( outPrefix == NULL )
374 +    outPrefix = inName;
375  
376 +
377    // initialize the arrays
378  
379    for(i=0;i<nLipids;i++){
380  
381      atoms[nLipAtoms*i+0].type = HEAD;
382 +    atoms[nLipAtoms*i+0].mass = 72;
383      atoms[nLipAtoms*i+0].u[0] = 0.0;
384      atoms[nLipAtoms*i+0].u[1] = 0.0;
385      atoms[nLipAtoms*i+0].u[2] = 1.0;
386      
387 +    
388  
389      atoms[nLipAtoms*i+1].type = CH2;
390 +    atoms[nLipAtoms*i+1].mass = 14.03;
391  
392      atoms[nLipAtoms*i+2].type = CH;
393 +    atoms[nLipAtoms*i+2].mass = 13.02;
394  
395      atoms[nLipAtoms*i+3].type = CH2;
396 +    atoms[nLipAtoms*i+3].mass = 14.03;
397  
398      atoms[nLipAtoms*i+4].type = CH2;
399 +    atoms[nLipAtoms*i+4].mass = 14.03;
400  
401      atoms[nLipAtoms*i+5].type = CH2;
402 +    atoms[nLipAtoms*i+5].mass = 14.03;
403  
404      atoms[nLipAtoms*i+6].type = CH2;
405 +    atoms[nLipAtoms*i+6].mass = 14.03;
406  
407      atoms[nLipAtoms*i+7].type = CH2;
408 +    atoms[nLipAtoms*i+7].mass = 14.03;
409  
410      atoms[nLipAtoms*i+8].type = CH2;
411 +    atoms[nLipAtoms*i+8].mass = 14.03;
412  
413      atoms[nLipAtoms*i+9].type = CH2;
414 +    atoms[nLipAtoms*i+9].mass = 14.03;
415  
416      atoms[nLipAtoms*i+10].type = CH3;
417 +    atoms[nLipAtoms*i+10].mass = 15.04;
418  
419      atoms[nLipAtoms*i+11].type = CH2;
420 +    atoms[nLipAtoms*i+11].mass = 14.03;
421  
422      atoms[nLipAtoms*i+12].type = CH2;
423 +    atoms[nLipAtoms*i+12].mass = 14.03;
424  
425 <    atoms[nLipAtoms*i+13].type = CH2;
425 >    atoms[nLipAtoms*i+13].type = CH2;    
426 >    atoms[nLipAtoms*i+13].mass = 14.03;
427  
428      atoms[nLipAtoms*i+14].type = CH2;
429 +    atoms[nLipAtoms*i+14].mass = 14.03;
430    
431      atoms[nLipAtoms*i+15].type = CH2;
432 +    atoms[nLipAtoms*i+15].mass = 14.03;
433    
434      atoms[nLipAtoms*i+16].type = CH2;
435 +    atoms[nLipAtoms*i+16].mass = 14.03;
436    
437      atoms[nLipAtoms*i+17].type = CH2;
438 +    atoms[nLipAtoms*i+17].mass = 14.03;
439    
440      atoms[nLipAtoms*i+18].type = CH3;
441 +    atoms[nLipAtoms*i+18].mass = 15.04;
442    }
443    
444    for(i=(nLipAtoms*nLipids);i<nAtoms;i++){
445      atoms[i].type = SSD;
446 +    atoms[i].mass = 18.03;
447      atoms[i].u[0] = 0.0;
448      atoms[i].u[1] = 0.0;
449      atoms[i].u[2] = 1.0;
# Line 393 | Line 451 | int main( int argC, char *argV[] ){
451  
452    // read and set the frames
453    
454 <  openFile( inName );
454 >  openFile();
455  
456    fprintf( stdout,
457             "\n"
# Line 401 | Line 459 | int main( int argC, char *argV[] ){
459             inName );
460    fflush(stdout);
461  
462 <  setFrames( inName );
462 >  setFrames();
463    
464    fprintf( stdout,
465             "done.\n"
466 <           "nFrames = %d\n.",
466 >           "nFrames = %d.\n",
467             nFrames );
468    fflush(stdout);
469  
# Line 415 | Line 473 | int main( int argC, char *argV[] ){
473                "Calculating the Scd correlation\n" );
474      fflush( stdout );
475      
476 <    calcScdCorr( startTime );
476 >    calcScdCorr( startTime, atoms, outPrefix );
477    }
478 +
479 +  if(directorHead){
480 +
481 +    fprintf ( stdout,
482 +              "Calculating the Head director\n" );
483 +    fflush( stdout );
484 +    
485 +    calcDirHeadCorr( startTime, atoms, outPrefix );
486 +  }
487 +
488 +  if(directorWhole){
489 +
490 +    fprintf ( stdout,
491 +              "Calculating the bilayer director\n" );
492 +    fflush( stdout );
493 +    
494 +    calcDirWholeCorr( startTime, atoms, outPrefix );
495 +  }
496 +
497 +  if(doRMSD){
498 +
499 +    fprintf ( stdout,
500 +              "Calculating the RMSD\n" );
501 +    fflush( stdout );
502 +    
503 +    rmsd( rmsdType, startTime, outPrefix );
504 +  }
505 +
506 +  if(doGofz){
507 +
508 +    fprintf ( stdout,
509 +              "Calculating the gofZ\n" );
510 +    fflush( stdout );
511 +    
512 +    calcGofz( startTime, atoms, outPrefix );
513 +  }
514    
515  
516 +  closeFile();
517 +
518   }
519  
520  
# Line 440 | Line 536 | void usage(){
536                  "   -l <maxLength>  set the maximum value of r\n"
537                  "                     *Defaults to 1/2 smallest length of first frame.\n"
538                  "   -s              Calculate the Scd chain correlation.\n"
539 +                "   -h              Calculate the directors for the head groups\n"
540 +                "   -w              Calculate the director from the bilayers\n"
541 +                "   -g              Calculate the gofz profile\n"
542                  "\n"
543                  "   long:\n"
544                  "   -----\n"
545 <                "   --gofr <atom1> <atom2>         g(r) for atom1 and atom2\n"
545 >                "   --rmsd <atom1>                 rmsd for atom1\n"
546                  "   --gofrTheta <atom1> <atom2>    g(r, theta) for atom1 and atom2\n"
547                  "   --gofrOmega <atom1> <atom2>    g(r, omega) for atom1 and atom2\n"
548                  "   --version                      displays the version number\n"

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines