46 std::string path, std::vector<double> *rdfValues,
48 double binwidth,
int firstFrame,
int finalFrame) {
50 int nopA = yCloud->nop;
51 int currentFrame = yCloud->currentFrame;
53 std::vector<double> volumeLengths;
55 std::vector<int> histogram;
56 int nIter = finalFrame - firstFrame + 1;
59 if (currentFrame == firstFrame) {
63 nbin = 1 + int(cutoff / binwidth);
64 (*rdfValues).resize(nbin);
71 nbin = int(cutoff / binwidth);
80 if (currentFrame == finalFrame) {
83 std::string outputDirName = path +
"topoMonolayer";
86 std::string fileName = path +
"topoMonolayer/rdf.dat";
89 std::ofstream outputFile;
90 outputFile.open(fileName, std::ios_base::app | std::ios_base::out);
91 outputFile <<
"# r g(r)\n";
116 double cutoff,
double binwidth,
int nbin) {
118 std::vector<int> histogram;
123 histogram.resize(nbin);
126 for (
int iatom = 0; iatom < yCloud->nop - 1; iatom++) {
129 for (
int jatom = iatom + 1; jatom < yCloud->nop; jatom++) {
134 if (r_ij <= cutoff) {
135 ibin = int(r_ij / binwidth);
136 histogram[ibin] += 2;
163 std::vector<int> histogram,
double binwidth,
int nbin,
164 std::vector<double> volumeLengths,
int nIter) {
166 auto height = *std::min_element(
167 volumeLengths.begin(),
168 volumeLengths.end());
174 double volumeDensity =
175 nopA / (volumeLengths[0] * volumeLengths[1] * volumeLengths[2]);
178 for (
int ibin = 0; ibin < nbin; ibin++) {
180 r = binwidth * (ibin + 0.5);
186 factor = height / (2 * r);
190 factor = 1 - r / (2 * height);
194 binVolume = 4 *
gen::pi * pow(binwidth, 3.0) *
195 (pow(ibin + 1, 3.0) - pow(ibin, 3.0)) / 3.0;
197 (*rdfValues)[ibin] +=
198 histogram[ibin] / (nIter * binVolume * nopA * volumeDensity * factor);
215 std::vector<double> lengths;
220 std::vector<double> r_iatom;
224 r_iatom.push_back(yCloud->pts[0].x);
225 r_iatom.push_back(yCloud->pts[0].y);
226 r_iatom.push_back(yCloud->pts[0].z);
231 for (
int iatom = 1; iatom < yCloud->nop; iatom++) {
232 r_iatom[0] = yCloud->pts[iatom].x;
233 r_iatom[1] = yCloud->pts[iatom].y;
234 r_iatom[2] = yCloud->pts[iatom].z;
236 for (
int k = 0; k < dim; k++) {
238 if (r_iatom[k] < rMin[k]) {
239 rMin[k] = r_iatom[k];
242 if (r_iatom[k] > rMax[k]) {
243 rMax[k] = r_iatom[k];
249 for (
int k = 0; k < dim; k++) {
250 lengths.push_back(rMax[k] - rMin[k]);
267 std::sort(volumeLengths.begin(), volumeLengths.end());
268 std::reverse(volumeLengths.begin(), volumeLengths.end());
270 return volumeLengths[0] * volumeLengths[1];
double periodicDist(molSys::PointCloud< molSys::Point< double >, double > *yCloud, int iatom, int jatom)
Inline generic function for obtaining the unwrapped periodic distance between two particles,...
std::vector< double > getSystemLengths(molSys::PointCloud< molSys::Point< double >, double > *yCloud)
Gets the lengths of the volume slice of the quasi-two-dimensional system.
std::vector< int > sampleRDF_AA(molSys::PointCloud< molSys::Point< double >, double > *yCloud, double cutoff, double binwidth, int nbin)
Samples the RDF histogram at every step.
double getPlaneArea(std::vector< double > volumeLengths)
Gets the plane area from the volume lengths vector.
int rdf2Danalysis_AA(std::string path, std::vector< double > *rdfValues, molSys::PointCloud< molSys::Point< double >, double > *yCloud, double cutoff, double binwidth, int firstFrame, int finalFrame)
int normalizeRDF(int nopA, std::vector< double > *rdfValues, std::vector< int > histogram, double binwidth, int nbin, std::vector< double > volumeLengths, int nIter)
Normalize the histogram.
int makePath(const std::string &path)
int printRDF(std::string fileName, std::vector< double > *rdfValues, double binwidth, int nbin)
Function for printing out the RDF, given the filename.
File containing functions used to calculate the in-plane radial distribution functions.
This contains a collection of points; contains information for a particular frame.
This contains per-particle information.