ESPResSo 3.2.0-167-g2c9ead1-git
Extensible Simulation Package for Soft Matter Research
Functions | Variables
rattle.c File Reference
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "domain_decomposition.h"
#include "rattle.h"
Include dependency graph for rattle.c:

Go to the source code of this file.

Functions

void save_old_pos ()
 Transfers the current particle positions from r.p[3] to r.p_pold[3] of the Particle structure.
void init_correction_vector ()
 Initialize the correction vector.
void correct_pos_shake ()
 Propagate velocity and position while using SHAKE algorithm for bond constraint.
void correct_vel_shake ()
 Correction of current velocities using RATTLE algorithm.
int rigid_bond_set_params (int bond_type, double d, double p_tol, double v_tol)
 set the parameter for a rigid, aka RATTLE bond
Private functions
void compute_pos_corr_vec (int *repeat_)
 Calculates the corrections required for each of the particle coordinates according to the RATTLE algorithm.
void app_pos_correction ()
 Positional Corrections are added to the current particle positions.
void transfer_force_init_vel ()
 Transfers temporarily the current forces from f.f[3] of the Particle structure to r.p_old[3] location and also intializes velocity correction vector.
void compute_vel_corr_vec (int *repeat_)
 Calculates corrections of the current particle velocities according to RATTLE algorithm.
void apply_vel_corr ()
 Velocity corrections are added to the current particle velocities.
void revert_force ()
 Invoked from correct_vel_shake().
void print_bond_len ()
 For debugging purpose--prints the bond lengths between particles that have rigid_bonds.

Variables

int n_rigidbonds = 0
 number of rigid bonds

Function Documentation

void app_pos_correction ( )

Positional Corrections are added to the current particle positions.

Apply corrections to each particle.

Invoked from correct_pos_shake()

Completed for one particle

Definition at line 185 of file rattle.c.

References CellPList::cell, ParticleForce::f, Particle::f, i, local_cells, Particle::m, CellPList::n, ParticleList::n, ParticlePosition::p, ParticleList::part, Particle::r, and ParticleMomentum::v.

Referenced by correct_pos_shake().

void apply_vel_corr ( )

Velocity corrections are added to the current particle velocities.

Apply velocity corrections.

Invoked from correct_vel_shake()

Completed for one particle

Definition at line 336 of file rattle.c.

References CellPList::cell, ParticleForce::f, Particle::f, i, local_cells, Particle::m, CellPList::n, ParticleList::n, ParticleList::part, and ParticleMomentum::v.

Referenced by correct_vel_shake().

void compute_pos_corr_vec ( int *  repeat_)
void compute_vel_corr_vec ( int *  repeat_)
void correct_pos_shake ( )
void correct_vel_shake ( )

Correction of current velocities using RATTLE algorithm.

transfer the current forces to r.p_old of the particle structure so that velocity corrections can be stored temporarily at the f.f[3] of the particle structure

Puts back the forces from r.p_old to f.f[3]

Definition at line 393 of file rattle.c.

References apply_vel_corr(), cell_structure, CellStructure::collect_ghost_force_comm, comm_cart, compute_vel_corr_vec(), errexit(), ghost_communicator(), init_correction_vector(), MPI_Bcast(), MPI_INT, MPI_Reduce(), MPI_SUM, revert_force(), SHAKE_MAX_ITERATIONS, this_node, transfer_force_init_vel(), and CellStructure::update_ghost_pos_comm.

Referenced by integrate_vv().

void init_correction_vector ( )

Initialize the correction vector.

The correction vector is stored in f.f of particle strcuture.

Definition at line 98 of file rattle.c.

References CellPList::cell, Particle::f, ghost_cells, i, local_cells, CellPList::n, ParticleList::n, and ParticleList::part.

Referenced by correct_pos_shake(), and correct_vel_shake().

void print_bond_len ( )
void revert_force ( )

Invoked from correct_vel_shake().

Put back the forces from r.p_old to f.f.

Put back the forces from r.p_old to f.f

Definition at line 362 of file rattle.c.

References CellPList::cell, Particle::f, ghost_cells, i, local_cells, CellPList::n, ParticleList::n, ParticlePosition::p_old, ParticleList::part, and Particle::r.

Referenced by correct_vel_shake().

int rigid_bond_set_params ( int  bond_type,
double  d,
double  p_tol,
double  v_tol 
)
void save_old_pos ( )

Transfers the current particle positions from r.p[3] to r.p_pold[3] of the Particle structure.

Invoked from correct_pos_shake()

Definition at line 69 of file rattle.c.

References CellPList::cell, ghost_cells, i, local_cells, CellPList::n, ParticleList::n, ParticlePosition::p, ParticleList::part, and Particle::r.

Referenced by integrate_vv().

void transfer_force_init_vel ( )

Transfers temporarily the current forces from f.f[3] of the Particle structure to r.p_old[3] location and also intializes velocity correction vector.

The forces are transfered temporarily from f.f member of particle structure to r.p_old, which is idle now and initialize the velocity correction vector to zero at f.f[3] of Particle structure.

Invoked from correct_vel_shake()

Definition at line 243 of file rattle.c.

References CellPList::cell, ParticleForce::f, Particle::f, ghost_cells, i, local_cells, CellPList::n, ParticleList::n, ParticlePosition::p_old, ParticleList::part, and Particle::r.

Referenced by correct_vel_shake().


Variable Documentation

int n_rigidbonds = 0

number of rigid bonds

Definition at line 30 of file rattle.c.

Referenced by on_ghost_flags_change(), and rigid_bond_set_params().