One way to overcome this problem is to couple the simulated system with an external heat bath, provided that all degrees of freedom are interacting with the bath. Several techniques have been developed,
but not all of them are capable of overcoming the ergodicity problem.
One that does is the thermostat developed by Andersen 7.4, which is based on the concept of stochastic collisions. We know that in a perfect gas at some temperature the velocities are distributed according to the Maxwell distribution
, therefore, one way to generate the canonical ensemble is to perform a MD simulation by repeatedly drawing velocities from a Maxwell distribution. This periodic velocity re-initialisation procedure also redistributes energy between different modes, and so it is an effective way to overcome the ergodicity problem. It can be shown that the frequency of these velocity re-initialisations does not affect the ability to sample the canonical ensemble, however, drawing the velocities too often will result in the system moving very slowly from one region of configuration space to another, and drawing them too seldom results in slow transfer of energy between different modes, which would only overcome the ergodicity problem slowly. Finding the appropriate time interval between velocities randomisations is then a matter of finding the right compromise to maximise efficiency.