namespace vesin::cpu¶
Overview¶
namespace cpu {
// global functions
double visit_round(double t);
template <typename Visitor>
void brute_force_visit(const double* points, std::size_t n, const double w[3], const double inv[3], double list_cutoff2, double visit_cutoff2, std::vector<int32_t>& pairs, Visitor&& visit);
template <typename Visitor>
void brute_force_visit_only(const double* points, std::size_t n, const double w[3], const double inv[3], double visit_cutoff2, Visitor&& visit);
} // namespace cpu
Detailed Documentation¶
Global Functions¶
double visit_round(double t)
Round to nearest via truncate-cast: no libm floor call on -march targets without roundsd. Half-integer inputs round away from zero.
template <typename Visitor>
void brute_force_visit(const double* points, std::size_t n, const double w[3], const double inv[3], double list_cutoff2, double visit_cutoff2, std::vector<int32_t>& pairs, Visitor&& visit)
Scan all i < j pairs of points (interleaved x,y,z, n atoms), folding each dimension by width w[k] when inv[k] = 1/w[k] is nonzero (inv[k] == 0 disables the fold for that dimension).
Pairs with r2 < list_cutoff2 append (i, j) to pairs (flat int32, cleared first); pairs with r2 <= visit_cutoff2 additionally invoke visit(i, j, dx, dy, dz, r2) with the folded r_j - r_i vector. Pass a negative visit_cutoff2 for a collect-only scan.
template <typename Visitor>
void brute_force_visit_only(const double* points, std::size_t n, const double w[3], const double inv[3], double visit_cutoff2, Visitor&& visit)
Evaluation-only variant: same scan and fold, no pair collection. Serves first-sighting evaluations where list capture would be paid for nothing.