small refactoring of force calculation