 In most of molecular dynamics simulations that use constraint algorithms, constraints are enforced using the method of Lagrange multipliers.Given a set of "n" linear (holonomic) constraints at the time "t",

where formula_4 and formula_5 are the positions of the two particles involved in the "k"th constraint at the time "t" and formula_6 is the prescribed inter-particle distance.The forces due to these constraints are added in the equations of motion, resulting in, for each of the "N" particles in the system

Adding the constraint forces does not change the total energy, as the net work done by the constraint forces (taken over the set of particles that the constraints act on) is zero.