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