46 |
|
|
47 |
|
namespace oopse { |
48 |
|
|
49 |
< |
GofRAngle::GofRAngle(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2) |
50 |
< |
: RadialDistrFunc(info, filename, sele1, sele2){ |
49 |
> |
GofRAngle::GofRAngle(SimInfo* info, const std::string& filename, const std::string& sele1, |
50 |
> |
const std::string& sele2, double len, int nrbins, int nangleBins) |
51 |
> |
: RadialDistrFunc(info, filename, sele1, sele2), len_(len), nRBins_(nrbins), nAngleBins_(nangleBins){ |
52 |
|
|
53 |
+ |
deltaR_ = len_ /nRBins_; |
54 |
+ |
deltaCosAngle_ = 2.0 / nAngleBins_; |
55 |
+ |
|
56 |
+ |
histogram_.resize(nRBins_); |
57 |
+ |
avgGofr_.resize(nRBins_); |
58 |
+ |
for (int i = 0 ; i < nRBins_; ++i) { |
59 |
+ |
histogram_[i].resize(nAngleBins_); |
60 |
+ |
avgGofr_[i].resize(nAngleBins_); |
61 |
+ |
} |
62 |
|
} |
63 |
|
|
64 |
|
|
105 |
|
|
106 |
|
Vector3d pos1 = sd1->getPos(); |
107 |
|
Vector3d pos2 = sd2->getPos(); |
108 |
< |
Vector3d r12 = pos1 - pos2; |
108 |
> |
Vector3d r12 = pos2 - pos1; |
109 |
|
currentSnapshot_->wrapVector(r12); |
110 |
|
|
111 |
|
double distance = r12.length(); |
127 |
|
rdfStream << "#radial distribution function\n"; |
128 |
|
rdfStream << "#selection1: (" << selectionScript1_ << ")\t"; |
129 |
|
rdfStream << "selection2: (" << selectionScript2_ << ")\n"; |
130 |
< |
rdfStream << "#r\tcorrValue\n"; |
130 |
> |
rdfStream << "#nRBins = " << nRBins_ << "\t maxLen = " << len_ << "deltaR = " << deltaR_ <<"\n"; |
131 |
> |
rdfStream << "#nAngleBins =" << nAngleBins_ << "deltaCosAngle = " << deltaCosAngle_ << "\n"; |
132 |
|
for (int i = 0; i < avgGofr_.size(); ++i) { |
133 |
|
double r = deltaR_ * (i + 0.5); |
134 |
|
|
135 |
|
for(int j = 0; j < avgGofr_[i].size(); ++j) { |
136 |
< |
double cosAngle = -1.0 + (i + 0.5)*deltaCosAngle_; |
137 |
< |
rdfStream << r << "\t" << cosAngle << "\t" << avgGofr_[i][j]/nProcessed_ << "\n"; |
136 |
> |
double cosAngle = -1.0 + (j + 0.5)*deltaCosAngle_; |
137 |
> |
rdfStream << avgGofr_[i][j]/nProcessed_ << "\t"; |
138 |
|
} |
139 |
+ |
|
140 |
+ |
rdfStream << "\n"; |
141 |
|
} |
142 |
|
|
143 |
|
} else { |
144 |
< |
|
145 |
< |
|
144 |
> |
sprintf(painCave.errMsg, "GofRAngle: unable to open %s\n", outputFilename_.c_str()); |
145 |
> |
painCave.isFatal = 1; |
146 |
> |
simError(); |
147 |
|
} |
148 |
|
|
149 |
|
rdfStream.close(); |
152 |
|
double GofRTheta::evaluateAngle(StuntDouble* sd1, StuntDouble* sd2) { |
153 |
|
Vector3d pos1 = sd1->getPos(); |
154 |
|
Vector3d pos2 = sd2->getPos(); |
155 |
< |
Vector3d r12 = pos1 - pos2; |
155 |
> |
Vector3d r12 = pos2 - pos1; |
156 |
|
currentSnapshot_->wrapVector(r12); |
157 |
|
r12.normalize(); |
158 |
|
Vector3d dipole = sd1->getElectroFrame().getColumn(2); |