24#include <boost/math/constants/constants.hpp>
54const double pi = boost::math::constants::pi<double>();
64double eigenVecAngle(std::vector<double> OO, std::vector<double> OH);
78 int n = (*input).size();
82 std::sort((*input).begin(), (*input).end());
87 median = 0.5 * ((*input)[n / 2] + (*input)[n / 2 - 1]);
90 median = (*input)[(n + 1) / 2 -
109 int iatom,
int jatom) {
110 std::array<double, 3> dr;
114 dr[0] = fabs(yCloud->pts[iatom].x - yCloud->pts[jatom].x);
115 dr[1] = fabs(yCloud->pts[iatom].y - yCloud->pts[jatom].y);
116 dr[2] = fabs(yCloud->pts[iatom].z - yCloud->pts[jatom].z);
119 for (
int k = 0; k < 3; k++) {
121 dr[k] -= yCloud->box[k] * round(dr[k] / yCloud->box[k]);
122 r2 += pow(dr[k], 2.0);
140 std::vector<double> singlePoint) {
141 std::array<double, 3> dr;
145 dr[0] = fabs(yCloud->pts[iatom].x - singlePoint[0]);
146 dr[1] = fabs(yCloud->pts[iatom].y - singlePoint[1]);
147 dr[2] = fabs(yCloud->pts[iatom].z - singlePoint[2]);
150 for (
int k = 0; k < 3; k++) {
152 dr[k] -= yCloud->box[k] * round(dr[k] / yCloud->box[k]);
153 r2 += pow(dr[k], 2.0);
172 std::array<double, 3> dr;
176 dr[0] = fabs(yCloud->pts[iatom].x - yCloud->pts[jatom].x);
177 dr[1] = fabs(yCloud->pts[iatom].y - yCloud->pts[jatom].y);
178 dr[2] = fabs(yCloud->pts[iatom].z - yCloud->pts[jatom].z);
181 for (
int k = 0; k < 3; k++) {
182 r2 += pow(dr[k], 2.0);
199inline std::array<double, 3>
202 std::array<double, 3> dr;
203 std::array<double, 3> box = {yCloud->box[0], yCloud->box[1], yCloud->box[2]};
207 dr[0] = yCloud->pts[iatom].x - yCloud->pts[jatom].x;
208 dr[1] = yCloud->pts[iatom].y - yCloud->pts[jatom].y;
209 dr[2] = yCloud->pts[iatom].z - yCloud->pts[jatom].z;
212 for (
int k = 0; k < 3; k++) {
214 if (dr[k] < -box[k] * 0.5) {
215 dr[k] = dr[k] + box[k];
217 if (dr[k] >= box[k] * 0.5) {
218 dr[k] = dr[k] - box[k];
241 std::string outFile);
246 int jatomIndex,
double *x_i,
double *y_i,
double *z_i,
double *x_j,
247 double *y_j,
double *z_j);
252 std::vector<double> quat2);
259inline std::vector<std::string>
tokenizer(std::string line) {
260 std::istringstream iss(line);
261 std::vector<std::string> tokens{std::istream_iterator<std::string>{iss},
262 std::istream_iterator<std::string>{}};
259inline std::vector<std::string>
tokenizer(std::string line) {
…}
271 std::istringstream iss(line);
272 std::vector<double> tokens;
274 while (iss >> number) {
275 tokens.push_back(number);
285 std::istringstream iss(line);
286 std::vector<int> tokens;
288 while (iss >> number) {
289 tokens.push_back(number);
301 return (stat(name.c_str(), &buffer) == 0);
312inline std::vector<std::complex<double>>
313avgVector(std::vector<std::complex<double>> v,
int l,
int neigh) {
317 for (
int m = 0; m < 2 * l + 1; m++) {
318 v[m] = (1.0 / (double)neigh) * v[m];
313avgVector(std::vector<std::complex<double>> v,
int l,
int neigh) {
…}
double distance(molSys::PointCloud< molSys::Point< double >, double > *yCloud, int iatom, int jatom)
Inline generic function for obtaining the wrapped distance between two particles WITHOUT applying PBC...
std::vector< std::complex< double > > avgVector(std::vector< std::complex< double > > v, int l, int neigh)
double eigenVecAngle(std::vector< double > OO, std::vector< double > OH)
Eigen function for getting the angle (in radians) between the O–O and O-H vectors.
double calcMedian(std::vector< double > *input)
Inline generic function for calculating the median given a vector of the values.
std::array< double, 3 > relDist(molSys::PointCloud< molSys::Point< double >, double > *yCloud, int iatom, int jatom)
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,...
double unWrappedDistFromPoint(molSys::PointCloud< molSys::Point< double >, double > *yCloud, int iatom, std::vector< double > singlePoint)
std::vector< double > tokenizerDouble(std::string line)
Function for tokenizing line strings into a vector of doubles.
bool file_exists(const std::string &name)
Function for checking if a file exists or not.
std::vector< std::string > tokenizer(std::string line)
Function for tokenizing line strings into words (strings) delimited by whitespace....
double angDistDegQuaternions(std::vector< double > quat1, std::vector< double > quat2)
int unwrappedCoordShift(molSys::PointCloud< molSys::Point< double >, double > *yCloud, int iatomIndex, int jatomIndex, double *x_i, double *y_i, double *z_i, double *x_j, double *y_j, double *z_j)
Shift particles (unwrapped coordinates)
std::vector< int > tokenizerInt(std::string line)
Function for tokenizing line strings into a vector of ints.
double radDeg(double angle)
bool compareByAtomID(const molSys::Point< double > &a, const molSys::Point< double > &b)
int prettyPrintYoda(molSys::PointCloud< molSys::Point< double >, double > *yCloud, std::string outFile)
Generic function for printing all the struct information.
double getAverageWithoutOutliers(std::vector< double > inpVec)
Get the average, after excluding the outliers, using quartiles.
The main molecular system handler.
Small generic functions that are shared by all namespaces.
This contains a collection of points; contains information for a particular frame.
This contains per-particle information.