I'm trying to simulate particle attraction and motion.

Given two particles with 0 velocity at distance X, the acceleration due to attraction is such that the sum of acceleration must be equal to the sum of the deceleration over the same time after the particles pass causing the velocity to return to 0 at the precise distance X.

At t1 particle velocity is 0. Particles attract towards each other increasing in velocity until they pass and begin to decelerate.

The problem is at some distance before they pass (at t2) they will have sufficient velocity to pass each other on the next iteration (t3). At t3 the distance will not be the same as t2 causing the deceleration to be different.

Anyone have a clue how to calculate the correct acceleration?