Molecular dynamics simulation using the metropolis-hastings monte carlo method