A Nosé-Poisson thermostat method for simulations in the canonical ensemble