28#include "communication.hpp"
34#include <boost/mpi/collectives/all_reduce.hpp>
35#include <boost/mpi/operations.hpp>
44 auto f_max_local = -std::numeric_limits<double>::max();
51 for (
auto j = 0u; j < 3u; ++j) {
53 if (!p.is_fixed_along(j)) {
65#ifdef ESPRESSO_ROTATION
68 auto const dq =
gamma * p.torque();
69 auto const t = p.torque().norm2();
72 auto const l = dq.norm();
74 auto const axis = dq / l;
81 f_max_local = std::max(f_max_local, t);
85 f_max_local = std::max(f_max_local, f);
91 auto const f_max_global = boost::mpi::all_reduce(
92 comm_cart, f_max_local, boost::mpi::maximum<double>());
94 return std::sqrt(f_max_global) <
f_max;
98 double max_displacement)
99 : f_max{f_max}, gamma{gamma}, max_displacement{max_displacement} {
101 throw std::runtime_error(
"The maximal force must be positive.");
104 throw std::runtime_error(
"The dampening constant must be positive.");
107 throw std::runtime_error(
"The maximal displacement must be positive.");
Vector implementation and trait types for boost qvm interoperability.
Describes a cell structure / cell system.
void set_resort_particles(Cells::Resort level)
Increase the local resort level at least to level.
ParticleRange local_particles() const
boost::mpi::communicator comm_cart
The communicator.
DEVICE_QUALIFIER constexpr T sqr(T x)
Calculates the SQuaRe of x.
This file contains all subroutines required to process rotational motion.
void local_rotate_particle(Particle &p, const Utils::Vector3d &axis_space_frame, const double phi)
Rotate the particle p around the NORMALIZED axis aSpaceFrame by amount phi.
SteepestDescent()=default
double max_displacement
Maximal particle displacement or rotation.
double gamma
Dampening constant.
double f_max
Maximal particle force or torque.
bool propagate(CellStructure &cell_structure) const
Run steepest descent algorithm.