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; |
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 ){ |
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 |
|
} |
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; |
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; |