The problem could be due to the parameters used in the simulation.

The above model of calculation assume: the time step is small enough so that the distance move in each time step is smaller than the radius of both particles.

The problem you found much be due to the time step is too large or the velocity is too large.

1. r1 and r2 are about the same or similar order.
2. v_1 *dt<< r_1+r_2 , v_2*dt<< r_1+r_2