Generalized Green's function molecular dynamics for canonical ensemble simulations.