--- trunk/tcProps/rmsd.c 2004/02/27 20:39:17 1072 +++ trunk/tcProps/rmsd.c 2004/02/28 16:45:57 1073 @@ -17,10 +17,19 @@ strcut frameStruct* myFrames; double Hmat[3][3]; }; -strcut frameStruct* myFrames; +struct binStruct{ + double rmsd; + int nValues; +}; -void rmsd(double startTime, char* outPrefix ){ +struct binStruct rmsdCorr[RMSDBINS]; +struct frameStruct* myFrames; + +void calcRMSDpair( int bin, int i, int j, enum atomNames rType ); + +void rmsd( enum atomNames rType, double startTime, char* outPrefix ){ + // list of 'a priori' constants const int nLipAtoms = NL_ATOMS; @@ -32,12 +41,20 @@ void rmsd(double startTime, char* outPrefix ){ // variables char outName[500]; + FILE* outFile; + int i, j, k; int startFrame, corrFrames, framesFinished; int startFound, percentComplete; - + int index; + int nCounts; + int bin; + double Hmat[3][3]; + double diffTime; + double rmsdDt; + double timeOut, outVal; framesFinished = 0; @@ -64,3 +81,191 @@ void rmsd(double startTime, char* outPrefix ){ corrFrames = nFrames - startFrame; myFrames = (struct frameStruct*)calloc(corrFrames, sizeof(struct frameStruct)); + + index=0; + for(i=startFrame;i= corrFrames ){ + fprintf( stderr, + "Error, number of frames, %d, exceeds corrFrames, %d.\n", + index, + corrFrames ); + } + + myFrames[index].time = frameTimes[i]; + readFrame(i, myFrames[index].atoms, myFrames[index].Hmat ); + } + + // initialize the counts and the correlation + + nCounts = 0; + for(i=0;i<(corrFrames-1);i++) + for(j=i+1;j 0.0 ){ + + percentComplete = + (int)( 100.0 * (double)index / (double) nCounts ); + + fprintf( stdout, + "\rRMSD corr %3d%% complete.", + percentComplete ); + fflush( stdout ); + + bin = (int)(diffTime / rmsdDt); + if( bin < RMSDBINS) + calcRMSDpair( bin, i, j, rType ); + } + + index++; + } + } + + // print out the correlation + + sprintf( outName, "%s.rmsd", outPrefix ); + outFile = fopen( outName, "w" ); + + fprintf( outFile, + "#time\trmsd\n"); + + for(i=0;i