Calculation of potential energy at different points