Simulation of particles in gravity fields