--- trunk/src/applications/staticProps/GofRAngle.cpp 2005/02/10 14:15:52 309 +++ trunk/src/applications/staticProps/GofRAngle.cpp 2005/02/10 22:37:21 311 @@ -46,18 +46,17 @@ namespace oopse { namespace oopse { -GofRAngle::GofRAngle(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, double len) - : RadialDistrFunc(info, filename, sele1, sele2, len){ +GofRAngle::GofRAngle(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2) + : RadialDistrFunc(info, filename, sele1, sele2){ - histogram_.resize(nbins_); - avgGofr_.resize(nbins_); } void GofRAngle::preProcess() { - avgGofr_.resize(nbins_); - for (int i = 0; i < avgGofr_.size(); ++i) + + for (int i = 0; i < avgGofr_.size(); ++i) { std::fill(avgGofr_[i].begin(), avgGofr_[i].end(), 0); + } } void GofRAngle::initalizeHistogram() { @@ -71,7 +70,7 @@ void GofRAngle::processHistogram() { double volume = info_->getSnapshotManager()->getCurrentSnapshot()->getVolume(); double pairDensity = npairs_ /volume; - double pairConstant = ( 4.0 * PI * pairDensity ) / 3.0; + double pairConstant = ( 4.0 * NumericConstant::PI * pairDensity ) / 3.0; for(int i = 0 ; i < histogram_.size(); ++i){ @@ -99,13 +98,15 @@ void GofRAngle::collectHistogram(StuntDouble* sd1, Stu currentSnapshot_->wrapVector(r12); double distance = r12.length(); - int whichBin = distance / deltaR_; + int whichRBin = distance / deltaR_; double cosAngle = evaluateAngle(sd1, sd2); - histogram_[whichBin] ++; + double halfBin = (nAngleBins_ - 1) * 0.5; + int whichThetaBin = halfBin * (cosAngle + 1.0); + ++histogram_[whichRBin][whichThetaBin]; - npairs_++; + ++npairs_; } void GofRAngle::writeRdf() { @@ -119,7 +120,7 @@ void GofRAngle::writeRdf() { double r = deltaR_ * (i + 0.5); for(int j = 0; j < avgGofr_[i].size(); ++j) { - double cosAngle = ; + double cosAngle = -1.0 + (i + 0.5)*deltaCosAngle_; rdfStream << r << "\t" << cosAngle << "\t" << avgGofr_[i][j]/nProcessed_ << "\n"; } } @@ -132,24 +133,23 @@ void GofRAngle::writeRdf() { rdfStream.close(); } - - double GofRTheta::evaluateAngle(StuntDouble* sd1, StuntDouble* sd2) { Vector3d pos1 = sd1->getPos(); Vector3d pos2 = sd2->getPos(); Vector3d r12 = pos1 - pos2; currentSnapshot_->wrapVector(r12); r12.normalize(); - Vector3d dipole = sd1->getElectroFrame().getColumn(2)£» + Vector3d dipole = sd1->getElectroFrame().getColumn(2); dipole.normalize(); - return dot(); + return dot(r12, dipole); } double GofROmega::evaluateAngle(StuntDouble* sd1, StuntDouble* sd2) { Vector3d v1 = sd1->getElectroFrame().getColumn(2); - Vector3d v2 = sd1->getElectroFrame().getColumn(2); - - + Vector3d v2 = sd1->getElectroFrame().getColumn(2); + v1.normalize(); + v2.normalize(); + return dot(v1, v2); }