## Thermostats and constant temperature MD
Theoretically, from the establish algorithm, the constant energy is always a requirement for MD, so realizations other than [[Ensemble#Microcanonical ensemble|microcanonical ensemble]] is impossible (because we derived everything at constant $H$). But by using thermostats, people are able to handle constant $T$ case, i.e., canonical ensemble.
But one should remember, that even for a system follows Maxwell-Boltzmann distribution, and
$k_B T = m \langle v_\alpha ^2 \rangle$
There are fluctuation in temperature as
$\frac{\sigma_{T_k}^2}{\langle T_k\rangle_{NVT}^2} = \frac{2}{3N}$
for large $N$ this gets smaller though, The variance is theoretical exists.
>[!notice]
>For $k_B T = m \langle v_\alpha ^2 \rangle$, $m$ is mass, and this equation only shows one dimensional result.
>
>And for the later equation, $\frac{\sigma_{T_k}^2}{\langle T_k\rangle_{NVT}^2} = \frac{2}{3N}$, left side is the relative variance of temperature, $\sigma_{T_k} =\langle T_k^2\rangle_{NVT}- \langle T_k\rangle_{NVT}^2$.
So if we rescale the temperature by assigning different velocity, it would not properly characterize our system, because it does not correspond to any ensemble (with no temperature fluctuation at all!) ^edca50
>[!info]
>Read the following two chapters for more information!
>[[Velocity rescaling]]
>[[Thermostats by stochastic collision]]
>
>For implementation in CP2K, check https://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/MD/THERMOSTAT.html