Degrees of freedom
==================

The temperature $`T`$ is computed from the kinetic energy $`K`$ using the expression
```math
T = K \times 2 / (N_f \times k_b)
```
where $`k_b`$ is the Boltzmann constant and $`N_f`$ is the number of degrees of freedom of the system.
The number of degrees of freedom depends on the type of simulations running:

* for 3D simulations with only mobile atoms: $`N_f = 3 \times N_\mathrm{mobile} - 3`$
* for simulations with immobile electrolyte atoms: $`N_f = 3 \times N_\mathrm{mobile}`$
* for 2D simulations with immobile electrodes: $`N_f = 3 \times N_\mathrm{mobile}`$
* for 2D simulations with piston electrodes: $`N_f = 3 \times N_\mathrm{mobile} - 1`$

where $`N_\mathrm{mobile}`$ is the number of mobile electrolyte atoms.

This number of degrees of freedom needs also to take into account additional constraints introduced by intramolecular constraints. 
* for each molecule, one RATTLE constraint correspond to one less degree of freedom:

$`N_f \leftarrow N_f - 3 \times N_\mathrm{constraints}`$ [which corresponds for a rigid molecule to 6 degrees of freedom per molecule (3 for translation, 3 for rotations)] 
* except for linear molecules: 

$`N_f \leftarrow N_f + 5 - 3 \times N_\mathrm{sites}`$ [the degrees of freedom are only 5 (3 for translation and 2 for rotation)]