seams-core v2.14.2
libyodaLib, the C++ engine of d-SEAMS
Loading...
Searching...
No Matches
traj Namespace Reference

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

Classes

struct  BoxCell
 Restricted-triclinic periodic simulation cell. More...
class  TrajectoryUnwrapper
 Stateful streaming unwrapper across periodic frames. More...
struct  WaterVectorsResult
 Per-water orientation vectors (O->H midpoint and H->H). More...
struct  DipoleVectorsResult
 Generic per-molecule dipole / orientation vectors. More...
struct  OrientationOrderResult
 Axis-projected orientational order parameters P1 and P2. More...
struct  DiffusionFitResult
 Linear Einstein fit of total, 1D axial, and 2D lateral MSD. More...
struct  DecayFitResult
 Integrated and single-exponential relaxation time summary. More...
class  MsdAccumulator
 Streaming multi-origin MSD accumulator with arbitrary-axis split. More...
class  HbondLifetimeAccumulator
 Streaming multi-origin H-bond lifetime accumulator (C_HB and S_HB). More...
class  ReorientationAccumulator
 Streaming multi-origin orientational time-correlation accumulator for C1(t) = <P1(u(0).u(t))> and C2(t) = <P2(u(0).u(t))>. More...

Functions

bool checkedMul (std::size_t a, std::size_t b, std::size_t &out) noexcept
 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].
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.
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.
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.
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)

Variables

constexpr std::size_t kMaxTriples
 Largest particle or vector count n whose 3 * n doubles one std::vector can hold.
constexpr std::size_t kMaxBoxes
 Largest box count n whose 9 * n doubles fit in a single array.
constexpr std::size_t kMaxLag
 Largest max_lag whose max_lag + 1 lag bins one std::vector can hold.

Detailed Description

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

Function Documentation

◆ axisOrderParameters()

bool traj::axisOrderParameters ( const double * vectors,
std::size_t nVectors,
const double axis[3],
OrientationOrderResult & out )

◆ checkedMul()

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

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

Definition at line 62 of file trajectory.hpp.

63 {
64 if (a != 0 && b > std::numeric_limits<std::size_t>::max() / a) {
65 return false;
66 }
67 out = a * b;
68 return true;
69}

◆ fitCorrelationDecay()

bool traj::fitCorrelationDecay ( const std::vector< double > & lagTime,
const std::vector< double > & corr,
double tStart,
double tEnd,
DecayFitResult & out )

◆ fitDiffusionCurve()

bool traj::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 )

◆ moleculeCentres() [1/2]

bool traj::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.

◆ moleculeCentres() [2/2]

bool traj::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.

◆ moleculeDipoleVectors() [1/2]

bool traj::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).

◆ moleculeDipoleVectors() [2/2]

bool traj::moleculeDipoleVectors ( const molSys::PointCloud< molSys::Point< double >, double > & cloud,
const int * molIdsOverride,
const double * charges,
DipoleVectorsResult & out )

◆ unwrapMoleculeCentres()

bool traj::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.

◆ unwrapPositions()

bool traj::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
boxesEither 1 cell (9 doubles) or nFrames cells (9 * nFrames doubles).

◆ waterOrientationVectors()

bool traj::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.

Variable Documentation

◆ kMaxBoxes

std::size_t traj::kMaxBoxes
inlineconstexpr
Initial value:
=
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.

Definition at line 46 of file trajectory.hpp.

◆ kMaxLag

std::size_t traj::kMaxLag
inlineconstexpr
Initial value:
=
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.

Definition at line 54 of file trajectory.hpp.

◆ kMaxTriples

std::size_t traj::kMaxTriples
inlineconstexpr
Initial value:
=
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.

Definition at line 38 of file trajectory.hpp.