| 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) { | 
| 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]; |