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_THERMOSTAT_PER_PARTICLE
208/** Friction coefficient for translation */
209#ifndef ESPRESSO_PARTICLE_ANISOTROPY
210 double gamma = -1.;
211#else
212 Utils::Vector3d gamma = {-1., -1., -1.};
213#endif // ESPRESSO_PARTICLE_ANISOTROPY
214#ifdef ESPRESSO_ROTATION
215/** Friction coefficient for rotation */
216#ifndef ESPRESSO_PARTICLE_ANISOTROPY
217 double gamma_rot = -1.;
218#else
219 Utils::Vector3d gamma_rot = {-1., -1., -1.};
220#endif // ESPRESSO_PARTICLE_ANISOTROPY
221#endif // ESPRESSO_ROTATION
222#endif // ESPRESSO_THERMOSTAT_PER_PARTICLE
223
224#ifdef ESPRESSO_EXTERNAL_FORCES
225 /** External force. */
227#ifdef ESPRESSO_ROTATION
228 /** External torque. */
230#endif // ESPRESSO_ROTATION
231#endif // ESPRESSO_EXTERNAL_FORCES
232
233#ifdef ESPRESSO_ENGINE
235#endif
236
237#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
239#endif
240
241 template <class Archive> void serialize(Archive &ar, long int /* version */) {
242 ar & identity;
243 ar & mol_id;
244 ar & type;
245 ar & propagation;
246#ifdef ESPRESSO_MASS
247 ar & mass;
248#endif
249#ifdef ESPRESSO_ROTATIONAL_INERTIA
250 ar & rinertia;
251#endif
252#ifdef ESPRESSO_ROTATION
253 ar & rotation;
254#endif
255#ifdef ESPRESSO_ELECTROSTATICS
256 ar & q;
257#endif
258#ifdef ESPRESSO_LB_ELECTROHYDRODYNAMICS
259 ar & mu_E;
260#endif
261#ifdef ESPRESSO_DIPOLES
262 ar & dipm;
263#endif
264#ifdef ESPRESSO_DIPOLE_FIELD_TRACKING
265 ar & dip_fld;
266#endif
267#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
268 ar & vs_relative;
269#endif
270#ifdef ESPRESSO_THERMOSTAT_PER_PARTICLE
271 ar & gamma;
272#ifdef ESPRESSO_ROTATION
273 ar & gamma_rot;
274#endif
275#endif // ESPRESSO_THERMOSTAT_PER_PARTICLE
276#ifdef ESPRESSO_EXTERNAL_FORCES
277 ar & ext_flag;
278 ar & ext_force;
279#ifdef ESPRESSO_ROTATION
280 ar & ext_torque;
281#endif
282#endif // ESPRESSO_EXTERNAL_FORCES
283#ifdef ESPRESSO_ENGINE
284 ar & swim;
285#endif
286#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
287 ar & magnetodynamics;
288#endif
289 }
290};
291
292/** Positional information on a particle. Information that is
293 * communicated to calculate interactions with ghost particles.
294 */
296 /** periodically folded position. */
297 Utils::Vector3d p = {0., 0., 0.};
298 /** index of the simulation box image where the particle really sits. */
299 Utils::Vector3i i = {0, 0, 0};
300
301#ifdef ESPRESSO_ROTATION
302 /** quaternion to define particle orientation */
304 /** unit director calculated from the quaternion */
308#endif
309
310#ifdef ESPRESSO_BOND_CONSTRAINT
311 /** particle position at the previous time step (RATTLE algorithm) */
313#endif
314
315 template <class Archive> void serialize(Archive &ar, long int /* version */) {
316 ar & p;
317 ar & i;
318#ifdef ESPRESSO_ROTATION
319 ar & quat;
320#endif
321#ifdef ESPRESSO_BOND_CONSTRAINT
322 ar & p_last_timestep;
323#endif
324 }
325};
326
327/** Force information on a particle. Forces of ghost particles are
328 * collected and added up to the force of the original particle.
329 */
331 ParticleForce() = default;
332 ParticleForce(ParticleForce const &) = default;
335#ifdef ESPRESSO_ROTATION
338#endif
339
341 ParticleForce const &rhs) {
342 ParticleForce result = lhs;
343 result += rhs;
344 return result;
345 }
346
348 f += rhs.f;
349#ifdef ESPRESSO_ROTATION
350 torque += rhs.torque;
351#endif
352 return *this;
353 }
354
355 /** force. */
356 Utils::Vector3d f = {0., 0., 0.};
357
358#ifdef ESPRESSO_ROTATION
359 /** torque. */
360 Utils::Vector3d torque = {0., 0., 0.};
361#endif
362
363 template <class Archive> void serialize(Archive &ar, long int /* version */) {
364 ar & f;
365#ifdef ESPRESSO_ROTATION
366 ar & torque;
367#endif
368 }
369};
370
371/** Momentum information on a particle. Information not contained in
372 * communication of ghost particles so far, but a communication would
373 * be necessary for velocity-dependent potentials.
374 */
376 /** velocity. */
377 Utils::Vector3d v = {0., 0., 0.};
378
379#ifdef ESPRESSO_ROTATION
380 /** angular velocity.
381 * ALWAYS IN PARTICLE FIXED, I.E., CO-ROTATING COORDINATE SYSTEM.
382 */
383 Utils::Vector3d omega = {0., 0., 0.};
384#endif
385
386 template <class Archive> void serialize(Archive &ar, long int /* version */) {
387 ar & v;
388#ifdef ESPRESSO_ROTATION
389 ar & omega;
390#endif
391 }
392};
393
394/** Information on a particle that is needed only on the
395 * node the particle belongs to.
396 */
398 /** is particle a ghost particle. */
399 bool ghost = false;
400 short int lees_edwards_flag = 0;
401 /** position from the last Verlet list update. */
402 Utils::Vector3d p_old = {0., 0., 0.};
403 /** Accumulated applied Lees-Edwards offset. */
405
406 template <class Archive> void serialize(Archive &ar, long int /* version */) {
407 ar & ghost;
409 ar & p_old;
411 }
412};
413
414#ifdef ESPRESSO_BOND_CONSTRAINT
416 /** position/velocity correction */
418
420 ParticleRattle const &rhs) {
421 return {lhs.correction + rhs.correction};
422 }
423
425 return *this = *this + rhs;
426 }
427
428 template <class Archive> void serialize(Archive &ar, long int /* version */) {
429 ar & correction;
430 }
431};
432#endif
433
434/** Struct holding all information for one particle. */
435struct Particle { // NOLINT(bugprone-exception-escape)
436private:
442#ifdef ESPRESSO_BOND_CONSTRAINT
443 ParticleRattle rattle;
444#endif
445 BondList bl;
446#ifdef ESPRESSO_EXCLUSIONS
447 /** list of particles, with which this particle has no non-bonded
448 * interactions
449 */
451#endif
452
453public:
454 auto const &id() const { return p.identity; }
455 auto &id() { return p.identity; }
456 auto const &mol_id() const { return p.mol_id; }
457 auto &mol_id() { return p.mol_id; }
458 auto const &type() const { return p.type; }
459 auto &type() { return p.type; }
460
461 auto const &propagation() const { return p.propagation; }
462 auto &propagation() { return p.propagation; }
463
464 bool operator==(Particle const &rhs) const { return id() == rhs.id(); }
465
466 bool operator!=(Particle const &rhs) const { return id() != rhs.id(); }
467
468 auto const &bonds() const { return bl; }
469 auto &bonds() { return bl; }
470
471 auto const &pos() const { return r.p; }
472 auto &pos() { 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; }
476 auto &force() { return f.f; }
477 auto const &force_and_torque() const { return f; }
478 auto &force_and_torque() { return f; }
479
480 bool is_ghost() const { return l.ghost; }
481 void set_ghost(bool const ghost_flag) { l.ghost = ghost_flag; }
482 auto &pos_at_last_verlet_update() { return l.p_old; }
483 auto const &pos_at_last_verlet_update() const { return l.p_old; }
484 auto const &image_box() const { return r.i; }
485 auto &image_box() { return r.i; }
486 auto const &lees_edwards_offset() const { return l.lees_edwards_offset; }
488 auto const &lees_edwards_flag() const { return l.lees_edwards_flag; }
490
491#ifdef ESPRESSO_MASS
492 auto const &mass() const { return p.mass; }
493 auto &mass() { return p.mass; }
494#else
495 constexpr auto &mass() const { return p.mass; }
496#endif
497#ifdef ESPRESSO_ROTATION
498 auto const &rotation() const { return p.rotation; }
499 auto &rotation() { return p.rotation; }
500 bool can_rotate() const { return static_cast<bool>(p.rotation); }
501 bool can_rotate_around(unsigned int const axis) const {
502 assert(axis <= 2u);
503 return detail::get_nth_bit(p.rotation, axis);
504 }
505 void set_can_rotate_around(unsigned int const axis, bool const rot_flag) {
506 assert(axis <= 2u);
507 if (rot_flag) {
508 p.rotation |= static_cast<uint8_t>(1u << axis);
509 } else {
510 p.rotation &= static_cast<uint8_t>(~(1u << axis));
511 }
512 }
513 void set_can_rotate_all_axes() { p.rotation = static_cast<uint8_t>(0b111u); }
515 p.rotation = static_cast<uint8_t>(0b000u);
516 }
517 auto const &quat() const { return r.quat; }
518 auto &quat() { return r.quat; }
519 auto const &torque() const { return f.torque; }
520 auto &torque() { return f.torque; }
521 auto const &omega() const { return m.omega; }
522 auto &omega() { return m.omega; }
523#ifdef ESPRESSO_EXTERNAL_FORCES
524 auto const &ext_torque() const { return p.ext_torque; }
525 auto &ext_torque() { return p.ext_torque; }
526#endif // ESPRESSO_EXTERNAL_FORCES
527 auto calc_director() const { return r.calc_director(); }
528#else // ESPRESSO_ROTATION
529 auto can_rotate() const { return false; }
530 auto can_rotate_around(unsigned int const) const { return false; }
531#endif // ESPRESSO_ROTATION
532#ifdef ESPRESSO_DIPOLES
533 auto const &dipm() const { return p.dipm; }
534 auto &dipm() { return p.dipm; }
535 auto calc_dip() const { return calc_director() * dipm(); }
536#endif
537#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
538 auto const &stoner_wohlfarth_is_enabled() const {
540 }
542 auto const &stoner_wohlfarth_phi_0() const { return p.magnetodynamics.phi0; }
544 auto const &saturation_magnetization() const {
545 return p.magnetodynamics.sat_mag;
546 }
548 auto const &magnetic_anisotropy_field_inv() const {
550 }
554 auto const &magnetic_anisotropy_energy() const {
556 }
558 auto const &stoner_wohlfarth_tau0_inv() const {
559 return p.magnetodynamics.tau0_inv;
560 }
562 auto const &stoner_wohlfarth_dt_incr() const {
563 return p.magnetodynamics.dt_incr;
564 }
566#endif // ESPRESSO_THERMAL_STONER_WOHLFARTH
567#ifdef ESPRESSO_DIPOLE_FIELD_TRACKING
568 auto const &dip_fld() const { return p.dip_fld; }
569 auto &dip_fld() { return p.dip_fld; }
570#endif
571#ifdef ESPRESSO_ROTATIONAL_INERTIA
572 auto const &rinertia() const { return p.rinertia; }
573 auto &rinertia() { return p.rinertia; }
574#else
575 constexpr auto &rinertia() const { return p.rinertia; }
576#endif
577#ifdef ESPRESSO_ELECTROSTATICS
578 auto const &q() const { return p.q; }
579 auto &q() { return p.q; }
580#else
581 constexpr auto &q() const { return p.q; }
582#endif
583#ifdef ESPRESSO_LB_ELECTROHYDRODYNAMICS
584 auto const &mu_E() const { return p.mu_E; }
585 auto &mu_E() { return p.mu_E; }
586#endif
587#ifdef ESPRESSO_VIRTUAL_SITES
595#else
596 constexpr auto is_virtual() const { return false; }
597#endif // ESPRESSO_VIRTUAL_SITES
598#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
599 auto const &vs_relative() const { return p.vs_relative; }
600 auto &vs_relative() { return p.vs_relative; }
601#endif // ESPRESSO_VIRTUAL_SITES_RELATIVE
602#ifdef ESPRESSO_THERMOSTAT_PER_PARTICLE
603 auto const &gamma() const { return p.gamma; }
604 auto &gamma() { return p.gamma; }
605#ifdef ESPRESSO_ROTATION
606 auto const &gamma_rot() const { return p.gamma_rot; }
607 auto &gamma_rot() { return p.gamma_rot; }
608#endif // ESPRESSO_ROTATION
609#endif // ESPRESSO_THERMOSTAT_PER_PARTICLE
610#ifdef ESPRESSO_EXTERNAL_FORCES
611 auto const &fixed() const { return p.ext_flag; }
612 auto &fixed() { return p.ext_flag; }
613 bool has_fixed_coordinates() const { return static_cast<bool>(p.ext_flag); }
614 bool is_fixed_along(unsigned int const axis) const {
615 assert(axis <= 2u);
616 return detail::get_nth_bit(p.ext_flag, axis);
617 }
618 void set_fixed_along(int const axis, bool const fixed_flag) {
619 // set new flag
620 if (fixed_flag) {
621 p.ext_flag |= static_cast<uint8_t>(1u << axis);
622 } else {
623 p.ext_flag &= static_cast<uint8_t>(~(1u << axis));
624 }
625 }
626 auto const &ext_force() const { return p.ext_force; }
627 auto &ext_force() { return p.ext_force; }
628#else // ESPRESSO_EXTERNAL_FORCES
629 constexpr bool has_fixed_coordinates() const { return false; }
630 constexpr bool is_fixed_along(unsigned int const) const { return false; }
631#endif // ESPRESSO_EXTERNAL_FORCES
632#ifdef ESPRESSO_ENGINE
633 auto const &swimming() const { return p.swim; }
634 auto &swimming() { return p.swim; }
635#endif
636#ifdef ESPRESSO_BOND_CONSTRAINT
637 auto const &pos_last_time_step() const { return r.p_last_timestep; }
639 auto const &rattle_params() const { return rattle; }
640 auto &rattle_params() { return rattle; }
641 auto const &rattle_correction() const { return rattle.correction; }
642 auto &rattle_correction() { return rattle.correction; }
643#endif
644
645#ifdef ESPRESSO_EXCLUSIONS
647 Utils::compact_vector<int> const &exclusions() const { return el; }
648 bool has_exclusion(int pid) const {
649 return std::ranges::find(el, pid) != el.end();
650 }
651#endif
652
653private:
654 friend boost::serialization::access;
655 template <class Archive> void serialize(Archive &ar, long int /* version */) {
656 ar & p;
657 ar & r;
658 ar & m;
659 ar & f;
660 ar & l;
661 ar & bl;
662#ifdef ESPRESSO_EXCLUSIONS
663 ar & el;
664#endif
665 }
666};
667
668BOOST_CLASS_IMPLEMENTATION(Particle, object_serializable)
669#ifdef ESPRESSO_ENGINE
670BOOST_CLASS_IMPLEMENTATION(ParticleParametersSwimming, object_serializable)
671#endif
672#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
673BOOST_CLASS_IMPLEMENTATION(ThermalStonerWohlfarthParameters,
674 object_serializable)
675#endif
676BOOST_CLASS_IMPLEMENTATION(ParticleProperties, object_serializable)
677BOOST_CLASS_IMPLEMENTATION(ParticlePosition, object_serializable)
678BOOST_CLASS_IMPLEMENTATION(ParticleMomentum, object_serializable)
679BOOST_CLASS_IMPLEMENTATION(ParticleForce, object_serializable)
680BOOST_CLASS_IMPLEMENTATION(ParticleLocal, object_serializable)
681#ifdef ESPRESSO_BOND_CONSTRAINT
682BOOST_CLASS_IMPLEMENTATION(ParticleRattle, object_serializable)
683#endif
684#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
685BOOST_CLASS_IMPLEMENTATION(decltype(ParticleProperties::vs_relative),
686 object_serializable)
687#endif
688
689#ifdef ESPRESSO_ENGINE
690BOOST_IS_BITWISE_SERIALIZABLE(ParticleParametersSwimming)
691#endif
692#ifdef ESPRESSO_THERMAL_STONER_WOHLFARTH
693BOOST_IS_BITWISE_SERIALIZABLE(ThermalStonerWohlfarthParameters)
694#endif
695BOOST_IS_BITWISE_SERIALIZABLE(ParticleProperties)
696BOOST_IS_BITWISE_SERIALIZABLE(ParticlePosition)
697BOOST_IS_BITWISE_SERIALIZABLE(ParticleMomentum)
698BOOST_IS_BITWISE_SERIALIZABLE(ParticleForce)
699BOOST_IS_BITWISE_SERIALIZABLE(ParticleLocal)
700#ifdef ESPRESSO_BOND_CONSTRAINT
701BOOST_IS_BITWISE_SERIALIZABLE(ParticleRattle)
702#endif
703#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
704BOOST_IS_BITWISE_SERIALIZABLE(decltype(ParticleProperties::vs_relative))
705#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:330
Utils::Vector3d torque
torque.
Definition Particle.hpp:360
ParticleForce(const Utils::Vector3d &f, const Utils::Vector3d &torque)
Definition Particle.hpp:336
void serialize(Archive &ar, long int)
Definition Particle.hpp:363
Utils::Vector3d f
force.
Definition Particle.hpp:356
friend ParticleForce operator+(ParticleForce const &lhs, ParticleForce const &rhs)
Definition Particle.hpp:340
ParticleForce(const Utils::Vector3d &f)
Definition Particle.hpp:334
ParticleForce(ParticleForce const &)=default
ParticleForce()=default
ParticleForce & operator+=(ParticleForce const &rhs)
Definition Particle.hpp:347
ParticleForce & operator=(ParticleForce const &)=default
Information on a particle that is needed only on the node the particle belongs to.
Definition Particle.hpp:397
bool ghost
is particle a ghost particle.
Definition Particle.hpp:399
short int lees_edwards_flag
Definition Particle.hpp:400
void serialize(Archive &ar, long int)
Definition Particle.hpp:406
double lees_edwards_offset
Accumulated applied Lees-Edwards offset.
Definition Particle.hpp:404
Utils::Vector3d p_old
position from the last Verlet list update.
Definition Particle.hpp:402
Momentum information on a particle.
Definition Particle.hpp:375
Utils::Vector3d v
velocity.
Definition Particle.hpp:377
Utils::Vector3d omega
angular velocity.
Definition Particle.hpp:383
void serialize(Archive &ar, long int)
Definition Particle.hpp:386
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:295
Utils::Vector3d calc_director() const
unit director calculated from the quaternion
Definition Particle.hpp:305
Utils::Quaternion< double > quat
quaternion to define particle orientation
Definition Particle.hpp:303
Utils::Vector3i i
index of the simulation box image where the particle really sits.
Definition Particle.hpp:299
Utils::Vector3d p_last_timestep
particle position at the previous time step (RATTLE algorithm)
Definition Particle.hpp:312
void serialize(Archive &ar, long int)
Definition Particle.hpp:315
Utils::Vector3d p
periodically folded position.
Definition Particle.hpp:297
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:219
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:234
int identity
unique identifier for the particle.
Definition Particle.hpp:109
Utils::Vector3d ext_torque
External torque.
Definition Particle.hpp:229
void serialize(Archive &ar, long int)
Definition Particle.hpp:241
Utils::Vector3d ext_force
External force.
Definition Particle.hpp:226
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:238
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:212
uint8_t rotation
Bitfield for the particle axes of rotation.
Definition Particle.hpp:126
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:419
Utils::Vector3d correction
position/velocity correction
Definition Particle.hpp:417
ParticleRattle & operator+=(ParticleRattle const &rhs)
Definition Particle.hpp:424
void serialize(Archive &ar, long int)
Definition Particle.hpp:428
Struct holding all information for one particle.
Definition Particle.hpp:435
auto const & dip_fld() const
Definition Particle.hpp:568
auto & image_box()
Definition Particle.hpp:485
bool has_exclusion(int pid) const
Definition Particle.hpp:648
auto & ext_torque()
Definition Particle.hpp:525
auto const & swimming() const
Definition Particle.hpp:633
auto const & rattle_params() const
Definition Particle.hpp:639
auto & lees_edwards_offset()
Definition Particle.hpp:487
auto & stoner_wohlfarth_phi_0()
Definition Particle.hpp:543
bool can_rotate() const
Definition Particle.hpp:500
auto const & lees_edwards_offset() const
Definition Particle.hpp:486
auto const & propagation() const
Definition Particle.hpp:461
auto & id()
Definition Particle.hpp:455
auto & bonds()
Definition Particle.hpp:469
auto const & magnetic_anisotropy_energy() const
Definition Particle.hpp:554
auto const & rinertia() const
Definition Particle.hpp:572
auto const & stoner_wohlfarth_phi_0() const
Definition Particle.hpp:542
auto & dip_fld()
Definition Particle.hpp:569
Utils::compact_vector< int > const & exclusions() const
Definition Particle.hpp:647
auto & rinertia()
Definition Particle.hpp:573
auto & rattle_params()
Definition Particle.hpp:640
auto is_virtual() const
Definition Particle.hpp:588
auto const & mass() const
Definition Particle.hpp:492
auto const & magnetic_anisotropy_field_inv() const
Definition Particle.hpp:548
Utils::compact_vector< int > & exclusions()
Definition Particle.hpp:646
auto & rotation()
Definition Particle.hpp:499
auto & stoner_wohlfarth_dt_incr()
Definition Particle.hpp:565
auto & force_and_torque()
Definition Particle.hpp:478
auto const & quat() const
Definition Particle.hpp:517
auto & magnetic_anisotropy_energy()
Definition Particle.hpp:557
bool has_fixed_coordinates() const
Definition Particle.hpp:613
auto const & rotation() const
Definition Particle.hpp:498
auto & rattle_correction()
Definition Particle.hpp:642
auto & propagation()
Definition Particle.hpp:462
bool operator==(Particle const &rhs) const
Definition Particle.hpp:464
auto & magnetic_anisotropy_field_inv()
Definition Particle.hpp:551
auto const & vs_relative() const
Definition Particle.hpp:599
auto const & stoner_wohlfarth_tau0_inv() const
Definition Particle.hpp:558
auto & vs_relative()
Definition Particle.hpp:600
void set_can_rotate_around(unsigned int const axis, bool const rot_flag)
Definition Particle.hpp:505
auto const & q() const
Definition Particle.hpp:578
auto & gamma_rot()
Definition Particle.hpp:607
auto & dipm()
Definition Particle.hpp:534
auto & pos_at_last_verlet_update()
Definition Particle.hpp:482
auto const & gamma() const
Definition Particle.hpp:603
auto & lees_edwards_flag()
Definition Particle.hpp:489
auto & mu_E()
Definition Particle.hpp:585
void set_ghost(bool const ghost_flag)
Definition Particle.hpp:481
auto const & pos_at_last_verlet_update() const
Definition Particle.hpp:483
auto const & pos_last_time_step() const
Definition Particle.hpp:637
bool can_rotate_around(unsigned int const axis) const
Definition Particle.hpp:501
auto const & gamma_rot() const
Definition Particle.hpp:606
auto const & saturation_magnetization() const
Definition Particle.hpp:544
auto const & force_and_torque() const
Definition Particle.hpp:477
auto const & stoner_wohlfarth_dt_incr() const
Definition Particle.hpp:562
auto const & lees_edwards_flag() const
Definition Particle.hpp:488
auto calc_dip() const
Definition Particle.hpp:535
auto const & v() const
Definition Particle.hpp:473
auto & stoner_wohlfarth_is_enabled()
Definition Particle.hpp:541
void set_fixed_along(int const axis, bool const fixed_flag)
Definition Particle.hpp:618
auto const & torque() const
Definition Particle.hpp:519
auto & quat()
Definition Particle.hpp:518
auto const & fixed() const
Definition Particle.hpp:611
auto const & ext_force() const
Definition Particle.hpp:626
auto const & omega() const
Definition Particle.hpp:521
auto & saturation_magnetization()
Definition Particle.hpp:547
auto const & image_box() const
Definition Particle.hpp:484
auto & force()
Definition Particle.hpp:476
auto const & stoner_wohlfarth_is_enabled() const
Definition Particle.hpp:538
auto & v()
Definition Particle.hpp:474
auto const & type() const
Definition Particle.hpp:458
auto const & ext_torque() const
Definition Particle.hpp:524
auto const & bonds() const
Definition Particle.hpp:468
bool is_ghost() const
Definition Particle.hpp:480
auto & mol_id()
Definition Particle.hpp:457
auto & fixed()
Definition Particle.hpp:612
bool operator!=(Particle const &rhs) const
Definition Particle.hpp:466
auto & ext_force()
Definition Particle.hpp:627
auto const & dipm() const
Definition Particle.hpp:533
auto & swimming()
Definition Particle.hpp:634
auto const & mol_id() const
Definition Particle.hpp:456
auto const & pos() const
Definition Particle.hpp:471
auto & pos()
Definition Particle.hpp:472
void set_cannot_rotate_all_axes()
Definition Particle.hpp:514
bool is_fixed_along(unsigned int const axis) const
Definition Particle.hpp:614
auto & type()
Definition Particle.hpp:459
auto & omega()
Definition Particle.hpp:522
auto & stoner_wohlfarth_tau0_inv()
Definition Particle.hpp:561
auto & gamma()
Definition Particle.hpp:604
void set_can_rotate_all_axes()
Definition Particle.hpp:513
auto & pos_last_time_step()
Definition Particle.hpp:638
auto const & mu_E() const
Definition Particle.hpp:584
auto const & force() const
Definition Particle.hpp:475
auto & q()
Definition Particle.hpp:579
auto const & id() const
Definition Particle.hpp:454
auto const & rattle_correction() const
Definition Particle.hpp:641
auto & mass()
Definition Particle.hpp:493
auto calc_director() const
Definition Particle.hpp:527
auto & torque()
Definition Particle.hpp:520
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.