namespace rgpot::staged

Overview

namespace staged {
 
// global functions
 
template <typename Fn>
void forEachPair(const HalfList& list, Fn&& fn);
 
template <typename Body>
void withTally(const StageTally* tally, Body&& body);
 
template <bool Tally>
void addPair(std::bool_constant<Tally>, double* forces, StageTally* tally, int i, int j, bool both, double energy, double fscale, double dx, double dy, double dz);
 
void addSite(StageTally& tally, int i, double energy);
 
} // namespace staged

Detailed Documentation

Global Functions

template <typename Fn>
void forEachPair(const HalfList& list, Fn&& fn)

Calls fn(i, j, dx, dy, dz, r2, both) for every pair of list, with d = r_i - r_j and both set when the stages write atom j as well as the row atom i: j is owned, or the list is newton.

template <typename Body>
void withTally(const StageTally* tally, Body&& body)

Runs body(std::true_type{}) with a tally and body(std::false_type{}) without, so a stage compiles its loop once with the energy and virial and once with the forces alone.

template <bool Tally>
void addPair(std::bool_constant<Tally>, double* forces, StageTally* tally, int i, int j, bool both, double energy, double fscale, double dx, double dy, double dz)

Adds a pair whose force on atom i is fscale * d, d = r_i - r_j: the force on i, the opposite force on j when both, and with a tally the host’s share of the pair energy and virial (all of it when both, else half) and half of each to atom i and, when both, to atom j.

void addSite(StageTally& tally, int i, double energy)

Adds the site energy of the owned atom i.