# Algorithms¶

## MPCD¶

The MPCD algorithm introduced in [MK99] is implemented in simple_mpcd_step for periodic boundary conditions.

The presence of walls is taken into account in wall_mpcd_step following [LGIK01]: ghost particles are placed in the boundary cells, during the collision, to reach the average density of the solvent. Optionally, a bulk Anderson thermostat can also be applied in this routine.

## Molecular Dynamics¶

Molecular Dynamics (MD) is implemented using the Velocity verlet integration scheme [MK00], where solvent particles and colloids evolve at the MD timestep \(dt\).

The implementation in RMPCDMD is found in md_pos and md_vel. It is
important to know that particles close to walls have their velocities updated in the
*stream* routines and are skipped in md_vel. This is only correct if they are
outside of the interaction range of all colloids, which is the case in all simulations here.

## Boundary conditions¶

Bounce-back boundary conditions are used for the walls, in addition to the modified collision rule. The are presented in [AG02] or [WL10] and implemented in mpcd_stream_xforce_yzwall. There, the bounce-back collision is computer for the parabolic trajectories relevant for forced flows.

## Convenience routines¶

### Temperature computation¶

A general routine to compute the temperature compute_temperature computes cell-wise the kinetic energy relative to the cell’s center-of-mass.

\[T = \frac{1}{3N_c} \sum_\xi \frac{1}{N_\xi-1} \sum_i m_i \left( v_i - v_\xi \right)^2\]

where \(N_c\) is the number of cells, the variable \(\xi\) represents a cell, \(N_\xi\) the number of particles in a cell, \(v_\xi\) the center-of-mass velocity of the cell, and \(m_i\) and \(v_i\) the mass and velocity of particle.