Abstract
A molecular dynamics simulation method which can generate configurations belonging to the canonical (T, V, N) ensemble or the constant temperature constant pressure (T, P, N) ensemble, is proposed. The physical system of interest consists of N particles (f degrees of freedom), to which an external, macroscopic variable and its conjugate momentum are added. This device allows the total energy of the physical system to fluctuate. The equilibrium distribution of the energy coincides with the canonical distribution both in momentum and in coordinate space. The method is tested for an atomic fluid (Ar) and works well.