52 auto obs_pressure_ptr = std::make_shared<Observable_stat>(
53 9ul,
static_cast<std::size_t
>(bonded_ias->get_next_key()),
54 nonbonded_ias->get_max_seen_particle_type());
56 if (long_range_interactions_sanity_checks()) {
57 return obs_pressure_ptr;
60 auto &obs_pressure = *obs_pressure_ptr;
64 auto const volume = box_geo->volume();
67 auto const kinetic = reduce_over_local_particles<Utils::Matrix<double, 3, 3>>(
73 [](
auto &a,
auto const &b) { a += b; });
74 std::ranges::copy(
Utils::flatten(kinetic), obs_pressure.kinetic_lin.begin());
76 auto const coulomb_force_kernel = coulomb.pair_force_kernel();
77 auto const coulomb_pressure_kernel = coulomb.pair_pressure_kernel();
80 cell_structure->get_verlet_skin(),
81 get_interaction_range(),
86 get_interaction_range(), propagation->integ_switch);
89 static_cast<std::size_t
>(bonded_ias->get_next_key()),
90 std::size_t(nonbonded_ias->get_max_seen_particle_type() + 1)};
92 using exec = Kokkos::DefaultExecutionSpace;
93 Kokkos::View<double **, Kokkos::LayoutRight> local_pressure(
94 "local_pressure", exec().concurrency(), layout.total * 9);
96 auto const &unique_particles = cell_structure->get_unique_particles();
97 auto const n_particles =
static_cast<int>(unique_particles.size());
98 Kokkos::View<int *> mol_id_view(
"mol_id", n_particles);
99 auto mol_id_host = Kokkos::create_mirror_view(mol_id_view);
100 for (
int i = 0; i < n_particles; ++i)
101 mol_id_host(i) = unique_particles[i]->mol_id();
102 Kokkos::deep_copy(mol_id_view, mol_id_host);
108 get_ptr(coulomb_pressure_kernel),
110 cell_structure->get_unique_particles(),
113 cell_structure->get_aosoa(),
118 auto &bs = cell_structure->bond_state();
120 layout, cell_structure->get_aosoa()};
122 bonds_p_data, bs.pair_list, bs.pair_ids,
get_ptr(coulomb_force_kernel)};
128 pair_p_kernel, *cell_structure, get_interaction_range(),
129 bonded_ias->maximal_cutoff(), verlet_criterion,
130 propagation->integ_switch);
133 nonbonded_ias->get_max_seen_particle_type() + 1);
135#ifdef ESPRESSO_ELECTROSTATICS
137 auto const coulomb_pressure = coulomb.calc_pressure_long_range();
138 std::ranges::copy(coulomb_pressure, obs_pressure.coulomb.begin() + 9u);
140#ifdef ESPRESSO_DIPOLES
142 dipoles.calc_pressure_long_range();
145#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
146 if (!obs_pressure.virtual_sites.empty()) {
149 obs_pressure.virtual_sites.begin());
153 obs_pressure.rescale(volume);
155 obs_pressure.mpi_reduce();
156 return obs_pressure_ptr;
void cabana_short_range(auto const &pair_bonds_kernel, auto const &angle_bonds_kernel, auto const &dihedral_bonds_kernel, auto const &nonbonded_kernel, CellStructure &cell_structure, double pair_cutoff, double bond_cutoff, auto const &verlet_criterion, auto const integ_switch)
Struct holding all information for one particle.