39#ifdef ESPRESSO_VIRTUAL_SITES_CENTER_OF_MASS
46#include "communication.hpp"
51#include <boost/archive/text_iarchive.hpp>
52#include <boost/archive/text_oarchive.hpp>
53#include <boost/mpi/collectives/all_gather.hpp>
54#include <boost/mpi/collectives/all_reduce.hpp>
55#include <boost/mpi/collectives/broadcast.hpp>
56#include <boost/serialization/unordered_set.hpp>
57#include <boost/serialization/utility.hpp>
58#include <boost/serialization/vector.hpp>
65#include <unordered_map>
66#include <unordered_set>
82 template <
class Archive>
99 std::vector<int>
pids;
103 pids.emplace_back(p.id());
108 std::optional<int> result = std::nullopt;
111 result =
pids.front();
122template <
typename K,
typename V>
192 auto const total_mass =
194 auto const weighted_position =
222 vs_ptr->image_box() = image_box;
Vector implementation and trait types for boost qvm interoperability.
This file contains everything related to the global cell structure / cell system.
auto unfolded_position(Utils::Vector3d const &pos, Utils::Vector3i const &image_box) const
Unfold particle coordinates to image box.
void fold_position(Utils::Vector3d &pos, Utils::Vector3i &image_box) const
Fold coordinates to primary simulation box in-place.
Describes a cell structure / cell system.
Particle * get_local_particle(int id)
Get a local particle by id.
void ghosts_update(unsigned data_parts)
Update ghost particles.
void ghosts_reset_forces()
Set forces and torques on all ghosts to zero.
void ghosts_reduce_forces()
Add forces and torques from ghost particles to real particles.
void for_each_local_particle(ParticleUnaryOp &&f, bool parallel=true) const
Run a kernel on all local particles.
static bool is_vs_com(Particle const &p)
void vs_com_back_transfer_forces_and_torques(CellStructure &cell_structure)
std::optional< int > get_pid_for_vs_com(CellStructure &cell_structure, int mol_id)
decltype(ParticleProperties::mol_id) MoleculeId
void gather_buffer_map(std::unordered_map< K, V > &map_data)
Synchronize a map across all MPI ranks.
void vs_com_update_particles(CellStructure &cell_structure, BoxGeometry const &box_geo)
decltype(ParticleProperties::identity) ParticleId
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
boost::mpi::communicator comm_cart
The communicator.
@ DATA_PART_POSITION
Particle::r.
@ TRANS_VS_CENTER_OF_MASS
void gather_buffer(std::vector< T, Allocator > &buffer, boost::mpi::communicator const &comm, int root=0)
Gather buffer with different size on each node.
Center of mass information for a molecule.
void serialize(Archive &ar, unsigned int const version)
double total_mass
Sum of the masses of all constituent particles.
friend class boost::serialization::access
Utils::Vector3d weighted_position
Sum of (mass * position) for all constituent particles.
int identity
unique identifier for the particle.
int mol_id
Molecule identifier.
Struct holding all information for one particle.
auto const & propagation() const
auto const & mass() const
auto const & image_box() const
auto const & mol_id() const
auto const & force() const