ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/props/GofR.cpp
(Generate patch)

Comparing trunk/OOPSE/props/GofR.cpp (file contents):
Revision 801 by mmeineke, Fri Sep 12 20:51:29 2003 UTC vs.
Revision 802 by mmeineke, Thu Oct 9 22:09:52 2003 UTC

# Line 8 | Line 8 | using namespace std;
8  
9   using namespace std;
10  
11 < GofR::GofR( char* key1, char* key2, int theNatoms ):
12 <  PairCorrType(  key1, key2, theNatoms )
11 > GofR::GofR( char* key1, char* key2, int theNatoms, int theNbins ):
12 >  PairCorrType(  key1, key2, theNatoms, theNbins )
13   {
14    int i;
15    
16    strcpy( corrType, "GofR" );
17    
18 <  for(i=0;i<N_BINS;i++){
18 >  currHist = new int[nBins];
19 >  currGofR = new double[nBins];
20 >  avgGofR  = new double[nBins];
21 >
22 >  for(i=0;i<nBins;i++){
23      currHist[i] = 0;
24      currGofR[i] = 0.0;
25      avgGofR[i]  = 0.0;
# Line 24 | Line 28 | GofR::GofR( char* key1, char* key2, int theNatoms ):
28    nFrames = 0;
29   }
30  
31 + GofR::~GofR(){
32  
33 +  delete[] currHist;
34 +  delete[] currGofR;
35 +  delete[] avgGofR;
36 + }
37  
38   void GofR::correlate( double[3] Rij, double dist,
39                        double[3] uHatI, double[3] uHatJ ){
# Line 33 | Line 42 | void GofR::correlate( double[3] Rij, double dist,
42    if( correlateMe ){
43      
44      bin = (int)( dist / delR );
45 <    if( bin < N_BINS )currHist[bin] += 2;
45 >    if( bin < nBins )currHist[bin] += 2;
46      
47    }
48   }
# Line 45 | Line 54 | void GofR::accumulateFrame( void ){
54  
55    nFrames++;
56    
57 <  for(i=0;i<N_BINS;i++){
57 >  for(i=0;i<nBins;i++){
58  
59      rLower = i * delR;
60      rUpper = rLower + delR;
# Line 85 | Line 94 | void GofR::writeCorr( char* outPrefix ){
94  
95    outStream << "#rValue\tcorrValue\n"
96  
97 <  for(i=0;i<N_BINS;i++){
97 >  for(i=0;i<nBins;i++){
98      
99      rValue = ( i + 0.5 ) * delR;
100      corrValue = avgGofR[i] / nFrames;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines