ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/applications/staticProps/GofXyz.cpp
(Generate patch)

Comparing trunk/OOPSE-2.0/src/applications/staticProps/GofXyz.cpp (file contents):
Revision 2047 by tim, Thu Feb 17 18:41:50 2005 UTC vs.
Revision 2048 by tim, Thu Feb 17 19:50:30 2005 UTC

# Line 47 | Line 47 | GofXyz::GofXyz(SimInfo* info, const std::string& filen
47   namespace oopse {
48  
49   GofXyz::GofXyz(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, double len, int nrbins)
50 <    : RadialDistrFunc(info, filename, sele1, sele2), len_(len), nRBins_(nrbins) {
50 >    : RadialDistrFunc(info, filename, sele1, sele2), len_(len), halfLen_(len/2), nRBins_(nrbins) {
51      setOutputName(getPrefix(filename) + ".gxyz");
52  
53 <    deltaR_ = len_ / nRBins_;
53 >    deltaR_ =  len_ / nRBins_;
54      
55      histogram_.resize(nRBins_);
56      for (int i = 0 ; i < nRBins_; ++i) {
# Line 135 | Line 135 | void GofXyz::collectHistogram(StuntDouble* sd1, StuntD
135      double y = dot(r12, i->second.yaxis);
136      double z = dot(r12, i->second.zaxis);
137  
138 <    int xbin = x / deltaR_;
139 <    int ybin = y / deltaR_;
140 <    int zbin = z / deltaR_;
138 >    // x, y and z's possible values range -halfLen_ to halfLen_
139 >    int xbin = (x+ halfLen_) / deltaR_;
140 >    int ybin = (y + halfLen_) / deltaR_;
141 >    int zbin = (z + halfLen_) / deltaR_;
142  
143      if (xbin < nRBins_ && ybin < nRBins_ && zbin < nRBins_) {
144          ++histogram_[x][y][z];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines