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 ) {
64#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
94 template <
class Archive>
void serialize(Archive &ar,
long int ) {
117#ifdef ESPRESSO_ROTATION
129 static constexpr uint8_t
rotation =
static_cast<uint8_t
>(0b000u);
132#ifdef ESPRESSO_EXTERNAL_FORCES
143 static constexpr uint8_t
ext_flag =
static_cast<uint8_t
>(0b000u);
150 constexpr static double mass{1.0};
154#ifdef ESPRESSO_ROTATIONAL_INERTIA
161#ifdef ESPRESSO_ELECTROSTATICS
164 constexpr static double q{0.0};
167#ifdef ESPRESSO_LB_ELECTROHYDRODYNAMICS
172#ifdef ESPRESSO_DIPOLES
177#ifdef ESPRESSO_DIPOLE_FIELD_TRACKING
182#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
198 template <
class Archive>
void serialize(Archive &ar,
long int) {
207#ifdef ESPRESSO_VIRTUAL_SITES_CENTER_OF_MASS
213 template <
class Archive>
void serialize(Archive &ar,
long int) {
219#ifdef ESPRESSO_THERMOSTAT_PER_PARTICLE
221#ifndef ESPRESSO_PARTICLE_ANISOTROPY
226#ifdef ESPRESSO_ROTATION
228#ifndef ESPRESSO_PARTICLE_ANISOTROPY
236#ifdef ESPRESSO_EXTERNAL_FORCES
239#ifdef ESPRESSO_ROTATION
245#ifdef ESPRESSO_ENGINE
249#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
253 template <
class Archive>
void serialize(Archive &ar,
long int ) {
261#ifdef ESPRESSO_ROTATIONAL_INERTIA
264#ifdef ESPRESSO_ROTATION
267#ifdef ESPRESSO_ELECTROSTATICS
270#ifdef ESPRESSO_LB_ELECTROHYDRODYNAMICS
273#ifdef ESPRESSO_DIPOLES
276#ifdef ESPRESSO_DIPOLE_FIELD_TRACKING
279#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
282#ifdef ESPRESSO_VIRTUAL_SITES_CENTER_OF_MASS
285#ifdef ESPRESSO_THERMOSTAT_PER_PARTICLE
287#ifdef ESPRESSO_ROTATION
291#ifdef ESPRESSO_EXTERNAL_FORCES
294#ifdef ESPRESSO_ROTATION
298#ifdef ESPRESSO_ENGINE
301#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
316#ifdef ESPRESSO_ROTATION
325#ifdef ESPRESSO_BOND_CONSTRAINT
330 template <
class Archive>
void serialize(Archive &ar,
long int ) {
333#ifdef ESPRESSO_ROTATION
336#ifdef ESPRESSO_BOND_CONSTRAINT
350#ifdef ESPRESSO_ROTATION
364#ifdef ESPRESSO_ROTATION
373#ifdef ESPRESSO_ROTATION
378 template <
class Archive>
void serialize(Archive &ar,
long int ) {
380#ifdef ESPRESSO_ROTATION
394#ifdef ESPRESSO_ROTATION
401 template <
class Archive>
void serialize(Archive &ar,
long int ) {
403#ifdef ESPRESSO_ROTATION
421 template <
class Archive>
void serialize(Archive &ar,
long int ) {
429#ifdef ESPRESSO_BOND_CONSTRAINT
440 return *
this = *
this + rhs;
443 template <
class Archive>
void serialize(Archive &ar,
long int ) {
457#ifdef ESPRESSO_BOND_CONSTRAINT
461#ifdef ESPRESSO_EXCLUSIONS
483 auto const &
bonds()
const {
return bl; }
486 auto const &
pos()
const {
return r.
p; }
488 auto const &
v()
const {
return m.
v; }
489 auto &
v() {
return m.
v; }
490 auto const &
force()
const {
return f.
f; }
510 constexpr auto &
mass()
const {
return p.
mass; }
512#ifdef ESPRESSO_ROTATION
518 return detail::get_nth_bit(p.
rotation, axis);
523 p.
rotation |=
static_cast<uint8_t
>(1u << axis);
525 p.
rotation &=
static_cast<uint8_t
>(~(1u << axis));
530 p.
rotation =
static_cast<uint8_t
>(0b000u);
538#ifdef ESPRESSO_EXTERNAL_FORCES
547#ifdef ESPRESSO_DIPOLES
552#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
582#ifdef ESPRESSO_DIPOLE_FIELD_TRACKING
586#ifdef ESPRESSO_ROTATIONAL_INERTIA
592#ifdef ESPRESSO_ELECTROSTATICS
593 auto const &
q()
const {
return p.
q; }
594 auto &
q() {
return p.
q; }
596 constexpr auto &
q()
const {
return p.
q; }
598#ifdef ESPRESSO_LB_ELECTROHYDRODYNAMICS
602#ifdef ESPRESSO_VIRTUAL_SITES
611 constexpr auto is_virtual()
const {
return false; }
613#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
617#ifdef ESPRESSO_VIRTUAL_SITES_CENTER_OF_MASS
621#ifdef ESPRESSO_THERMOSTAT_PER_PARTICLE
624#ifdef ESPRESSO_ROTATION
629#ifdef ESPRESSO_EXTERNAL_FORCES
635 return detail::get_nth_bit(p.
ext_flag, axis);
640 p.
ext_flag |=
static_cast<uint8_t
>(1u << axis);
642 p.
ext_flag &=
static_cast<uint8_t
>(~(1u << axis));
649 constexpr bool is_fixed_along(
unsigned int const)
const {
return false; }
651#ifdef ESPRESSO_ENGINE
655#ifdef ESPRESSO_BOND_CONSTRAINT
664#ifdef ESPRESSO_EXCLUSIONS
668 return std::ranges::find(el, pid) != el.end();
673 friend boost::serialization::access;
674 template <
class Archive>
void serialize(Archive &ar,
long int ) {
681#ifdef ESPRESSO_EXCLUSIONS
687BOOST_CLASS_IMPLEMENTATION(
Particle, object_serializable)
688#ifdef ESPRESSO_ENGINE
691#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
698BOOST_CLASS_IMPLEMENTATION(
ParticleForce, object_serializable)
699BOOST_CLASS_IMPLEMENTATION(
ParticleLocal, object_serializable)
700#ifdef ESPRESSO_BOND_CONSTRAINT
703#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
707#ifdef ESPRESSO_VIRTUAL_SITES_CENTER_OF_MASS
712#ifdef ESPRESSO_ENGINE
715#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
723#ifdef ESPRESSO_BOND_CONSTRAINT
726#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
729#ifdef ESPRESSO_VIRTUAL_SITES_CENTER_OF_MASS
Vector implementation and trait types for boost qvm interoperability.
Custom vector container optimized for size.
@ TRANS_VS_CENTER_OF_MASS
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.
Relate this particle to a molecule center of mass.
void serialize(Archive &ar, long int)
int to_molecule_id
Store molecule id tracked by virtual site.
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
ThermalStonerWohlfarthParameters magnetodynamics
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.
struct ParticleProperties::VirtualSitesCenterOfMassParameters vs_com
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 & stoner_wohlfarth_phi_0()
auto const & lees_edwards_offset() const
auto const & propagation() const
auto const & magnetic_anisotropy_energy() const
auto const & rinertia() const
auto const & stoner_wohlfarth_phi_0() const
Utils::compact_vector< int > const & exclusions() const
auto const & mass() const
auto const & magnetic_anisotropy_field_inv() const
Utils::compact_vector< int > & exclusions()
auto & stoner_wohlfarth_dt_incr()
auto & force_and_torque()
auto const & quat() const
auto & magnetic_anisotropy_energy()
auto const & vs_com() const
bool has_fixed_coordinates() const
auto const & rotation() const
auto & rattle_correction()
bool operator==(Particle const &rhs) const
auto & magnetic_anisotropy_field_inv()
auto const & vs_relative() const
auto const & stoner_wohlfarth_tau0_inv() 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 & saturation_magnetization() const
auto const & force_and_torque() const
auto const & stoner_wohlfarth_dt_incr() const
auto const & lees_edwards_flag() const
auto & stoner_wohlfarth_is_enabled()
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 & saturation_magnetization()
auto const & image_box() const
auto const & stoner_wohlfarth_is_enabled() 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
auto & stoner_wohlfarth_tau0_inv()
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
Properties for thermal Stoner-Wohlfarth magnetodynamics.
bool is_enabled
Flag to distinguish virtual particles carrying the dipole moment in the thermal Stoner-Wohlfarth mode...
double tau0_inv
Browns attempt frequency.
double ani_energy
Magnetic anisotropy energy (K1 * V) in units of energy.
void serialize(Archive &ar, long int)
double dt_incr
time units parameter for the kinetic Monte Carlo step
double ani_fld_inv
Inverse anisotropy field in reduced units.
double sat_mag
saturation magnetisation of a polarisable particle
double phi0
angle between the director and dipole moment of a Stoner-Wohlfarth particle
Quaternion representation.
static Quaternion< T > identity()
Construct an identity quaternion.