48 auto obs_pressure_ptr = std::make_shared<Observable_stat>(
49 9ul,
static_cast<std::size_t
>(bonded_ias->get_next_key()),
50 nonbonded_ias->get_max_seen_particle_type());
52 if (long_range_interactions_sanity_checks()) {
53 return obs_pressure_ptr;
56 auto &obs_pressure = *obs_pressure_ptr;
60 auto const volume = box_geo->volume();
61 auto const local_parts = cell_structure->local_particles();
63 for (
auto const &p : local_parts) {
67 auto const coulomb_force_kernel = coulomb.pair_force_kernel();
68 auto const coulomb_pressure_kernel = coulomb.pair_pressure_kernel();
71 [
this, coulomb_force_kernel_ptr =
get_ptr(coulomb_force_kernel),
72 &obs_pressure](
Particle const &p1,
int bond_id,
73 std::span<Particle *> partners) {
74 auto const &iaparams = *bonded_ias->at(bond_id);
76 iaparams, p1, partners, *box_geo, coulomb_force_kernel_ptr);
78 auto const &tensor = result.value();
80 for (std::size_t k = 0u; k < 3u; k++)
81 for (std::size_t l = 0u; l < 3u; l++)
82 obs_pressure.bonded_contribution(bond_id)[k * 3u + l] +=
89 [coulomb_force_kernel_ptr =
get_ptr(coulomb_force_kernel),
90 coulomb_pressure_kernel_ptr =
get_ptr(coulomb_pressure_kernel),
this,
93 auto const &ia_params =
94 nonbonded_ias->get_ia_param(p1.
type(), p2.type());
96 *bonded_ias, coulomb_force_kernel_ptr,
97 coulomb_pressure_kernel_ptr, obs_pressure);
99 *cell_structure, maximal_cutoff(), bonded_ias->maximal_cutoff());
103 auto const coulomb_pressure = coulomb.calc_pressure_long_range(local_parts);
104 std::ranges::copy(coulomb_pressure, obs_pressure.coulomb.begin() + 9u);
111#ifdef VIRTUAL_SITES_RELATIVE
112 if (!obs_pressure.virtual_sites.empty()) {
115 obs_pressure.virtual_sites.begin());
119 obs_pressure.rescale(volume);
121 obs_pressure.mpi_reduce();
122 return obs_pressure_ptr;
void add_non_bonded_pair_virials(Particle const &p1, Particle const &p2, Utils::Vector3d const &d, double dist, IA_parameters const &ia_params, BondedInteractionsMap const &bonded_ias, Coulomb::ShortRangeForceKernel::kernel_type const *kernel_forces, Coulomb::ShortRangePressureKernel::kernel_type const *kernel_pressure, Observable_stat &obs_pressure)
Calculate non-bonded energies between a pair of particles.
std::optional< Utils::Matrix< double, 3, 3 > > calc_bonded_pressure_tensor(Bonded_IA_Parameters const &iaparams, Particle const &p1, std::span< Particle * > partners, BoxGeometry const &box_geo, Coulomb::ShortRangeForceKernel::kernel_type const *kernel)
void short_range_loop(BondKernel bond_kernel, PairKernel pair_kernel, CellStructure &cell_structure, double pair_cutoff, double bond_cutoff, VerletCriterion const &verlet_criterion={})
Struct holding all information for one particle.
auto const & type() const