Loading...
Searching...
No Matches
eonc::pbc Namespace Reference

Functions

void closestDisplacements (double *data, size_t coordinates, const double *rowMajorCell)
void wrapMinimumImage (double *data, size_t n)
void wrapLegacyUnit (double *data, size_t n)
AtomMatrix apply (const AtomMatrix &diff, const Matrix3d &cell, const Matrix3d &cellInverse)
AtomMatrix applyLegacy (const AtomMatrix &coords, const Matrix3d &cell, const Matrix3d &cellInverse)
AtomMatrix applyPositions (const AtomMatrix &coords, const Matrix3d &cell, const Matrix3d &cellInverse, PbcConvention convention)
VectorXd applyV (const VectorXd &diffVector, const Matrix3d &cell, const Matrix3d &cellInverse)

Function Documentation

◆ apply()

AtomMatrix eonc::pbc::apply ( const AtomMatrix & diff,
const Matrix3d & cell,
const Matrix3d & cellInverse )
inline

Definition at line 46 of file Matter.h.

47 {
48 static_cast<void>(cellInverse);
49 AtomMatrix image = diff;
50 closestDisplacements(image.data(), static_cast<size_t>(image.size()),
51 cell.data());
52 return image;
53}
Eigen::Matrix< double, Eigen::Dynamic, 3, eOnStorageOrder > AtomMatrix
Definition Eigen.h:37
void closestDisplacements(double *data, size_t coordinates, const double *rowMajorCell)

◆ applyLegacy()

AtomMatrix eonc::pbc::applyLegacy ( const AtomMatrix & coords,
const Matrix3d & cell,
const Matrix3d & cellInverse )
inline

Definition at line 57 of file Matter.h.

58 {
59 AtomMatrix frac = coords * cellInverse;
60 // Same values as fmod(x + 1, 1): (x + 1) - trunc(x + 1).
61 wrapLegacyUnit(frac.data(), static_cast<size_t>(frac.size()));
62 return frac * cell;
63}
void wrapLegacyUnit(double *data, size_t n)
Definition PbcSimd.cpp:114

◆ applyPositions()

AtomMatrix eonc::pbc::applyPositions ( const AtomMatrix & coords,
const Matrix3d & cell,
const Matrix3d & cellInverse,
PbcConvention convention )
inline

Definition at line 66 of file Matter.h.

68 {
69 if (convention == PbcConvention::MinimumImage) {
70 AtomMatrix frac = coords * cellInverse;
71 wrapMinimumImage(frac.data(), static_cast<size_t>(frac.size()));
72 return frac * cell;
73 }
74 return applyLegacy(coords, cell, cellInverse);
75}
void wrapMinimumImage(double *data, size_t n)
Definition PbcSimd.cpp:110
AtomMatrix applyLegacy(const AtomMatrix &coords, const Matrix3d &cell, const Matrix3d &cellInverse)
Definition Matter.h:57

◆ applyV()

VectorXd eonc::pbc::applyV ( const VectorXd & diffVector,
const Matrix3d & cell,
const Matrix3d & cellInverse )
inline

Definition at line 77 of file Matter.h.

78 {
79 AtomMatrix pbcMatrix =
80 apply(AtomMatrix::Map(diffVector.data(), diffVector.size() / 3, 3), cell,
81 cellInverse);
82 return VectorXd(VectorXd::Map(pbcMatrix.data(), diffVector.size()));
83}
AtomMatrix apply(const AtomMatrix &diff, const Matrix3d &cell, const Matrix3d &cellInverse)
Definition Matter.h:46

◆ closestDisplacements()

void eonc::pbc::closestDisplacements ( double * data,
size_t coordinates,
const double * rowMajorCell )

Definition at line 7 of file MinimumImage.cpp.

8 {
9 if (coordinates % 3 != 0)
10 throw std::invalid_argument(
11 "periodic differences require Cartesian triples");
12 if (coordinates == 0)
13 return;
14 const auto cell = minimage::Cell::from_con(rowMajorCell);
15 for (size_t j = 0; j < coordinates; j += 3) {
16 const auto image = cell.displacement_euclidean(
17 {0.0, 0.0, 0.0}, {data[j], data[j + 1], data[j + 2]});
18 for (size_t k = 0; k < 3; ++k)
19 data[j + k] = image[k];
20 }
21}

◆ wrapLegacyUnit()

void eonc::pbc::wrapLegacyUnit ( double * data,
size_t n )

Definition at line 114 of file PbcSimd.cpp.

114 {
115 wrapLegacyUnitScalar(data, 0, n);
116}

◆ wrapMinimumImage()

void eonc::pbc::wrapMinimumImage ( double * data,
size_t n )

Definition at line 110 of file PbcSimd.cpp.

110 {
111 wrapMinimumImageScalar(data, 0, n);
112}