Implementation of the fast multipole method (FMM) for the evaluation of potentials and force fields in gravitation/electrostatics problems