Template Function deepmd::fold_back

Template Function deepmd::fold_back#

Function Documentation#

template<typename VT>
void deepmd::fold_back(std::vector<VT> &out, const std::vector<VT> &in, const std::vector<int> &mapping, const int nloc, const int nall, const int ndim, const int nframes = 1)#

Fold back extended-region values to local atoms via scatter-sum.

Copies local atom values directly, then accumulates ghost atom contributions onto their mapped local atoms using the mapping array.

Template Parameters:

VT – The value type (double or float).

Parameters:
  • out[out] Output vector of size nframes * nloc * ndim.

  • in[in] Input vector of size nframes * nall * ndim (extended region).

  • mapping[in] Mapping from extended index to local index, size nall.

  • nloc[in] Number of local atoms.

  • nall[in] Number of all atoms (local + ghost).

  • ndim[in] Number of dimensions per atom (e.g. 3 for force, 9 for virial).

  • nframes[in] Number of frames.