22#include <boost/range/algorithm/transform.hpp>
23#include <boost/range/numeric.hpp>
36 std::vector<double> m_data;
38 std::size_t m_chunk_size;
46 Observable_stat(std::size_t chunk_size, std::size_t n_bonded,
int max_type);
55 double accumulate(
double acc = 0.0, std::size_t column = 0)
const {
56 assert(column < m_chunk_size);
57 if (m_chunk_size == 1)
58 return boost::accumulate(m_data, acc);
60 for (
auto it = m_data.begin() +
static_cast<std::ptrdiff_t
>(column);
61 it < m_data.end(); it +=
static_cast<std::ptrdiff_t
>(m_chunk_size))
68 auto const fac = 1. / volume;
69 boost::transform(m_data, m_data.begin(), [fac](
auto e) { return e * fac; });
91 auto const offset = m_chunk_size *
static_cast<std::size_t
>(bond_id);
97 assert(data.
size() == m_chunk_size);
99 auto const dest = get_non_bonded_contribution(span, type1, type2);
101 boost::transform(dest, data, dest.
begin(), std::plus<>{});
Observable for the pressure and energy.
Utils::Span< double > kinetic
Contribution from linear and angular kinetic energy (accumulated).
void add_non_bonded_contribution(int type1, int type2, int molid1, int molid2, double data)
auto get_chunk_size() const
void rescale(double volume)
Rescale values.
Utils::Span< double > dipolar
Contribution(s) from dipolar interactions.
Utils::Span< double > bonded_contribution(int bond_id) const
Get contribution from a bonded interaction.
Utils::Span< double > non_bonded_intra_contribution(int type1, int type2) const
Get contribution from a non-bonded intramolecular interaction.
double accumulate(double acc=0.0, std::size_t column=0) const
Accumulate values.
Utils::Span< double > virtual_sites
Contribution from virtual sites (accumulated).
void mpi_reduce()
MPI reduction.
Utils::Span< double > non_bonded_intra
Contribution(s) from non-bonded intramolecular interactions.
Utils::Span< double > external_fields
Contribution from external fields (accumulated).
Utils::Span< double > non_bonded_inter
Contribution(s) from non-bonded intermolecular interactions.
void add_non_bonded_contribution(int type1, int type2, int molid1, int molid2, Utils::Span< const double > data)
Utils::Span< double > non_bonded_inter_contribution(int type1, int type2) const
Get contribution from a non-bonded intermolecular interaction.
Utils::Span< double > bonded
Contribution(s) from bonded interactions.
Utils::Span< double > coulomb
Contribution(s) from Coulomb interactions.
A stripped-down version of std::span from C++17.
DEVICE_QUALIFIER constexpr pointer data() const
DEVICE_QUALIFIER constexpr size_type size() const
DEVICE_QUALIFIER constexpr iterator begin() const