--- trunk/commandLine/commandLine.c 2003/05/05 21:35:19 518 +++ trunk/commandLine/commandLine.c 2003/05/05 22:01:36 520 @@ -1,60 +1,28 @@ #include #include #include -#include -#include "madProps.h" -#include "frameCount.h" - char *program_name; /*the name of the program */ - void usage(void); int main(argc, argv) int argc; char *argv[]; { - - - struct xyz_frame *dumpArray; - int nFrames; // the nu8mvber of frames - int lineNum = 0; // keeps track of the line number - int n_atoms; // the number of atoms int i,j; // loop counters - int isFirst; - char read_buffer[2000]; /*the line buffer for reading */ - char *foo; /*the pointer to the current string token */ - FILE *in_file; /* the input file */ - char *in_name = NULL; /*the name of the input file */ - char *out_prefix; // the output prefix - char current_flag; // used in parseing the flags - - - + char *in_name = NULL; // name of the input file + char* out_prefix = NULL; // the output prefix + char current_flag; // used in parsing the flags int done = 0; // multipurpose boolean - int have_prefix = 0; // prefix boolean - int calcRMSD = 0; + int have_prefix; // boolean for the output prefix - int calcGofR = 0; - char gofR1[30]; - char gofR2[30]; - - int calcMuCorr = 0; - char muCorr[30]; - - int calcCosCorr = 0; - char cosCorr1[30]; - char cosCorr2[30]; - - int startFrame = 0; - int haveStartFrame = 0; - int endFrame = 0; - int haveEndFrame = 0; - - program_name = argv[0]; /*save the program name in case we need it*/ + // here we set the name of the program need by the usage message + program_name = argv[0]; + + for( i = 1; i < argc; i++){ if(argv[i][0] =='-'){ @@ -178,295 +146,33 @@ int main(argc, argv) } if( !have_prefix ) out_prefix = in_name; - - printf( "Counting number of frames..." ); - fflush( stdout ); - - nFrames = frameCount( in_name ); - if( !haveEndFrame ) endFrame = nFrames; - - printf( "done.\n" - "nframes = %d\n" - "\n", - nFrames ); - fflush( stdout ); - - in_file = fopen(in_name, "r"); - if(in_file == NULL){ - printf("Cannot open file: %s\n", in_name); - exit(8); - } - - // create and initialize the array of frames - - dumpArray = (struct xyz_frame*)calloc( nFrames, - sizeof( struct xyz_frame ) ); - for( i=0; i\n" + "The proper usage is: %s [options] \n" "\n" "Options:\n" "\n" " short:\n" " ------\n" " -h Display this message\n" - " -o The output prefix\n" - " -r Calculate the RMSD\n" - " -g Calculate all to all g(r)\n" + " -o The output name/prefix\n" + " -r the r flag\n" + " -i <#> set number to <#>\n" "\n" " long:\n" " -----\n" - " --GofR Calculates g(r) between atom1 and atom 2\n" - " -note: \"all\" will do all atoms\n" - " --MuCorr Calculate mu correlation of atom\n" - " --CosCorr Calculate the cos correlation between atom1 and atom2\n" - " --startFrame Specifies a frame to start correlating\n" - " --endFrame Specifies a frame to stop correlating.\n" + " --flag1 does flag 1 for arg1 and 2\n" + " --flag2 does flag 2 for arg1\n" + " --flag3 does flag 3\n" "\n" "\n",