Calculation of gravitational field