Loading...
Searching...
No Matches
generic.hpp File Reference

File for containing generic or common functions. More...

#include <algorithm>
#include <array>
#include <cmath>
#include <cstddef>
#include <filesystem>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <mol_sys.hpp>
#include <numbers>
#include <Eigen/Core>
#include <Eigen/Dense>

Go to the source code of this file.

Namespaces

namespace  gen
 Small generic functions that are shared by all namespaces.

Functions

double gen::radDeg (double angle)
 Inline function for converting radians->degrees.
double gen::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 gen::getAverageWithoutOutliers (std::vector< double > inpVec)
 Get the average, after excluding the outliers, using quartiles.
double gen::calcMedian (std::vector< double > *input)
 Inline generic function for calculating the median given a vector of the values.
std::array< double, 3 > gen::triclinicMinImage (const molSys::PointCloud< molSys::Point< double >, double > &yCloud, double xi, double yi, double zi, double xj, double yj, double zj)
double gen::periodicDistSq (const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int iatom, int jatom)
 Inline generic function for obtaining the unwrapped periodic distance between two particles, whose indices (not IDs) have been given.
double gen::periodicDist (const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int iatom, int jatom)
 Inline generic function for obtaining the unwrapped periodic distance between two particles, whose indices (not IDs) have been given.
void gen::batchPeriodicDistSq (const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int iatom, const int *jatom, std::size_t n, double *distSq)
std::string gen::formatDumpBox (const std::vector< double > &box)
void gen::writeDumpBoxBounds (std::ostream &os, const molSys::PointCloud< molSys::Point< double >, double > &yCloud)
std::array< double, 3 > gen::relDistFromPoint (const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int iatom, double xj, double yj, double zj)
 Inline generic function for obtaining the unwrapped periodic distance between one particle and another point, whose index has been given.
double gen::unWrappedDistFromPoint (const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int iatom, const std::vector< double > &singlePoint)
double gen::distance (const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int iatom, int jatom)
 Inline generic function for obtaining the wrapped distance between two particles WITHOUT applying PBCs, whose indices (not IDs) have been given.
std::array< double, 3 > gen::relDist (const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int iatom, int jatom)
 Inline generic function for getting the relative unwrapped distance between two particles for each dimension.
bool gen::compareByAtomID (const molSys::Point< double > &a, const molSys::Point< double > &b)
 Inline generic function for sorting or comparing two particles, according to the atom ID when the entire Point objects have been passed.
int gen::prettyPrintYoda (const molSys::PointCloud< molSys::Point< double >, double > &yCloud, std::string outFile)
 Generic function for printing all the struct information.
int gen::unwrappedCoordShift (const 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).
double gen::angDistDegQuaternions (std::vector< double > quat1, std::vector< double > quat2)
std::vector< std::string > gen::tokenizer (std::string line)
 Function for tokenizing line strings into words (strings) delimited by whitespace.
std::vector< double > gen::tokenizerDouble (std::string line)
 Function for tokenizing line strings into a vector of doubles.
std::vector< int > gen::tokenizerInt (std::string line)
 Function for tokenizing line strings into a vector of ints.
bool gen::file_exists (const std::string &name)
 Function for checking if a file exists or not.
std::vector< std::complex< double > > gen::avgVector (std::vector< std::complex< double > > v, int l, int neigh)
 Calculates the complex vector, normalized by the number of nearest neighbours, of length \(2l+1\).

Variables

constexpr double gen::pi = std::numbers::pi
 Uses Boost to get the value of pi.

Detailed Description

File for containing generic or common functions.

Definition in file generic.hpp.