--- trunk/src/applications/staticProps/GofAngle2.cpp 2005/02/10 18:14:03 310 +++ trunk/src/applications/staticProps/GofAngle2.cpp 2005/02/17 16:21:07 360 @@ -41,38 +41,50 @@ #include #include -#include "applications/staticProps/GofRAngle2.hpp" +#include "applications/staticProps/GofAngle2.hpp" #include "utils/simError.h" namespace oopse { -GofRAngle2::GofRAngle2(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2) - : RadialDistrFunc(info, filename, sele1, sele2){ +GofAngle2::GofAngle2(SimInfo* info, const std::string& filename, const std::string& sele1, + const std::string& sele2, int nangleBins) + : RadialDistrFunc(info, filename, sele1, sele2), nAngleBins_(nangleBins) { + setOutputName(getPrefix(filename) + ".gto"); + + deltaCosAngle_ = 2.0 / nAngleBins_; + + histogram_.resize(nAngleBins_); + avgGofr_.resize(nAngleBins_); + for (int i = 0 ; i < nAngleBins_; ++i) { + histogram_[i].resize(nAngleBins_); + avgGofr_[i].resize(nAngleBins_); + } + } -void GofRAngle2::preProcess() { +void GofAngle2::preProcess() { for (int i = 0; i < avgGofr_.size(); ++i) { std::fill(avgGofr_[i].begin(), avgGofr_[i].end(), 0); } } -void GofRAngle2::initalizeHistogram() { +void GofAngle2::initalizeHistogram() { npairs_ = 0; for (int i = 0; i < histogram_.size(); ++i) std::fill(histogram_[i].begin(), histogram_[i].end(), 0); } -void GofRAngle2::processHistogram() { +void GofAngle2::processHistogram() { //std::for_each(avgGofr_.begin(), avgGofr_.end(), std::plus>) } -void GofRAngle2::collectHistogram(StuntDouble* sd1, StuntDouble* sd2) { +void GofAngle2::collectHistogram(StuntDouble* sd1, StuntDouble* sd2) { if (sd1 == sd2) { return; @@ -101,25 +113,29 @@ void GofRAngle2::collectHistogram(StuntDouble* sd1, St ++npairs_; } -void GofRAngle::writeRdf() { +void GofAngle2::writeRdf() { std::ofstream rdfStream(outputFilename_.c_str()); if (rdfStream.is_open()) { rdfStream << "#radial distribution function\n"; rdfStream << "#selection1: (" << selectionScript1_ << ")\t"; rdfStream << "selection2: (" << selectionScript2_ << ")\n"; - rdfStream << "#r\tcorrValue\n"; + rdfStream << "#nAngleBins =" << nAngleBins_ << "deltaCosAngle = " << deltaCosAngle_ << "\n"; for (int i = 0; i < avgGofr_.size(); ++i) { double cosAngle1 = -1.0 + (i + 0.5)*deltaCosAngle_; for(int j = 0; j < avgGofr_[i].size(); ++j) { - double cosAngle2 = -1.0 + (i + 0.5)*deltaCosAngle_; - rdfStream << cosAngle1 << "\t" << cosAngle2 << "\t" << avgGofr_[i][j]/nProcessed_ << "\n"; + double cosAngle2 = -1.0 + (j + 0.5)*deltaCosAngle_; + rdfStream <