Performance improvements to CPU implementation of custom forces