32#include <boost/container/vector.hpp>
33#include <boost/serialization/is_bitwise_serializable.hpp>
34#include <boost/serialization/level.hpp>
35#include <boost/serialization/vector.hpp>
43inline bool get_nth_bit(uint8_t
const bitfield,
unsigned int const bit_idx) {
44 return bitfield & (1u << bit_idx);
58 template <
class Archive>
void serialize(Archive &ar,
long int ) {
89 uint8_t
rotation =
static_cast<uint8_t
>(0b000u);
92 static constexpr uint8_t
rotation =
static_cast<uint8_t
>(0b000u);
106 static constexpr uint8_t
ext_flag =
static_cast<uint8_t
>(0b000u);
113 constexpr static double mass{1.0};
117#ifdef ROTATIONAL_INERTIA
127 constexpr static double q{0.0};
130#ifdef LB_ELECTROHYDRODYNAMICS
140#ifdef DIPOLE_FIELD_TRACKING
145#ifdef VIRTUAL_SITES_RELATIVE
161 template <
class Archive>
void serialize(Archive &ar,
long int) {
170#ifdef THERMOSTAT_PER_PARTICLE
172#ifndef PARTICLE_ANISOTROPY
179#ifndef PARTICLE_ANISOTROPY
187#ifdef EXTERNAL_FORCES
200 template <
class Archive>
void serialize(Archive &ar,
long int ) {
209#ifdef ROTATIONAL_INERTIA
219#ifdef LB_ELECTROHYDRODYNAMICS
225#ifdef DIPOLE_FIELD_TRACKING
228#ifdef VIRTUAL_SITES_RELATIVE
232#ifdef THERMOSTAT_PER_PARTICLE
238#ifdef EXTERNAL_FORCES
270#ifdef BOND_CONSTRAINT
275 template <
class Archive>
void serialize(Archive &ar,
long int ) {
281#ifdef BOND_CONSTRAINT
323 template <
class Archive>
void serialize(Archive &ar,
long int ) {
346 template <
class Archive>
void serialize(Archive &ar,
long int ) {
366 template <
class Archive>
void serialize(Archive &ar,
long int ) {
374#ifdef BOND_CONSTRAINT
385 return *
this = *
this + rhs;
388 template <
class Archive>
void serialize(Archive &ar,
long int ) {
402#ifdef BOND_CONSTRAINT
428 auto const &
bonds()
const {
return bl; }
431 auto const &
pos()
const {
return r.
p; }
433 auto const &
v()
const {
return m.
v; }
434 auto &
v() {
return m.
v; }
435 auto const &
force()
const {
return f.
f; }
455 constexpr auto &
mass()
const {
return p.
mass; }
463 return detail::get_nth_bit(p.
rotation, axis);
468 p.
rotation |=
static_cast<uint8_t
>(1u << axis);
470 p.
rotation &=
static_cast<uint8_t
>(~(1u << axis));
475 p.
rotation =
static_cast<uint8_t
>(0b000u);
483#ifdef EXTERNAL_FORCES
497#ifdef DIPOLE_FIELD_TRACKING
501#ifdef ROTATIONAL_INERTIA
508 auto const &
q()
const {
return p.
q; }
509 auto &
q() {
return p.
q; }
511 constexpr auto &
q()
const {
return p.
q; }
513#ifdef LB_ELECTROHYDRODYNAMICS
524 constexpr auto is_virtual()
const {
return false; }
526#ifdef VIRTUAL_SITES_RELATIVE
530#ifdef THERMOSTAT_PER_PARTICLE
538#ifdef EXTERNAL_FORCES
544 return detail::get_nth_bit(p.
ext_flag, axis);
549 p.
ext_flag |=
static_cast<uint8_t
>(1u << axis);
551 p.
ext_flag &=
static_cast<uint8_t
>(~(1u << axis));
558 constexpr bool is_fixed_along(
unsigned int const)
const {
return false; }
564#ifdef BOND_CONSTRAINT
577 return std::find(el.begin(), el.end(), pid) != el.end();
582 friend boost::serialization::access;
583 template <
class Archive>
void serialize(Archive &ar,
long int ) {
596BOOST_CLASS_IMPLEMENTATION(
Particle, object_serializable)
603BOOST_CLASS_IMPLEMENTATION(
ParticleForce, object_serializable)
604BOOST_CLASS_IMPLEMENTATION(
ParticleLocal, object_serializable)
605#ifdef BOND_CONSTRAINT
608#ifdef VIRTUAL_SITES_RELATIVE
621#ifdef BOND_CONSTRAINT
624#ifdef VIRTUAL_SITES_RELATIVE
Vector implementation and trait types for boost qvm interoperability.
Custom vector container optimized for size.
This file contains the defaults for ESPResSo.
Vector< T, 3 > convert_quaternion_to_director(Quaternion< T > const &quat)
Convert quaternion to director.
Quaternion implementation and trait types for boost qvm interoperability.
Force information on a particle.
Utils::Vector3d torque
torque.
ParticleForce(const Utils::Vector3d &f, const Utils::Vector3d &torque)
void serialize(Archive &ar, long int)
friend ParticleForce operator+(ParticleForce const &lhs, ParticleForce const &rhs)
ParticleForce(const Utils::Vector3d &f)
ParticleForce(ParticleForce const &)=default
ParticleForce & operator+=(ParticleForce const &rhs)
ParticleForce & operator=(ParticleForce const &)=default
Information on a particle that is needed only on the node the particle belongs to.
bool ghost
is particle a ghost particle.
short int lees_edwards_flag
void serialize(Archive &ar, long int)
double lees_edwards_offset
Accumulated applied Lees-Edwards offset.
Utils::Vector3d p_old
position from the last Verlet list update.
Momentum information on a particle.
Utils::Vector3d v
velocity.
Utils::Vector3d omega
angular velocity.
void serialize(Archive &ar, long int)
Properties of a self-propelled particle.
void serialize(Archive &ar, long int)
bool swimming
Is the particle a swimmer.
bool is_engine_force_on_fluid
Whether f_swim is applied to the particle or to the fluid.
double f_swim
Imposed constant force.
Positional information on a particle.
Utils::Vector3d calc_director() const
unit director calculated from the quaternion
Utils::Quaternion< double > quat
quaternion to define particle orientation
Utils::Vector3i i
index of the simulation box image where the particle really sits.
Utils::Vector3d p_last_timestep
particle position at the previous time step (RATTLE algorithm)
void serialize(Archive &ar, long int)
Utils::Vector3d p
periodically folded position.
The following properties define, with respect to which real particle a virtual site is placed and at ...
void serialize(Archive &ar, long int)
Utils::Quaternion< double > rel_orientation
Relative position of the virtual site.
Utils::Quaternion< double > quat
Orientation of the virtual particle in the body fixed frame.
Properties of a particle which are not supposed to change during the integration, but have to be know...
Utils::Vector3d gamma_rot
Friction coefficient for rotation.
double dipm
dipole moment (absolute value)
Utils::Vector3d rinertia
rotational inertia
ParticleParametersSwimming swim
int identity
unique identifier for the particle.
Utils::Vector3d ext_torque
External torque.
void serialize(Archive &ar, long int)
Utils::Vector3d ext_force
External force.
Utils::Vector3d mu_E
electrophoretic mobility times E-field: mu_0 * E
int mol_id
Molecule identifier.
Utils::Vector3d dip_fld
total dipole field
uint8_t ext_flag
Flag for fixed particle coordinates.
int propagation
which propagation schemes should be applied to the particle
struct ParticleProperties::VirtualSitesRelativeParameters vs_relative
Utils::Vector3d gamma
Friction coefficient for translation.
uint8_t rotation
Bitfield for the particle axes of rotation.
int type
particle type, used for non-bonded interactions.
friend ParticleRattle operator+(ParticleRattle const &lhs, ParticleRattle const &rhs)
Utils::Vector3d correction
position/velocity correction
ParticleRattle & operator+=(ParticleRattle const &rhs)
void serialize(Archive &ar, long int)
Struct holding all information for one particle.
auto const & dip_fld() const
bool has_exclusion(int pid) const
auto const & swimming() const
auto const & rattle_params() const
auto & lees_edwards_offset()
auto const & lees_edwards_offset() const
auto const & propagation() const
auto const & rinertia() const
Utils::compact_vector< int > const & exclusions() const
auto const & mass() const
Utils::compact_vector< int > & exclusions()
auto & force_and_torque()
auto const & quat() const
bool has_fixed_coordinates() const
auto const & rotation() const
auto & rattle_correction()
bool operator==(Particle const &rhs) const
auto const & vs_relative() const
void set_can_rotate_around(unsigned int const axis, bool const rot_flag)
auto & pos_at_last_verlet_update()
auto const & gamma() const
auto & lees_edwards_flag()
void set_ghost(bool const ghost_flag)
auto const & pos_at_last_verlet_update() const
auto const & pos_last_time_step() const
bool can_rotate_around(unsigned int const axis) const
auto const & gamma_rot() const
auto const & force_and_torque() const
auto const & lees_edwards_flag() const
void set_fixed_along(int const axis, bool const fixed_flag)
auto const & torque() const
auto const & fixed() const
auto const & ext_force() const
auto const & omega() const
auto const & image_box() const
auto const & type() const
auto const & ext_torque() const
auto const & bonds() const
bool operator!=(Particle const &rhs) const
auto const & dipm() const
auto const & mol_id() const
void set_cannot_rotate_all_axes()
bool is_fixed_along(unsigned int const axis) const
void set_can_rotate_all_axes()
auto & pos_last_time_step()
auto const & mu_E() const
auto const & force() const
auto const & rattle_correction() const
auto calc_director() const
Quaternion representation.
static Quaternion< T > identity()
Construct an identity quaternion.