![]() |
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
|
#include "rattle.hpp"#include "BoxGeometry.hpp"#include "Particle.hpp"#include "ParticleRange.hpp"#include "bonded_interactions/bonded_interaction_data.hpp"#include "bonded_interactions/rigid_bond.hpp"#include "cell_system/CellStructure.hpp"#include "communication.hpp"#include "errorhandling.hpp"#include <utils/Vector.hpp>#include <utils/math/tensor_product.hpp>#include <utils/matrix.hpp>#include <boost/mpi/collectives/all_reduce.hpp>#include <boost/range/algorithm.hpp>#include <cmath>#include <cstddef>#include <functional>#include <span>#include <variant>#include <vector>
Include dependency graph for rattle.cpp:Go to the source code of this file.
Functions | |
| static void | check_convergence (int cnt, char const *const name) |
| void | save_old_position (const ParticleRange &particles, const ParticleRange &ghost_particles) |
| copy current position | |
| static void | init_correction_vector (const ParticleRange &particles, const ParticleRange &ghost_particles) |
| reset correction vectors to zero | |
| static bool | calculate_positional_correction (RigidBond const &ia_params, BoxGeometry const &box_geo, Particle &p1, Particle &p2, int bond_id, std::vector< Utils::Vector9d > &rigid_bond_virial) |
| Calculate the positional correction for the particles. | |
| template<typename Kernel > | |
| static bool | compute_correction_vector (CellStructure &cs, BoxGeometry const &box_geo, BondedInteractionsMap const &bonded_ias, Kernel kernel) |
| Compute the correction vectors using given kernel. | |
| static void | apply_positional_correction (const ParticleRange &particles) |
| Apply positional corrections. | |
| void | correct_position_shake (CellStructure &cs, BoxGeometry const &box_geo, BondedInteractionsMap &bonded_ias) |
| Propagate velocity and position while using SHAKE algorithm for bond constraint. | |
| static bool | calculate_velocity_correction (RigidBond const &ia_params, BoxGeometry const &box_geo, Particle &p1, Particle &p2) |
| Calculate the velocity correction for the particles. | |
| static void | apply_velocity_correction (ParticleRange const &particles) |
| Apply velocity corrections. | |
| void | correct_velocity_shake (CellStructure &cs, BoxGeometry const &box_geo, BondedInteractionsMap const &bonded_ias) |
| Correction of current velocities using RATTLE algorithm. | |
Variables | |
| static constexpr auto | shake_max_iterations = 1000 |
| Maximal number of iterations before the RATTLE algorithm bails out. | |
|
static |
Apply positional corrections.
| particles | particle range |
Definition at line 172 of file rattle.cpp.
References Particle::pos(), Particle::rattle_params(), and Particle::v().
Referenced by correct_position_shake().
|
static |
Apply velocity corrections.
| particles | particle range |
Definition at line 256 of file rattle.cpp.
References Particle::rattle_params(), and Particle::v().
Referenced by correct_velocity_shake().
|
static |
Calculate the positional correction for the particles.
| ia_params | Parameters |
| box_geo | Box geometry. |
| p1 | First particle. |
| p2 | Second particle. |
| bond_id | Bonded interaction id of this specific bond. |
| rigid_bond_virial | Per-bond-type RATTLE constraint virial accumulator, indexed by bond_id. |
Definition at line 99 of file rattle.cpp.
References Utils::flatten(), BoxGeometry::get_mi_vector(), stream, and Utils::tensor_product().
Referenced by correct_position_shake().
|
static |
Calculate the velocity correction for the particles.
| ia_params | Parameters |
| box_geo | Box geometry. |
| p1 | First particle. |
| p2 | Second particle. |
Definition at line 230 of file rattle.cpp.
References BoxGeometry::get_mi_vector(), and stream.
Referenced by correct_velocity_shake().
Definition at line 52 of file rattle.cpp.
References runtimeErrorMsg, shake_max_iterations, and stream.
Referenced by correct_position_shake(), and correct_velocity_shake().
|
static |
Compute the correction vectors using given kernel.
| cs | cell structure |
| box_geo | Box geometry |
| bonded_ias | Bonded interactions |
| kernel | kernel function |
Definition at line 145 of file rattle.cpp.
References BondedInteractionsMap::at(), CellStructure::bond_loop(), and stream.
Referenced by correct_position_shake(), and correct_velocity_shake().
| void correct_position_shake | ( | CellStructure & | cs, |
| BoxGeometry const & | box_geo, | ||
| BondedInteractionsMap & | bonded_ias | ||
| ) |
Propagate velocity and position while using SHAKE algorithm for bond constraint.
Accumulate the per-bond-type RATTLE constraint virial into bonded_ias.rigid_bond_virial.
Definition at line 179 of file rattle.cpp.
References apply_positional_correction(), Utils::Vector< T, N >::broadcast(), calculate_positional_correction(), check_convergence(), CellStructure::check_resort_required(), comm_cart, compute_correction_vector(), Cells::DATA_PART_MOMENTUM, Cells::DATA_PART_POSITION, Cells::DATA_PART_PROPERTIES, BondedInteractionsMap::get_next_key(), CellStructure::ghost_particles(), CellStructure::ghosts_reduce_rattle_correction(), CellStructure::ghosts_update(), init_correction_vector(), CellStructure::local_particles(), Cells::RESORT_LOCAL, Cells::RESORT_NONE, BondedInteractionsMap::rigid_bond_virial, CellStructure::set_resort_particles(), shake_max_iterations, stream, and CellStructure::update_ghosts_and_resort_particle().
Referenced by System::System::integrate().
| void correct_velocity_shake | ( | CellStructure & | cs, |
| BoxGeometry const & | box_geo, | ||
| BondedInteractionsMap const & | bonded_ias | ||
| ) |
Correction of current velocities using RATTLE algorithm.
Definition at line 261 of file rattle.cpp.
References apply_velocity_correction(), calculate_velocity_correction(), check_convergence(), comm_cart, compute_correction_vector(), Cells::DATA_PART_MOMENTUM, Cells::DATA_PART_POSITION, CellStructure::ghost_particles(), CellStructure::ghosts_reduce_rattle_correction(), CellStructure::ghosts_update(), init_correction_vector(), CellStructure::local_particles(), shake_max_iterations, and stream.
Referenced by System::System::integrate().
|
static |
reset correction vectors to zero
| particles | particle range |
| ghost_particles | ghost particle range |
Definition at line 79 of file rattle.cpp.
Referenced by correct_position_shake(), and correct_velocity_shake().
| void save_old_position | ( | const ParticleRange & | particles, |
| const ParticleRange & | ghost_particles | ||
| ) |
copy current position
Transfer the current particle positions from Particle::pos to Particle::pos_last_time_step.
| particles | particle range |
| ghost_particles | ghost particle range |
Definition at line 65 of file rattle.cpp.
References stream.
Referenced by System::System::integrate().
Maximal number of iterations before the RATTLE algorithm bails out.
Definition at line 50 of file rattle.cpp.
Referenced by check_convergence(), correct_position_shake(), and correct_velocity_shake().