22#include "galilei/Galilei.hpp"
28#include "communication.hpp"
30#include "system/System.hpp"
32#include <boost/mpi/collectives/all_reduce.hpp>
70 auto const &box_geo = *system.
box_geo;
74 if (not p.is_virtual()) {
75 total_mass += p.mass();
76 cms_pos += p.mass() * box_geo.unfolded_position(p.pos(), p.image_box());
79 total_mass = boost::mpi::all_reduce(
comm_cart, total_mass, std::plus<>());
80 cms_pos = boost::mpi::all_reduce(
comm_cart, cms_pos, std::plus<>());
81 cms_pos /= total_mass;
90 if (not p.is_virtual()) {
91 total_mass += p.mass();
92 cms_vel += p.mass() * p.v();
95 total_mass = boost::mpi::all_reduce(
comm_cart, total_mass, std::plus<>());
96 cms_vel = boost::mpi::all_reduce(
comm_cart, cms_vel, std::plus<>());
97 cms_vel /= total_mass;
Vector implementation and trait types for boost qvm interoperability.
void kill_particle_motion(System::System &system, bool omega) const
Stop particle motion by setting the velocity of each particle to zero.
void galilei_transform(System::System &system) const
Remove the CMS velocity.
Utils::Vector3d calc_system_cms_velocity(System::System const &system) const
Calculate the CMS velocity of the system.
Utils::Vector3d calc_system_cms_position(System::System const &system) const
Calculate the CMS of the system.
void kill_particle_forces(System::System &system, bool torque) const
Set all the forces acting on the particles to zero.
void on_particle_change()
Called every time a particle property changes.
std::shared_ptr< CellStructure > cell_structure
std::shared_ptr< BoxGeometry > box_geo
boost::mpi::communicator comm_cart
The communicator.
This file contains the defaults for ESPResSo.