ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
rattle.cpp File Reference
#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 <boost/mpi/collectives/all_reduce.hpp>
#include <boost/range/algorithm.hpp>
+ Include dependency graph for rattle.cpp:

Go to the source code of this file.

Functions

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)
 Calculate the positional correction for the particles.
 
template<typename Kernel >
static bool compute_correction_vector (CellStructure &cs, BoxGeometry const &box_geo, 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)
 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)
 Correction of current velocities using RATTLE algorithm.
 

Function Documentation

◆ apply_positional_correction()

static void apply_positional_correction ( const ParticleRange particles)
static

Apply positional corrections.

Parameters
particlesparticle range

Definition at line 134 of file rattle.cpp.

References Particle::pos(), Particle::rattle_params(), and Particle::v().

Referenced by correct_position_shake().

◆ apply_velocity_correction()

static void apply_velocity_correction ( ParticleRange const &  particles)
static

Apply velocity corrections.

Parameters
particlesparticle range

Definition at line 213 of file rattle.cpp.

References Particle::rattle_params(), and Particle::v().

Referenced by correct_velocity_shake().

◆ calculate_positional_correction()

static bool calculate_positional_correction ( RigidBond const &  ia_params,
BoxGeometry const &  box_geo,
Particle p1,
Particle p2 
)
static

Calculate the positional correction for the particles.

Parameters
ia_paramsParameters
box_geoBox geometry.
p1First particle.
p2Second particle.
Returns
True if there was a correction.

Definition at line 75 of file rattle.cpp.

References RigidBond::d2, BoxGeometry::get_mi_vector(), Particle::mass(), RigidBond::p_tol, Particle::pos(), Particle::pos_last_time_step(), and Particle::rattle_params().

Referenced by correct_position_shake().

◆ calculate_velocity_correction()

static bool calculate_velocity_correction ( RigidBond const &  ia_params,
BoxGeometry const &  box_geo,
Particle p1,
Particle p2 
)
static

Calculate the velocity correction for the particles.

The position correction is accumulated in the forces of the particles so that it can be reduced over the ghosts.

Parameters
ia_paramsParameters
box_geoBox geometry.
p1First particle.
p2Second particle.
Returns
True if there was a correction.

Definition at line 187 of file rattle.cpp.

References RigidBond::d2, BoxGeometry::get_mi_vector(), Particle::mass(), Particle::pos(), Particle::rattle_params(), Particle::v(), and RigidBond::v_tol.

Referenced by correct_velocity_shake().

◆ compute_correction_vector()

template<typename Kernel >
static bool compute_correction_vector ( CellStructure cs,
BoxGeometry const &  box_geo,
Kernel  kernel 
)
static

Compute the correction vectors using given kernel.

Parameters
cscell structure
box_geoBox geometry
kernelkernel function
Returns
True if correction is necessary

Definition at line 107 of file rattle.cpp.

References BondedInteractionsMap::at(), CellStructure::bond_loop(), and bonded_ia_params.

Referenced by correct_position_shake(), and correct_velocity_shake().

◆ correct_position_shake()

◆ correct_velocity_shake()

◆ init_correction_vector()

static void init_correction_vector ( const ParticleRange particles,
const ParticleRange ghost_particles 
)
static

reset correction vectors to zero

Parameters
particlesparticle range
ghost_particlesghost particle range

Definition at line 58 of file rattle.cpp.

Referenced by correct_position_shake(), and correct_velocity_shake().

◆ save_old_position()

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.

Parameters
particlesparticle range
ghost_particlesghost particle range

Definition at line 44 of file rattle.cpp.

Referenced by System::System::integrate().