| 42 | 
  | 
#include <algorithm> | 
| 43 | 
  | 
#include <fstream> | 
| 44 | 
  | 
#include "applications/staticProps/GofR.hpp" | 
| 45 | 
+ | 
#include "utils/simError.h" | 
| 46 | 
  | 
 | 
| 47 | 
  | 
namespace oopse { | 
| 48 | 
  | 
 | 
| 92 | 
  | 
    Vector3d pos1 = sd1->getPos(); | 
| 93 | 
  | 
    Vector3d pos2 = sd2->getPos(); | 
| 94 | 
  | 
    Vector3d r12 = pos1 - pos2; | 
| 95 | 
< | 
     | 
| 95 | 
< | 
    double distance = (pos1 - pos2).length(); | 
| 95 | 
> | 
    currentSnapshot_->wrapVector(r12); | 
| 96 | 
  | 
 | 
| 97 | 
+ | 
    double distance = r12.length(); | 
| 98 | 
+ | 
 | 
| 99 | 
  | 
    int whichBin = distance / delta_; | 
| 100 | 
  | 
    histogram_[whichBin] ++; | 
| 101 | 
  | 
    npairs_++; | 
| 106 | 
  | 
    std::ofstream rdfStream(outputFilename_.c_str()); | 
| 107 | 
  | 
    if (rdfStream.is_open()) { | 
| 108 | 
  | 
        rdfStream << "#radial distribution function\n"; | 
| 109 | 
< | 
        rdfStream << "#selection1: " << selectionScript1_; | 
| 110 | 
< | 
        rdfStream << "#selection2: " << selectionScript2_; | 
| 109 | 
> | 
        rdfStream << "#selection1: (" << selectionScript1_ << ")\t"; | 
| 110 | 
> | 
        rdfStream << "selection2: (" << selectionScript2_ << ")\n"; | 
| 111 | 
> | 
        rdfStream << "#r\tcorrValue\n"; | 
| 112 | 
> | 
        for (int i = 0; i < avgGofr_.size(); ++i) { | 
| 113 | 
> | 
            double r = delta_ * (i + 0.5); | 
| 114 | 
> | 
            rdfStream << r << "\t" << avgGofr_[i]/nProcessed_ << "\n"; | 
| 115 | 
> | 
        } | 
| 116 | 
  | 
         | 
| 117 | 
  | 
    } else { | 
| 118 | 
  | 
 | 
| 119 | 
  | 
 | 
| 120 | 
  | 
    } | 
| 121 | 
+ | 
 | 
| 122 | 
+ | 
    rdfStream.close(); | 
| 123 | 
  | 
} | 
| 124 | 
  | 
 | 
| 125 | 
  | 
} |