I do not understand your question.
The interaction force between any two particles are model with relation: where is the distance between any two particles. (because it is 2D model so force is proportional to 1/r).
The gravitationf force should be model with for 3D simulation.
And particles are generated at random position with random velocity.