Loading...
Searching...
No Matches
seams Namespace Reference

Namespaces

namespace  cfg
namespace  sphericart_ylm
namespace  steinhardt

Functions

void BatchPeriodicDistSq (const double *dx, const double *dy, const double *dz, double bx, double by, double bz, double *out, size_t n)
void BatchPeriodicDistSq (std::span< const double > dx, std::span< const double > dy, std::span< const double > dz, double bx, double by, double bz, std::span< double > out)
 Squared minimum-image distances for a batch of coordinate differences, with the extents carried alongside the data.

Function Documentation

◆ BatchPeriodicDistSq() [1/2]

void seams::BatchPeriodicDistSq ( const double * dx,
const double * dy,
const double * dz,
double bx,
double by,
double bz,
double * out,
size_t n )
inline

Definition at line 88 of file simd_distance.hpp.

90 {
91 // Matches the vectorised path: one reciprocal per axis for the whole batch
92 const double rbx = 1.0 / bx;
93 const double rby = 1.0 / by;
94 const double rbz = 1.0 / bz;
95 for (size_t i = 0; i < n; i++) {
96 double ddx = std::fabs(dx[i]);
97 double ddy = std::fabs(dy[i]);
98 double ddz = std::fabs(dz[i]);
99 ddx -= bx * std::round(ddx * rbx);
100 ddy -= by * std::round(ddy * rby);
101 ddz -= bz * std::round(ddz * rbz);
102 out[i] = ddx * ddx + ddy * ddy + ddz * ddz;
103 }
104}

◆ BatchPeriodicDistSq() [2/2]

void seams::BatchPeriodicDistSq ( std::span< const double > dx,
std::span< const double > dy,
std::span< const double > dz,
double bx,
double by,
double bz,
std::span< double > out )
inline

Squared minimum-image distances for a batch of coordinate differences, with the extents carried alongside the data.

The ranges must agree in length; the shortest one bounds the work, so a mismatched call computes fewer results rather than running off the end of an array. This overload forwards to whichever kernel the build selected.

Parameters
[in]dx,dy,dzCoordinate differences.
[in]bx,by,bzPeriodic box dimensions.
[out]outSquared distances.

Definition at line 121 of file simd_distance.hpp.

124 {
125 const size_t n = std::min({dx.size(), dy.size(), dz.size(), out.size()});
126 BatchPeriodicDistSq(dx.data(), dy.data(), dz.data(), bx, by, bz, out.data(),
127 n);
128}
void BatchPeriodicDistSq(const double *dx, const double *dy, const double *dz, double bx, double by, double bz, double *out, size_t n)