class rgpot::nlist::CachedPairList

Overview

class CachedPairList {
public:
    // structs
 
    struct Options;
 
    // methods
 
    template <typename Fn>
    void forEach(const double* R, Fn&& fn) const;
};

Detailed Documentation

Methods

template <typename Fn>
void forEach(const double* R, Fn&& fn) const
True while the cached pair set is valid for positions Rsame / atom count, options and box as the build, and max displacement / below skin/2. [[nodiscard]] bool valid(const double *R, std::size_t n, const double *box,

const Options &opt) const { if (!built_ || n != n_ || !(opt == opt_)) { return false; } for (int k = 0; k < 9; ++k) { if (box[k] != boxref_[k]) { return false; } } if (complete_) { return true; // all pairs are candidates; motion cannot invalidate } const double thr2 = 0.25 * opt_.skin * opt_.skin; const double *ref = Rref_.data(); for (std::size_t a = 0; a < n; ++a) { const double dx = R[3 * a] - ref[3 * a]; const double dy = R[3 * a + 1] - ref[3 * a + 1]; const double dz = R[3 * a + 2] - ref[3 * a + 2]; if (dx * dx + dy * dy + dz * dz > thr2) { return false; } } return true; }

[[nodiscard]] bool isPhantom() const { return phantom_; }

/ First sighting: fused eval-only scan plus a phantom stamp (MIC / regime), or just the scan when caching is unsafe for this box. template <typename Fn> void visitOnly(const double *R, std::size_t n, const double *box,

const Options &opt, Fn &&fn) { setup(n, box, opt); double w[3]; double inv[3]; fold_params(box, opt, w, inv); vesin::cpu::brute_force_visit_only( R, n, w, inv, opt.cutoff * opt.cutoff, [&](int32_t i, int32_t j, double dx, double dy, double dz, double r2) { fn(i, j, -dx, -dy, -dz, r2); }); if (mic_) { pairsIJ_.clear(); finishRebuild(R, n, box, opt); phantom_ = true; } }

/ Second sighting: capture the candidate list at cutoff+skin while / evaluating fn in the same scan. template <typename Fn> void rebuildFused(const double *R, std::size_t n, const double *box,

const Options &opt, Fn &&fn) { setup(n, box, opt); double w[3]; double inv[3]; fold_params(box, opt, w, inv); const double bc = opt.cutoff + opt.skin; vesin::cpu::brute_force_visit( R, n, w, inv, bc * bc, opt.cutoff * opt.cutoff, pairsIJ_, [&](int32_t i, int32_t j, double dx, double dy, double dz, double r2) { fn(i, j, -dx, -dy, -dz, r2); }); finishRebuild(R, n, box, opt); }

/ True when caching applies to this box (decided by the last build). [[nodiscard]] bool cacheable() const { return mic_; }

/ Visit every cached pair within the true cutoff of the current / positions; fn(i, j, dx, dy, dz, r2) uses d = r_i - r_j with the minimum image applied.