# Thermostat

The best thermostat implemented in the simulation code (*john* thermostat) is a simple thermostat
that emulates Brownian dynamics. The system is evolved integrating Newton's
equations of motion ('NVE' ensemble) for a given (small) number of steps.
Then the velocity and momentum of each particle are refreshed, with a given
fixed probability. The new velocities and momenta are chosen according to
the Maxwell distribution of the temperature at which the simulation is run.
This approximates a Brownian dynamics on time scales much longer than the
refresh interval.

**dt**time steps of the integration**newtonian steps**number of steps between refresh attempts**pt**the probability with which each particle gets its velocity and momentum refreshed at each attempt.**diff_coeff**the overall monomer diffusion coefficient resulting from the thermostat. The code internally sets`pt`to get this value. Specifying`pt`will override this, regardless which comes first in the input file.

The algorithm works as follows: the system is evolved for a number of steps equal to `newtonian_steps` according to Newton's equations of motion. Then for each particle a random number is extracted; if it is larger than the value for `pt` (either set explicitly or derived
from `diff_coeff`) the particle is left untouched. If the random number extracted is lower than the value of `pt`, each of the components of the the velocity and angular momentum of the particle are refreshed according to
the Maxwell distribution dictated by the value of the temperature.

A completely Brownian dynamics (on the time scale set by `dt`) can be obtained setting `pt = 1` and `newtonian_steps = 0`. Of course, this makes little sense.

Increasing the value of `pt` makes the dynamics more damped, so that overall diffusion is slower but local motion is somewhat better explored. We found that a good thermostat setting to study diffusion-limited events is to set `diff_coeff = 2.5` and `newtonian_steps = 103`. If one is not limited by diffusion, internal relaxation can be sped up by lowering the value of `diff_coeff` by a factor 2 or 4.