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_THERMOSTAT_PER_PARTICLE
209#ifndef ESPRESSO_PARTICLE_ANISOTROPY
214#ifdef ESPRESSO_ROTATION
216#ifndef ESPRESSO_PARTICLE_ANISOTROPY
224#ifdef ESPRESSO_EXTERNAL_FORCES
227#ifdef ESPRESSO_ROTATION
233#ifdef ESPRESSO_ENGINE
237#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
241 template <
class Archive>
void serialize(Archive &ar,
long int ) {
249#ifdef ESPRESSO_ROTATIONAL_INERTIA
252#ifdef ESPRESSO_ROTATION
255#ifdef ESPRESSO_ELECTROSTATICS
258#ifdef ESPRESSO_LB_ELECTROHYDRODYNAMICS
261#ifdef ESPRESSO_DIPOLES
264#ifdef ESPRESSO_DIPOLE_FIELD_TRACKING
267#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
270#ifdef ESPRESSO_THERMOSTAT_PER_PARTICLE
272#ifdef ESPRESSO_ROTATION
276#ifdef ESPRESSO_EXTERNAL_FORCES
279#ifdef ESPRESSO_ROTATION
283#ifdef ESPRESSO_ENGINE
286#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
301#ifdef ESPRESSO_ROTATION
310#ifdef ESPRESSO_BOND_CONSTRAINT
315 template <
class Archive>
void serialize(Archive &ar,
long int ) {
318#ifdef ESPRESSO_ROTATION
321#ifdef ESPRESSO_BOND_CONSTRAINT
335#ifdef ESPRESSO_ROTATION
349#ifdef ESPRESSO_ROTATION
358#ifdef ESPRESSO_ROTATION
363 template <
class Archive>
void serialize(Archive &ar,
long int ) {
365#ifdef ESPRESSO_ROTATION
379#ifdef ESPRESSO_ROTATION
386 template <
class Archive>
void serialize(Archive &ar,
long int ) {
388#ifdef ESPRESSO_ROTATION
406 template <
class Archive>
void serialize(Archive &ar,
long int ) {
414#ifdef ESPRESSO_BOND_CONSTRAINT
425 return *
this = *
this + rhs;
428 template <
class Archive>
void serialize(Archive &ar,
long int ) {
442#ifdef ESPRESSO_BOND_CONSTRAINT
446#ifdef ESPRESSO_EXCLUSIONS
468 auto const &
bonds()
const {
return bl; }
471 auto const &
pos()
const {
return r.
p; }
473 auto const &
v()
const {
return m.
v; }
474 auto &
v() {
return m.
v; }
475 auto const &
force()
const {
return f.
f; }
495 constexpr auto &
mass()
const {
return p.
mass; }
497#ifdef ESPRESSO_ROTATION
503 return detail::get_nth_bit(p.
rotation, axis);
508 p.
rotation |=
static_cast<uint8_t
>(1u << axis);
510 p.
rotation &=
static_cast<uint8_t
>(~(1u << axis));
515 p.
rotation =
static_cast<uint8_t
>(0b000u);
523#ifdef ESPRESSO_EXTERNAL_FORCES
532#ifdef ESPRESSO_DIPOLES
537#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
567#ifdef ESPRESSO_DIPOLE_FIELD_TRACKING
571#ifdef ESPRESSO_ROTATIONAL_INERTIA
577#ifdef ESPRESSO_ELECTROSTATICS
578 auto const &
q()
const {
return p.
q; }
579 auto &
q() {
return p.
q; }
581 constexpr auto &
q()
const {
return p.
q; }
583#ifdef ESPRESSO_LB_ELECTROHYDRODYNAMICS
587#ifdef ESPRESSO_VIRTUAL_SITES
596 constexpr auto is_virtual()
const {
return false; }
598#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
602#ifdef ESPRESSO_THERMOSTAT_PER_PARTICLE
605#ifdef ESPRESSO_ROTATION
610#ifdef ESPRESSO_EXTERNAL_FORCES
616 return detail::get_nth_bit(p.
ext_flag, axis);
621 p.
ext_flag |=
static_cast<uint8_t
>(1u << axis);
623 p.
ext_flag &=
static_cast<uint8_t
>(~(1u << axis));
630 constexpr bool is_fixed_along(
unsigned int const)
const {
return false; }
632#ifdef ESPRESSO_ENGINE
636#ifdef ESPRESSO_BOND_CONSTRAINT
645#ifdef ESPRESSO_EXCLUSIONS
649 return std::ranges::find(el, pid) != el.end();
654 friend boost::serialization::access;
655 template <
class Archive>
void serialize(Archive &ar,
long int ) {
662#ifdef ESPRESSO_EXCLUSIONS
668BOOST_CLASS_IMPLEMENTATION(
Particle, object_serializable)
669#ifdef ESPRESSO_ENGINE
672#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
679BOOST_CLASS_IMPLEMENTATION(
ParticleForce, object_serializable)
680BOOST_CLASS_IMPLEMENTATION(
ParticleLocal, object_serializable)
681#ifdef ESPRESSO_BOND_CONSTRAINT
684#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
689#ifdef ESPRESSO_ENGINE
692#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
700#ifdef ESPRESSO_BOND_CONSTRAINT
703#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
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.
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.
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()
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.