  In the formalism of constrained mechanics, such as that which underlies the
SHAKE and RATTLE methods of molecular dynamics, we present an algorithm to
convert any one-step integration method to a variational integrator of the same
order. The one-step method is arbitrary, and the conversion can be automated,
resulting in a powerful and flexible approach to the generation of novel
variational integrators with arbitrary order.
