Force and heat current formulas for many-body potentials in molecular dynamics simulations with applications to thermal conductivity calculations