We present a new algorithm for molecular dynamics simulation involving holonomic constraints. Constrained equations of motion are derived using Gauss' principle of least constraint. The algorithm uses a fast, exact solution for constraint forces and a new procedure to correct for accumulating numerical errors. We report several simulations of liquid n-butane and n-decane performed with the new algorithm. We obtain an average trans population of 60.6±1.5% in liquid butane at T=291 K and ρ=0.583 g/ml. This result essentially agrees with that from an earlier simulation by Ryckaert and Bellemans [Discuss. Faraday Soc. 66, 95 (1978)]. However, our simulations are substantially more precise; our run lengths are typically ̃20 times longer than those of Ryckaert and Bellemans. Our result also agrees with that from a recent simulation by Wielopolski and Smith (following paper). Thermodynamic and structural data from our simulations also agree well with results from the simulations discussed in the above articles.