Compute forces and potential energy (still without numpy)