45 |
|
delete[] avgGofRtheta[i]; |
46 |
|
} |
47 |
|
|
48 |
< |
delete[] currHist; |
48 |
> |
delete[] currCosHist; |
49 |
|
delete[] currGofRtheta; |
50 |
|
delete[] avgGofRtheta; |
51 |
|
} |
52 |
|
|
53 |
|
void GofRtheta::correlate( double Rij[3], double dist, |
54 |
|
double uHatI[3], double uHatJ[3] ){ |
55 |
< |
int bin, binTheta, i; |
55 |
> |
int binR, binTheta, i; |
56 |
|
double dot, cosTheta; |
57 |
|
double halfNbins; |
58 |
|
|
62 |
|
|
63 |
|
dot= 0.0; |
64 |
|
for(i=0;i<3;i++) |
65 |
< |
dot += rij[i] * uHatI[i]; |
65 |
> |
dot += Rij[i] * uHatI[i]; |
66 |
|
|
67 |
|
cosTheta = dot / dist; |
68 |
|
|
69 |
< |
bin = (int)( dist / delR ); |
70 |
< |
if( bin < nBins ){ |
69 |
> |
binR = (int)( dist / delR ); |
70 |
> |
if( binR < nBins ){ |
71 |
|
|
72 |
|
halfNbins = (nBins-1) * 0.5; |
73 |
< |
binTheta = (int)( (dot * halfNbins) + halfNbins ); |
73 |
> |
binTheta = (int)( (cosTheta * halfNbins) + halfNbins ); |
74 |
|
|
75 |
< |
currCosHist[bin][binTheta] += 1; |
75 |
> |
currCosHist[binR][binTheta] += 1; |
76 |
|
} |
77 |
+ |
} |
78 |
+ |
else{ |
79 |
+ |
|
80 |
+ |
sprintf( painCave.errMsg, |
81 |
+ |
"GofRtheta error: atom \"%s\" does not have a " |
82 |
+ |
"directional component\n", |
83 |
+ |
atom1 |
84 |
+ |
); |
85 |
+ |
painCave.isFatal = 1; |
86 |
+ |
simError(); |
87 |
|
} |
88 |
|
} |
89 |
|
} |
90 |
|
|
91 |
|
void GofRtheta::accumulateFrame( void ){ |
92 |
< |
int i; |
92 |
> |
int i,j; |
93 |
|
double rLower, rUpper, volSlice; |
94 |
|
double nIdeal; |
95 |
|
|
105 |
|
|
106 |
|
for(j=0;j<nBins;j++){ |
107 |
|
|
108 |
< |
currGofRtheta[i][j] = (currCosHist[i][j] / nIdeal) * nBins; |
108 |
> |
currGofRtheta[i][j] = (currCosHist[i][j] / nIdeal); |
109 |
|
currCosHist[i][j] = 0; |
110 |
|
|
111 |
|
avgGofRtheta[i][j] += currGofRtheta[i][j]; |
119 |
|
double rValue, cosValue, deltaCos, corrValue; |
120 |
|
double rLower, rUpper, volSlice; |
121 |
|
double nIdeal; |
122 |
< |
int i; |
122 |
> |
int i, j; |
123 |
|
char outName[200]; |
124 |
|
|
125 |
|
sprintf( outName, |
150 |
|
|
151 |
|
cosValue = -1 + (j * deltaCos); |
152 |
|
|
153 |
< |
corrValue = avgGofRtheta[i] / nFrames; |
153 |
> |
corrValue = avgGofRtheta[i][j] / nFrames; |
154 |
|
|
155 |
|
outStream << rValue << "; " << cosValue << "; " << corrValue << "\n"; |
156 |
|
} |