An efficient algorithm for metric correction forces in simulations of linear polymers with constrained bond lengths