ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
Particle.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2022 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <config/config.hpp>
23
24#include "BondList.hpp"
25#include "PropagationMode.hpp"
26
27#include <utils/Vector.hpp>
30#include <utils/quaternion.hpp>
31
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>
36
37#include <algorithm>
38#include <cassert>
39#include <cstdint>
40#include <vector>
41
42namespace detail {
43inline bool get_nth_bit(uint8_t const bitfield, unsigned int const bit_idx) {
44 return bitfield & (1u << bit_idx);
45}
46} // namespace detail
47
48#ifdef ESPRESSO_ENGINE
49/** Properties of a self-propelled particle. */
51 /** Imposed constant force. */
52 double f_swim = 0.;
53 /** Is the particle a swimmer. */
54 bool swimming = false;
55 /** Whether f_swim is applied to the particle or to the fluid. */
57
58 template <class Archive> void serialize(Archive &ar, long int /* version */) {
60 }
61};
62#endif
63
64#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
65/** Properties for thermal Stoner-Wohlfarth magnetodynamics. */
67 /**
68 * Flag to distinguish virtual particles carrying the dipole moment in
69 * the thermal Stoner-Wohlfarth model from other types of virtual sites.
70 */
71 bool is_enabled = false;
72 /** angle between the director and dipole moment of a Stoner-Wohlfarth
73 * particle */
74 double phi0 = 0.;
75 /** saturation magnetisation of a polarisable particle */
76 double sat_mag = 0.;
77 /**
78 * @brief Inverse anisotropy field in reduced units.
79 * anisotropy field = 2.*K1/(mu0 * Ms) in [A / m] where K1 is the magnetic
80 * anisotropy constant [kg / (m s^2)].
81 */
82 double ani_fld_inv = 0.;
83 /**
84 * @brief Magnetic anisotropy energy (K1 * V) in units of energy.
85 * Related to ani_param from Eq.3 in @cite mostarac25a
86 * by: ani_param = ani_energy / kT
87 */
88 double ani_energy = 0.;
89 /** Browns attempt frequency. Prefactor from Eq.9 in @cite mostarac25a. */
90 double tau0_inv = 0.;
91 /** time units parameter for the kinetic Monte Carlo step */
92 double dt_incr = 0.;
93
94 template <class Archive> void serialize(Archive &ar, long int /* version */) {
96 dt_incr;
97 }
98};
99#endif // ESPRESSO_THERMAL_STONER_WOHLFARTH
100
101/** Properties of a particle which are not supposed to
102 * change during the integration, but have to be known
103 * for all ghosts. Ghosts are particles which are
104 * needed in the interaction calculation, but are just copies of
105 * particles stored on different nodes.
106 */
108 /** unique identifier for the particle. */
109 int identity = -1;
110 /** Molecule identifier. */
111 int mol_id = 0;
112 /** particle type, used for non-bonded interactions. */
113 int type = 0;
114 /** which propagation schemes should be applied to the particle **/
116
117#ifdef ESPRESSO_ROTATION
118 /** Bitfield for the particle axes of rotation.
119 * Values:
120 * - 0: no rotation
121 * - 1: allow rotation around the x axis
122 * - 2: allow rotation around the y axis
123 * - 4: allow rotation around the z axis
124 * By default, the particle cannot rotate.
125 */
126 uint8_t rotation = static_cast<uint8_t>(0b000u);
127#else
128 /** Bitfield for the particle axes of rotation. Particle cannot rotate. */
129 static constexpr uint8_t rotation = static_cast<uint8_t>(0b000u);
130#endif
131
132#ifdef ESPRESSO_EXTERNAL_FORCES
133 /** Flag for fixed particle coordinates.
134 * Values:
135 * - 0: no fixed coordinates
136 * - 1: fix translation along the x axis
137 * - 2: fix translation along the y axis
138 * - 4: fix translation along the z axis
139 */
140 uint8_t ext_flag = static_cast<uint8_t>(0b000u);
141#else // ESPRESSO_EXTERNAL_FORCES
142 /** Bitfield for fixed particle coordinates. Coordinates cannot be fixed. */
143 static constexpr uint8_t ext_flag = static_cast<uint8_t>(0b000u);
144#endif // ESPRESSO_EXTERNAL_FORCES
145
146 /** particle mass */
147#ifdef ESPRESSO_MASS
148 double mass = 1.0;
149#else
150 constexpr static double mass{1.0};
151#endif
152
153 /** rotational inertia */
154#ifdef ESPRESSO_ROTATIONAL_INERTIA
155 Utils::Vector3d rinertia = {1., 1., 1.};
156#else
157 static constexpr Utils::Vector3d rinertia = {1., 1., 1.};
158#endif
159
160 /** charge. */
161#ifdef ESPRESSO_ELECTROSTATICS
162 double q = 0.0;
163#else
164 constexpr static double q{0.0};
165#endif
166
167#ifdef ESPRESSO_LB_ELECTROHYDRODYNAMICS
168 /** electrophoretic mobility times E-field: mu_0 * E */
169 Utils::Vector3d mu_E = {0., 0., 0.};
170#endif
171
172#ifdef ESPRESSO_DIPOLES
173 /** dipole moment (absolute value) */
174 double dipm = 0.;
175#endif
176
177#ifdef ESPRESSO_DIPOLE_FIELD_TRACKING
178 /** total dipole field */
179 Utils::Vector3d dip_fld = {0., 0., 0.};
180#endif
181
182#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
183 /** The following properties define, with respect to which real particle a
184 * virtual site is placed and at what distance. The relative orientation of
185 * the vector pointing from real particle to virtual site with respect to the
186 * orientation of the real particle is stored in the virtual site's
187 * quaternion attribute.
188 */
191 double distance = 0.;
192 /** Relative position of the virtual site. */
195 /** Orientation of the virtual particle in the body fixed frame. */
197
198 template <class Archive> void serialize(Archive &ar, long int) {
199 ar & to_particle_id;
200 ar & distance;
201 ar & rel_orientation;
202 ar & quat;
203 }
205#endif // ESPRESSO_VIRTUAL_SITES_RELATIVE
206
207#ifdef ESPRESSO_VIRTUAL_SITES_CENTER_OF_MASS
208 /** @brief Relate this particle to a molecule center of mass. */
210 /** @brief Store molecule id tracked by virtual site. */
212
213 template <class Archive> void serialize(Archive &ar, long int) {
214 ar & to_molecule_id;
215 }
217#endif // ESPRESSO_VIRTUAL_SITES_CENTER_OF_MASS
218
219#ifdef ESPRESSO_THERMOSTAT_PER_PARTICLE
220/** Friction coefficient for translation */
221#ifndef ESPRESSO_PARTICLE_ANISOTROPY
222 double gamma = -1.;
223#else
224 Utils::Vector3d gamma = {-1., -1., -1.};
225#endif // ESPRESSO_PARTICLE_ANISOTROPY
226#ifdef ESPRESSO_ROTATION
227/** Friction coefficient for rotation */
228#ifndef ESPRESSO_PARTICLE_ANISOTROPY
229 double gamma_rot = -1.;
230#else
231 Utils::Vector3d gamma_rot = {-1., -1., -1.};
232#endif // ESPRESSO_PARTICLE_ANISOTROPY
233#endif // ESPRESSO_ROTATION
234#endif // ESPRESSO_THERMOSTAT_PER_PARTICLE
235
236#ifdef ESPRESSO_EXTERNAL_FORCES
237 /** External force. */
239#ifdef ESPRESSO_ROTATION
240 /** External torque. */
242#endif // ESPRESSO_ROTATION
243#endif // ESPRESSO_EXTERNAL_FORCES
244
245#ifdef ESPRESSO_ENGINE
247#endif
248
249#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
251#endif
252
253 template <class Archive> void serialize(Archive &ar, long int /* version */) {
254 ar & identity;
255 ar & mol_id;
256 ar & type;
257 ar & propagation;
258#ifdef ESPRESSO_MASS
259 ar & mass;
260#endif
261#ifdef ESPRESSO_ROTATIONAL_INERTIA
262 ar & rinertia;
263#endif
264#ifdef ESPRESSO_ROTATION
265 ar & rotation;
266#endif
267#ifdef ESPRESSO_ELECTROSTATICS
268 ar & q;
269#endif
270#ifdef ESPRESSO_LB_ELECTROHYDRODYNAMICS
271 ar & mu_E;
272#endif
273#ifdef ESPRESSO_DIPOLES
274 ar & dipm;
275#endif
276#ifdef ESPRESSO_DIPOLE_FIELD_TRACKING
277 ar & dip_fld;
278#endif
279#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
280 ar & vs_relative;
281#endif
282#ifdef ESPRESSO_VIRTUAL_SITES_CENTER_OF_MASS
283 ar & vs_com;
284#endif
285#ifdef ESPRESSO_THERMOSTAT_PER_PARTICLE
286 ar & gamma;
287#ifdef ESPRESSO_ROTATION
288 ar & gamma_rot;
289#endif
290#endif // ESPRESSO_THERMOSTAT_PER_PARTICLE
291#ifdef ESPRESSO_EXTERNAL_FORCES
292 ar & ext_flag;
293 ar & ext_force;
294#ifdef ESPRESSO_ROTATION
295 ar & ext_torque;
296#endif
297#endif // ESPRESSO_EXTERNAL_FORCES
298#ifdef ESPRESSO_ENGINE
299 ar & swim;
300#endif
301#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
302 ar & magnetodynamics;
303#endif
304 }
305};
306
307/** Positional information on a particle. Information that is
308 * communicated to calculate interactions with ghost particles.
309 */
311 /** periodically folded position. */
312 Utils::Vector3d p = {0., 0., 0.};
313 /** index of the simulation box image where the particle really sits. */
314 Utils::Vector3i i = {0, 0, 0};
315
316#ifdef ESPRESSO_ROTATION
317 /** quaternion to define particle orientation */
319 /** unit director calculated from the quaternion */
323#endif
324
325#ifdef ESPRESSO_BOND_CONSTRAINT
326 /** particle position at the previous time step (RATTLE algorithm) */
328#endif
329
330 template <class Archive> void serialize(Archive &ar, long int /* version */) {
331 ar & p;
332 ar & i;
333#ifdef ESPRESSO_ROTATION
334 ar & quat;
335#endif
336#ifdef ESPRESSO_BOND_CONSTRAINT
337 ar & p_last_timestep;
338#endif
339 }
340};
341
342/** Force information on a particle. Forces of ghost particles are
343 * collected and added up to the force of the original particle.
344 */
346 ParticleForce() = default;
347 ParticleForce(ParticleForce const &) = default;
350#ifdef ESPRESSO_ROTATION
353#endif
354
356 ParticleForce const &rhs) {
357 ParticleForce result = lhs;
358 result += rhs;
359 return result;
360 }
361
363 f += rhs.f;
364#ifdef ESPRESSO_ROTATION
365 torque += rhs.torque;
366#endif
367 return *this;
368 }
369
370 /** force. */
371 Utils::Vector3d f = {0., 0., 0.};
372
373#ifdef ESPRESSO_ROTATION
374 /** torque. */
375 Utils::Vector3d torque = {0., 0., 0.};
376#endif
377
378 template <class Archive> void serialize(Archive &ar, long int /* version */) {
379 ar & f;
380#ifdef ESPRESSO_ROTATION
381 ar & torque;
382#endif
383 }
384};
385
386/** Momentum information on a particle. Information not contained in
387 * communication of ghost particles so far, but a communication would
388 * be necessary for velocity-dependent potentials.
389 */
391 /** velocity. */
392 Utils::Vector3d v = {0., 0., 0.};
393
394#ifdef ESPRESSO_ROTATION
395 /** angular velocity.
396 * ALWAYS IN PARTICLE FIXED, I.E., CO-ROTATING COORDINATE SYSTEM.
397 */
398 Utils::Vector3d omega = {0., 0., 0.};
399#endif
400
401 template <class Archive> void serialize(Archive &ar, long int /* version */) {
402 ar & v;
403#ifdef ESPRESSO_ROTATION
404 ar & omega;
405#endif
406 }
407};
408
409/** Information on a particle that is needed only on the
410 * node the particle belongs to.
411 */
413 /** is particle a ghost particle. */
414 bool ghost = false;
415 short int lees_edwards_flag = 0;
416 /** position from the last Verlet list update. */
417 Utils::Vector3d p_old = {0., 0., 0.};
418 /** Accumulated applied Lees-Edwards offset. */
420
421 template <class Archive> void serialize(Archive &ar, long int /* version */) {
422 ar & ghost;
424 ar & p_old;
426 }
427};
428
429#ifdef ESPRESSO_BOND_CONSTRAINT
431 /** position/velocity correction */
433
435 ParticleRattle const &rhs) {
436 return {lhs.correction + rhs.correction};
437 }
438
440 return *this = *this + rhs;
441 }
442
443 template <class Archive> void serialize(Archive &ar, long int /* version */) {
444 ar & correction;
445 }
446};
447#endif
448
449/** Struct holding all information for one particle. */
450struct Particle { // NOLINT(bugprone-exception-escape)
451private:
457#ifdef ESPRESSO_BOND_CONSTRAINT
458 ParticleRattle rattle;
459#endif
460 BondList bl;
461#ifdef ESPRESSO_EXCLUSIONS
462 /** list of particles, with which this particle has no non-bonded
463 * interactions
464 */
466#endif
467
468public:
469 auto const &id() const { return p.identity; }
470 auto &id() { return p.identity; }
471 auto const &mol_id() const { return p.mol_id; }
472 auto &mol_id() { return p.mol_id; }
473 auto const &type() const { return p.type; }
474 auto &type() { return p.type; }
475
476 auto const &propagation() const { return p.propagation; }
477 auto &propagation() { return p.propagation; }
478
479 bool operator==(Particle const &rhs) const { return id() == rhs.id(); }
480
481 bool operator!=(Particle const &rhs) const { return id() != rhs.id(); }
482
483 auto const &bonds() const { return bl; }
484 auto &bonds() { return bl; }
485
486 auto const &pos() const { return r.p; }
487 auto &pos() { 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; }
491 auto &force() { return f.f; }
492 auto const &force_and_torque() const { return f; }
493 auto &force_and_torque() { return f; }
494
495 bool is_ghost() const { return l.ghost; }
496 void set_ghost(bool const ghost_flag) { l.ghost = ghost_flag; }
497 auto &pos_at_last_verlet_update() { return l.p_old; }
498 auto const &pos_at_last_verlet_update() const { return l.p_old; }
499 auto const &image_box() const { return r.i; }
500 auto &image_box() { return r.i; }
501 auto const &lees_edwards_offset() const { return l.lees_edwards_offset; }
503 auto const &lees_edwards_flag() const { return l.lees_edwards_flag; }
505
506#ifdef ESPRESSO_MASS
507 auto const &mass() const { return p.mass; }
508 auto &mass() { return p.mass; }
509#else
510 constexpr auto &mass() const { return p.mass; }
511#endif
512#ifdef ESPRESSO_ROTATION
513 auto const &rotation() const { return p.rotation; }
514 auto &rotation() { return p.rotation; }
515 bool can_rotate() const { return static_cast<bool>(p.rotation); }
516 bool can_rotate_around(unsigned int const axis) const {
517 assert(axis <= 2u);
518 return detail::get_nth_bit(p.rotation, axis);
519 }
520 void set_can_rotate_around(unsigned int const axis, bool const rot_flag) {
521 assert(axis <= 2u);
522 if (rot_flag) {
523 p.rotation |= static_cast<uint8_t>(1u << axis);
524 } else {
525 p.rotation &= static_cast<uint8_t>(~(1u << axis));
526 }
527 }
528 void set_can_rotate_all_axes() { p.rotation = static_cast<uint8_t>(0b111u); }
530 p.rotation = static_cast<uint8_t>(0b000u);
531 }
532 auto const &quat() const { return r.quat; }
533 auto &quat() { return r.quat; }
534 auto const &torque() const { return f.torque; }
535 auto &torque() { return f.torque; }
536 auto const &omega() const { return m.omega; }
537 auto &omega() { return m.omega; }
538#ifdef ESPRESSO_EXTERNAL_FORCES
539 auto const &ext_torque() const { return p.ext_torque; }
540 auto &ext_torque() { return p.ext_torque; }
541#endif // ESPRESSO_EXTERNAL_FORCES
542 auto calc_director() const { return r.calc_director(); }
543#else // ESPRESSO_ROTATION
544 auto can_rotate() const { return false; }
545 auto can_rotate_around(unsigned int const) const { return false; }
546#endif // ESPRESSO_ROTATION
547#ifdef ESPRESSO_DIPOLES
548 auto const &dipm() const { return p.dipm; }
549 auto &dipm() { return p.dipm; }
550 auto calc_dip() const { return calc_director() * dipm(); }
551#endif
552#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
553 auto const &stoner_wohlfarth_is_enabled() const {
555 }
557 auto const &stoner_wohlfarth_phi_0() const { return p.magnetodynamics.phi0; }
559 auto const &saturation_magnetization() const {
560 return p.magnetodynamics.sat_mag;
561 }
563 auto const &magnetic_anisotropy_field_inv() const {
565 }
569 auto const &magnetic_anisotropy_energy() const {
571 }
573 auto const &stoner_wohlfarth_tau0_inv() const {
574 return p.magnetodynamics.tau0_inv;
575 }
577 auto const &stoner_wohlfarth_dt_incr() const {
578 return p.magnetodynamics.dt_incr;
579 }
581#endif // ESPRESSO_THERMAL_STONER_WOHLFARTH
582#ifdef ESPRESSO_DIPOLE_FIELD_TRACKING
583 auto const &dip_fld() const { return p.dip_fld; }
584 auto &dip_fld() { return p.dip_fld; }
585#endif
586#ifdef ESPRESSO_ROTATIONAL_INERTIA
587 auto const &rinertia() const { return p.rinertia; }
588 auto &rinertia() { return p.rinertia; }
589#else
590 constexpr auto &rinertia() const { return p.rinertia; }
591#endif
592#ifdef ESPRESSO_ELECTROSTATICS
593 auto const &q() const { return p.q; }
594 auto &q() { return p.q; }
595#else
596 constexpr auto &q() const { return p.q; }
597#endif
598#ifdef ESPRESSO_LB_ELECTROHYDRODYNAMICS
599 auto const &mu_E() const { return p.mu_E; }
600 auto &mu_E() { return p.mu_E; }
601#endif
602#ifdef ESPRESSO_VIRTUAL_SITES
610#else
611 constexpr auto is_virtual() const { return false; }
612#endif // ESPRESSO_VIRTUAL_SITES
613#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
614 auto const &vs_relative() const { return p.vs_relative; }
615 auto &vs_relative() { return p.vs_relative; }
616#endif // ESPRESSO_VIRTUAL_SITES_RELATIVE
617#ifdef ESPRESSO_VIRTUAL_SITES_CENTER_OF_MASS
618 auto const &vs_com() const { return p.vs_com; }
619 auto &vs_com() { return p.vs_com; }
620#endif // ESPRESSO_VIRTUAL_SITES_CENTER_OF_MASS
621#ifdef ESPRESSO_THERMOSTAT_PER_PARTICLE
622 auto const &gamma() const { return p.gamma; }
623 auto &gamma() { return p.gamma; }
624#ifdef ESPRESSO_ROTATION
625 auto const &gamma_rot() const { return p.gamma_rot; }
626 auto &gamma_rot() { return p.gamma_rot; }
627#endif // ESPRESSO_ROTATION
628#endif // ESPRESSO_THERMOSTAT_PER_PARTICLE
629#ifdef ESPRESSO_EXTERNAL_FORCES
630 auto const &fixed() const { return p.ext_flag; }
631 auto &fixed() { return p.ext_flag; }
632 bool has_fixed_coordinates() const { return static_cast<bool>(p.ext_flag); }
633 bool is_fixed_along(unsigned int const axis) const {
634 assert(axis <= 2u);
635 return detail::get_nth_bit(p.ext_flag, axis);
636 }
637 void set_fixed_along(int const axis, bool const fixed_flag) {
638 // set new flag
639 if (fixed_flag) {
640 p.ext_flag |= static_cast<uint8_t>(1u << axis);
641 } else {
642 p.ext_flag &= static_cast<uint8_t>(~(1u << axis));
643 }
644 }
645 auto const &ext_force() const { return p.ext_force; }
646 auto &ext_force() { return p.ext_force; }
647#else // ESPRESSO_EXTERNAL_FORCES
648 constexpr bool has_fixed_coordinates() const { return false; }
649 constexpr bool is_fixed_along(unsigned int const) const { return false; }
650#endif // ESPRESSO_EXTERNAL_FORCES
651#ifdef ESPRESSO_ENGINE
652 auto const &swimming() const { return p.swim; }
653 auto &swimming() { return p.swim; }
654#endif
655#ifdef ESPRESSO_BOND_CONSTRAINT
656 auto const &pos_last_time_step() const { return r.p_last_timestep; }
658 auto const &rattle_params() const { return rattle; }
659 auto &rattle_params() { return rattle; }
660 auto const &rattle_correction() const { return rattle.correction; }
661 auto &rattle_correction() { return rattle.correction; }
662#endif
663
664#ifdef ESPRESSO_EXCLUSIONS
666 Utils::compact_vector<int> const &exclusions() const { return el; }
667 bool has_exclusion(int pid) const {
668 return std::ranges::find(el, pid) != el.end();
669 }
670#endif
671
672private:
673 friend boost::serialization::access;
674 template <class Archive> void serialize(Archive &ar, long int /* version */) {
675 ar & p;
676 ar & r;
677 ar & m;
678 ar & f;
679 ar & l;
680 ar & bl;
681#ifdef ESPRESSO_EXCLUSIONS
682 ar & el;
683#endif
684 }
685};
686
687BOOST_CLASS_IMPLEMENTATION(Particle, object_serializable)
688#ifdef ESPRESSO_ENGINE
689BOOST_CLASS_IMPLEMENTATION(ParticleParametersSwimming, object_serializable)
690#endif
691#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
692BOOST_CLASS_IMPLEMENTATION(ThermalStonerWohlfarthParameters,
693 object_serializable)
694#endif
695BOOST_CLASS_IMPLEMENTATION(ParticleProperties, object_serializable)
696BOOST_CLASS_IMPLEMENTATION(ParticlePosition, object_serializable)
697BOOST_CLASS_IMPLEMENTATION(ParticleMomentum, object_serializable)
698BOOST_CLASS_IMPLEMENTATION(ParticleForce, object_serializable)
699BOOST_CLASS_IMPLEMENTATION(ParticleLocal, object_serializable)
700#ifdef ESPRESSO_BOND_CONSTRAINT
701BOOST_CLASS_IMPLEMENTATION(ParticleRattle, object_serializable)
702#endif
703#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
704BOOST_CLASS_IMPLEMENTATION(decltype(ParticleProperties::vs_relative),
705 object_serializable)
706#endif
707#ifdef ESPRESSO_VIRTUAL_SITES_CENTER_OF_MASS
708BOOST_CLASS_IMPLEMENTATION(decltype(ParticleProperties::vs_com),
709 object_serializable)
710#endif
711
712#ifdef ESPRESSO_ENGINE
713BOOST_IS_BITWISE_SERIALIZABLE(ParticleParametersSwimming)
714#endif
715#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
716BOOST_IS_BITWISE_SERIALIZABLE(ThermalStonerWohlfarthParameters)
717#endif
718BOOST_IS_BITWISE_SERIALIZABLE(ParticleProperties)
719BOOST_IS_BITWISE_SERIALIZABLE(ParticlePosition)
720BOOST_IS_BITWISE_SERIALIZABLE(ParticleMomentum)
721BOOST_IS_BITWISE_SERIALIZABLE(ParticleForce)
722BOOST_IS_BITWISE_SERIALIZABLE(ParticleLocal)
723#ifdef ESPRESSO_BOND_CONSTRAINT
724BOOST_IS_BITWISE_SERIALIZABLE(ParticleRattle)
725#endif
726#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
727BOOST_IS_BITWISE_SERIALIZABLE(decltype(ParticleProperties::vs_relative))
728#endif
729#ifdef ESPRESSO_VIRTUAL_SITES_CENTER_OF_MASS
730BOOST_IS_BITWISE_SERIALIZABLE(decltype(ParticleProperties::vs_com))
731#endif
Vector implementation and trait types for boost qvm interoperability.
Bond storage.
Definition BondList.hpp:84
Custom vector container optimized for size.
Quaternion algebra.
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.
Definition Particle.hpp:345
Utils::Vector3d torque
torque.
Definition Particle.hpp:375
ParticleForce(const Utils::Vector3d &f, const Utils::Vector3d &torque)
Definition Particle.hpp:351
void serialize(Archive &ar, long int)
Definition Particle.hpp:378
Utils::Vector3d f
force.
Definition Particle.hpp:371
friend ParticleForce operator+(ParticleForce const &lhs, ParticleForce const &rhs)
Definition Particle.hpp:355
ParticleForce(const Utils::Vector3d &f)
Definition Particle.hpp:349
ParticleForce(ParticleForce const &)=default
ParticleForce()=default
ParticleForce & operator+=(ParticleForce const &rhs)
Definition Particle.hpp:362
ParticleForce & operator=(ParticleForce const &)=default
Information on a particle that is needed only on the node the particle belongs to.
Definition Particle.hpp:412
bool ghost
is particle a ghost particle.
Definition Particle.hpp:414
short int lees_edwards_flag
Definition Particle.hpp:415
void serialize(Archive &ar, long int)
Definition Particle.hpp:421
double lees_edwards_offset
Accumulated applied Lees-Edwards offset.
Definition Particle.hpp:419
Utils::Vector3d p_old
position from the last Verlet list update.
Definition Particle.hpp:417
Momentum information on a particle.
Definition Particle.hpp:390
Utils::Vector3d v
velocity.
Definition Particle.hpp:392
Utils::Vector3d omega
angular velocity.
Definition Particle.hpp:398
void serialize(Archive &ar, long int)
Definition Particle.hpp:401
Properties of a self-propelled particle.
Definition Particle.hpp:50
void serialize(Archive &ar, long int)
Definition Particle.hpp:58
bool swimming
Is the particle a swimmer.
Definition Particle.hpp:54
bool is_engine_force_on_fluid
Whether f_swim is applied to the particle or to the fluid.
Definition Particle.hpp:56
double f_swim
Imposed constant force.
Definition Particle.hpp:52
Positional information on a particle.
Definition Particle.hpp:310
Utils::Vector3d calc_director() const
unit director calculated from the quaternion
Definition Particle.hpp:320
Utils::Quaternion< double > quat
quaternion to define particle orientation
Definition Particle.hpp:318
Utils::Vector3i i
index of the simulation box image where the particle really sits.
Definition Particle.hpp:314
Utils::Vector3d p_last_timestep
particle position at the previous time step (RATTLE algorithm)
Definition Particle.hpp:327
void serialize(Archive &ar, long int)
Definition Particle.hpp:330
Utils::Vector3d p
periodically folded position.
Definition Particle.hpp:312
Relate this particle to a molecule center of mass.
Definition Particle.hpp:209
int to_molecule_id
Store molecule id tracked by virtual site.
Definition Particle.hpp:211
The following properties define, with respect to which real particle a virtual site is placed and at ...
Definition Particle.hpp:189
Utils::Quaternion< double > rel_orientation
Relative position of the virtual site.
Definition Particle.hpp:193
Utils::Quaternion< double > quat
Orientation of the virtual particle in the body fixed frame.
Definition Particle.hpp:196
Properties of a particle which are not supposed to change during the integration, but have to be know...
Definition Particle.hpp:107
Utils::Vector3d gamma_rot
Friction coefficient for rotation.
Definition Particle.hpp:231
double mass
particle mass
Definition Particle.hpp:148
double dipm
dipole moment (absolute value)
Definition Particle.hpp:174
Utils::Vector3d rinertia
rotational inertia
Definition Particle.hpp:155
ParticleParametersSwimming swim
Definition Particle.hpp:246
int identity
unique identifier for the particle.
Definition Particle.hpp:109
Utils::Vector3d ext_torque
External torque.
Definition Particle.hpp:241
void serialize(Archive &ar, long int)
Definition Particle.hpp:253
Utils::Vector3d ext_force
External force.
Definition Particle.hpp:238
Utils::Vector3d mu_E
electrophoretic mobility times E-field: mu_0 * E
Definition Particle.hpp:169
int mol_id
Molecule identifier.
Definition Particle.hpp:111
Utils::Vector3d dip_fld
total dipole field
Definition Particle.hpp:179
ThermalStonerWohlfarthParameters magnetodynamics
Definition Particle.hpp:250
uint8_t ext_flag
Flag for fixed particle coordinates.
Definition Particle.hpp:140
int propagation
which propagation schemes should be applied to the particle
Definition Particle.hpp:115
struct ParticleProperties::VirtualSitesRelativeParameters vs_relative
Utils::Vector3d gamma
Friction coefficient for translation.
Definition Particle.hpp:224
uint8_t rotation
Bitfield for the particle axes of rotation.
Definition Particle.hpp:126
struct ParticleProperties::VirtualSitesCenterOfMassParameters vs_com
double q
charge.
Definition Particle.hpp:162
int type
particle type, used for non-bonded interactions.
Definition Particle.hpp:113
friend ParticleRattle operator+(ParticleRattle const &lhs, ParticleRattle const &rhs)
Definition Particle.hpp:434
Utils::Vector3d correction
position/velocity correction
Definition Particle.hpp:432
ParticleRattle & operator+=(ParticleRattle const &rhs)
Definition Particle.hpp:439
void serialize(Archive &ar, long int)
Definition Particle.hpp:443
Struct holding all information for one particle.
Definition Particle.hpp:450
auto const & dip_fld() const
Definition Particle.hpp:583
auto & image_box()
Definition Particle.hpp:500
bool has_exclusion(int pid) const
Definition Particle.hpp:667
auto & ext_torque()
Definition Particle.hpp:540
auto const & swimming() const
Definition Particle.hpp:652
auto const & rattle_params() const
Definition Particle.hpp:658
auto & lees_edwards_offset()
Definition Particle.hpp:502
auto & stoner_wohlfarth_phi_0()
Definition Particle.hpp:558
bool can_rotate() const
Definition Particle.hpp:515
auto const & lees_edwards_offset() const
Definition Particle.hpp:501
auto const & propagation() const
Definition Particle.hpp:476
auto & id()
Definition Particle.hpp:470
auto & bonds()
Definition Particle.hpp:484
auto const & magnetic_anisotropy_energy() const
Definition Particle.hpp:569
auto const & rinertia() const
Definition Particle.hpp:587
auto const & stoner_wohlfarth_phi_0() const
Definition Particle.hpp:557
auto & dip_fld()
Definition Particle.hpp:584
Utils::compact_vector< int > const & exclusions() const
Definition Particle.hpp:666
auto & rinertia()
Definition Particle.hpp:588
auto & rattle_params()
Definition Particle.hpp:659
auto is_virtual() const
Definition Particle.hpp:603
auto const & mass() const
Definition Particle.hpp:507
auto const & magnetic_anisotropy_field_inv() const
Definition Particle.hpp:563
Utils::compact_vector< int > & exclusions()
Definition Particle.hpp:665
auto & rotation()
Definition Particle.hpp:514
auto & stoner_wohlfarth_dt_incr()
Definition Particle.hpp:580
auto & force_and_torque()
Definition Particle.hpp:493
auto const & quat() const
Definition Particle.hpp:532
auto & magnetic_anisotropy_energy()
Definition Particle.hpp:572
auto const & vs_com() const
Definition Particle.hpp:618
bool has_fixed_coordinates() const
Definition Particle.hpp:632
auto const & rotation() const
Definition Particle.hpp:513
auto & rattle_correction()
Definition Particle.hpp:661
auto & propagation()
Definition Particle.hpp:477
bool operator==(Particle const &rhs) const
Definition Particle.hpp:479
auto & magnetic_anisotropy_field_inv()
Definition Particle.hpp:566
auto const & vs_relative() const
Definition Particle.hpp:614
auto const & stoner_wohlfarth_tau0_inv() const
Definition Particle.hpp:573
auto & vs_relative()
Definition Particle.hpp:615
void set_can_rotate_around(unsigned int const axis, bool const rot_flag)
Definition Particle.hpp:520
auto const & q() const
Definition Particle.hpp:593
auto & gamma_rot()
Definition Particle.hpp:626
auto & dipm()
Definition Particle.hpp:549
auto & pos_at_last_verlet_update()
Definition Particle.hpp:497
auto const & gamma() const
Definition Particle.hpp:622
auto & lees_edwards_flag()
Definition Particle.hpp:504
auto & mu_E()
Definition Particle.hpp:600
void set_ghost(bool const ghost_flag)
Definition Particle.hpp:496
auto const & pos_at_last_verlet_update() const
Definition Particle.hpp:498
auto const & pos_last_time_step() const
Definition Particle.hpp:656
bool can_rotate_around(unsigned int const axis) const
Definition Particle.hpp:516
auto const & gamma_rot() const
Definition Particle.hpp:625
auto const & saturation_magnetization() const
Definition Particle.hpp:559
auto const & force_and_torque() const
Definition Particle.hpp:492
auto const & stoner_wohlfarth_dt_incr() const
Definition Particle.hpp:577
auto const & lees_edwards_flag() const
Definition Particle.hpp:503
auto calc_dip() const
Definition Particle.hpp:550
auto const & v() const
Definition Particle.hpp:488
auto & stoner_wohlfarth_is_enabled()
Definition Particle.hpp:556
void set_fixed_along(int const axis, bool const fixed_flag)
Definition Particle.hpp:637
auto const & torque() const
Definition Particle.hpp:534
auto & quat()
Definition Particle.hpp:533
auto const & fixed() const
Definition Particle.hpp:630
auto const & ext_force() const
Definition Particle.hpp:645
auto const & omega() const
Definition Particle.hpp:536
auto & saturation_magnetization()
Definition Particle.hpp:562
auto const & image_box() const
Definition Particle.hpp:499
auto & force()
Definition Particle.hpp:491
auto const & stoner_wohlfarth_is_enabled() const
Definition Particle.hpp:553
auto & v()
Definition Particle.hpp:489
auto const & type() const
Definition Particle.hpp:473
auto const & ext_torque() const
Definition Particle.hpp:539
auto const & bonds() const
Definition Particle.hpp:483
bool is_ghost() const
Definition Particle.hpp:495
auto & mol_id()
Definition Particle.hpp:472
auto & fixed()
Definition Particle.hpp:631
bool operator!=(Particle const &rhs) const
Definition Particle.hpp:481
auto & ext_force()
Definition Particle.hpp:646
auto const & dipm() const
Definition Particle.hpp:548
auto & vs_com()
Definition Particle.hpp:619
auto & swimming()
Definition Particle.hpp:653
auto const & mol_id() const
Definition Particle.hpp:471
auto const & pos() const
Definition Particle.hpp:486
auto & pos()
Definition Particle.hpp:487
void set_cannot_rotate_all_axes()
Definition Particle.hpp:529
bool is_fixed_along(unsigned int const axis) const
Definition Particle.hpp:633
auto & type()
Definition Particle.hpp:474
auto & omega()
Definition Particle.hpp:537
auto & stoner_wohlfarth_tau0_inv()
Definition Particle.hpp:576
auto & gamma()
Definition Particle.hpp:623
void set_can_rotate_all_axes()
Definition Particle.hpp:528
auto & pos_last_time_step()
Definition Particle.hpp:657
auto const & mu_E() const
Definition Particle.hpp:599
auto const & force() const
Definition Particle.hpp:490
auto & q()
Definition Particle.hpp:594
auto const & id() const
Definition Particle.hpp:469
auto const & rattle_correction() const
Definition Particle.hpp:660
auto & mass()
Definition Particle.hpp:508
auto calc_director() const
Definition Particle.hpp:542
auto & torque()
Definition Particle.hpp:535
Properties for thermal Stoner-Wohlfarth magnetodynamics.
Definition Particle.hpp:66
bool is_enabled
Flag to distinguish virtual particles carrying the dipole moment in the thermal Stoner-Wohlfarth mode...
Definition Particle.hpp:71
double tau0_inv
Browns attempt frequency.
Definition Particle.hpp:90
double ani_energy
Magnetic anisotropy energy (K1 * V) in units of energy.
Definition Particle.hpp:88
void serialize(Archive &ar, long int)
Definition Particle.hpp:94
double dt_incr
time units parameter for the kinetic Monte Carlo step
Definition Particle.hpp:92
double ani_fld_inv
Inverse anisotropy field in reduced units.
Definition Particle.hpp:82
double sat_mag
saturation magnetisation of a polarisable particle
Definition Particle.hpp:76
double phi0
angle between the director and dipole moment of a Stoner-Wohlfarth particle
Definition Particle.hpp:74
Quaternion representation.
static Quaternion< T > identity()
Construct an identity quaternion.