Routines to simplify the implementation of stochastic velocity rescaling in MD codes