namespace traj#

Overview#

Multi-frame PBC unwrapping, molecular orientation/dipole vectors, and streaming time-correlation accumulators. More…

namespace traj {
 
// structs
 
struct BoxCell;
struct DecayFitResult;
struct DiffusionFitResult;
struct DipoleVectorsResult;
struct OrientationOrderResult;
struct WaterVectorsResult;
 
// classes
 
class HbondLifetimeAccumulator;
class MsdAccumulator;
class ReorientationAccumulator;
class TrajectoryUnwrapper;
 
// global variables
 
std::size_t kMaxTriples                                      = static_cast<std::size_t>(std::numeric_limits<std::ptrdiff_t>::max()) /(3* sizeof(double));
std::size_t kMaxBoxes                                    = static_cast<std::size_t>(std::numeric_limits<std::ptrdiff_t>::max()) /(9* sizeof(double));
std::size_t kMaxLag                                  = static_cast<std::size_t>(std::numeric_limits<std::ptrdiff_t>::max()) /     sizeof(double) - 1;
 
// global functions
 
bool checkedMul(std::size_t a, std::size_t b, std::size_t& out);
bool unwrapPositions(const double* xyzFrames, std::size_t nFrames, std::size_t nAtoms, const double* boxes, std::size_t nBoxes, double* unwrappedOut);
bool moleculeCentres(const double* xyz, std::size_t nAtoms, const BoxCell& cell, const int* molIds, const double* masses, std::vector<int>& uniqueMolIds, std::vector<double>& centresOut);
bool moleculeCentres(const molSys::PointCloud<molSys::Point<double>, double>& cloud, const double* masses, std::vector<int>& uniqueMolIds, std::vector<double>& centresOut);
bool unwrapMoleculeCentres(const double* xyzFrames, std::size_t nFrames, std::size_t nAtoms, const double* boxes, std::size_t nBoxes, const int* molIds, const double* masses, std::vector<int>& uniqueMolIds, std::vector<double>& unwrappedCentresOut);
bool waterOrientationVectors(const molSys::PointCloud<molSys::Point<double>, double>& cloud, int oxygenType, int hydrogenType, WaterVectorsResult& out, double covalentCutoff = 1.35);
bool moleculeDipoleVectors(const double* xyz, std::size_t nAtoms, const BoxCell& cell, const int* molIds, const double* charges, DipoleVectorsResult& out);
bool moleculeDipoleVectors(const molSys::PointCloud<molSys::Point<double>, double>& cloud, const int* molIdsOverride, const double* charges, DipoleVectorsResult& out);
bool axisOrderParameters(const double* vectors, std::size_t nVectors, const double axis[3], OrientationOrderResult& out);
bool fitDiffusionCurve(const std::vector<double>& lagTime, const std::vector<double>& msdTotal, const std::vector<double>& msdAxial, const std::vector<double>& msdLateral, double tStart, double tEnd, DiffusionFitResult& out);
bool fitCorrelationDecay(const std::vector<double>& lagTime, const std::vector<double>& corr, double tStart, double tEnd, DecayFitResult& out);
 
} // namespace traj

Detailed Documentation#

Multi-frame PBC unwrapping, molecular orientation/dipole vectors, and streaming time-correlation accumulators.

Global Variables#

std::size_t kMaxTriples                                      = static_cast<std::size_t>(std::numeric_limits<std::ptrdiff_t>::max()) /(3* sizeof(double))

Largest particle or vector count n whose 3 * n doubles one std::vector can hold.

Larger counts are refused, so 3 * n never wraps.

std::size_t kMaxBoxes                                    = static_cast<std::size_t>(std::numeric_limits<std::ptrdiff_t>::max()) /(9* sizeof(double))

Largest box count n whose 9 * n doubles fit in a single array.

Larger counts are refused, so 9 * n and pointer offsets never overflow.

std::size_t kMaxLag                                  = static_cast<std::size_t>(std::numeric_limits<std::ptrdiff_t>::max()) /     sizeof(double) - 1

Largest max_lag whose max_lag + 1 lag bins one std::vector can hold.

Larger lags are refused, so max_lag + 1 never wraps to zero.

Global Functions#

bool checkedMul(std::size_t a, std::size_t b, std::size_t& out)

out = a * b; false, leaving out alone, when that overflows size_t.

bool unwrapPositions(const double* xyzFrames, std::size_t nFrames, std::size_t nAtoms, const double* boxes, std::size_t nBoxes, double* unwrappedOut)

Unwrap a multi-frame coordinate array [nFrames * 3 * nAtoms].

Parameters:

boxes

Either 1 cell (9 doubles) or nFrames cells (9 * nFrames doubles).

bool moleculeCentres(const double* xyz, std::size_t nAtoms, const BoxCell& cell, const int* molIds, const double* masses, std::vector<int>& uniqueMolIds, std::vector<double>& centresOut)

Compute intact PBC-assembled per-molecule centres for one frame.

Molecules appear in first-seen order of molIds. If masses is nullptr, equal atom weights are used.

bool moleculeCentres(const molSys::PointCloud<molSys::Point<double>, double>& cloud, const double* masses, std::vector<int>& uniqueMolIds, std::vector<double>& centresOut)

Cloud overload using stored atom coordinates and molIDs.

bool unwrapMoleculeCentres(const double* xyzFrames, std::size_t nFrames, std::size_t nAtoms, const double* boxes, std::size_t nBoxes, const int* molIds, const double* masses, std::vector<int>& uniqueMolIds, std::vector<double>& unwrappedCentresOut)

Compute and unwrap molecule centres across nFrames frames.

bool waterOrientationVectors(const molSys::PointCloud<molSys::Point<double>, double>& cloud, int oxygenType, int hydrogenType, WaterVectorsResult& out, double covalentCutoff = 1.35)

Extract per-water O->midpoint(H1,H2) and H1->H2 vectors under MIC.

Pairs each oxygen (oxygenType) with its two hydrogens (hydrogenType) by shared molID when multi-atom molecule IDs exist, falling back to the two nearest hydrogens within covalentCutoff Angstrom when molIDs do not group O and H atoms.

bool moleculeDipoleVectors(const double* xyz, std::size_t nAtoms, const BoxCell& cell, const int* molIds, const double* charges, DipoleVectorsResult& out)

Compute per-molecule dipole or geometric orientation vectors.

When charges is non-null, computes sum_a q_a (r_a^intact - R_geom) in e*A (origin-independent for neutral molecules and translation-invariant for ions). When charges is null, computes the mean MIC bond vector from the first atom of each molecule to its remaining atoms (reducing to O->H-midpoint for O-H-H).