27#include "communication.hpp"
30#include "system/System.hpp"
35#include <boost/mpi/collectives/all_reduce.hpp>
36#include <boost/mpi/operations.hpp>
48 auto f_max = -std::numeric_limits<double>::max();
51 for (
auto &p : particles) {
55 for (
auto j = 0u; j < 3u; ++j) {
57 if (!p.is_fixed_along(j)) {
74 auto const t = p.torque().norm2();
77 auto const l = dq.norm();
79 auto const axis = dq / l;
87 f_max = std::max(f_max, t);
91 f_max = std::max(f_max, f);
98 auto const f_max_global =
99 boost::mpi::all_reduce(
comm_cart, f_max, boost::mpi::maximum<double>());
109 const double f_max,
const double gamma,
const double max_displacement)
110 : f_max{f_max}, gamma{gamma}, max_displacement{max_displacement} {
112 throw std::runtime_error(
"The maximal force must be positive.");
115 throw std::runtime_error(
"The dampening constant must be positive.");
118 throw std::runtime_error(
"The maximal displacement must be positive.");
Vector implementation and trait types for boost qvm interoperability.
std::shared_ptr< CellStructure > cell_structure
boost::mpi::communicator comm_cart
The communicator.
This file contains the defaults for ESPResSo.
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.
bool steepest_descent_step(const ParticleRange &particles)
Steepest descent integrator.
void register_integrator(SteepestDescentParameters const &obj)
static SteepestDescentParameters params
Currently active steepest descent instance.
Parameters for the steepest descent algorithm.
double gamma
Dampening constant.
double max_displacement
Maximal particle displacement.
double f_max
Maximal particle force.
SteepestDescentParameters(double f_max, double gamma, double max_displacement)