Handles collision.


YF has old module handling ratherford scattering. I haven’t ported it, but can be done on request.

irfpy.util.collision.binary_collision(mass1, pos1, vel1, mass2, pos2, vel2, collision_length)[source]

Calculate the binary collision

  • mass1 – Mass of the particle 1

  • pos1 – Postion vector of the particle 1

  • vel1 – Velocity vector of the particle 1

  • mass2 – Mass of the particle 2

  • pos2 – Postion vector of the particle 2

  • vel2 – Velocity vector of the particle 2

irfpy.util.collision.binary_collision_stationary_vector1(mass1, pos1, vel1, mass2, collision_length)[source]

Slightly generalized version of binary_collision_stationary()

Calculate the final velocity after the binary collision.

This function accepts the position and velocity vectors of particle 1. Particle 2 should be origin, and stationary. If the negative relative velocity (particles 1 and 2 separates as time goes), a collision will not happen.

Other conditions are hold as binary_collision_stationary(). (e.g. Particle 2 should be at origin, and stationary.)

irfpy.util.collision.binary_collision_stationary(mass1, speed1, mass2, impact_parameter, collision_length)[source]

Cancluate a binary collision in one-particle stationary system.

  • mass1 – Mass of moving particle, m1

  • speed1 – Speed of the moving particle, v1. Positive.

  • mass2 – Mass of stationary particle, m2

  • impact_parameter – The impact parameter, d. Positive.

  • collision_length – The radius of the cross section, or r1+r2 where r1 is the radius of the moving particke and r2 is the radius of the stationary particle.


(V1, W1, V2, W2)

A binary collision is simulated here. Situation is that a flying (incoming) particle 1 has mass1 with speed 1 (positive y component) in the (negative x, positive y) quadrant. The stationary particle 2 at the origin will be collided. The returned is the final velocity (x, y components). If the impact paramter is more than the collision_length, the particle will not collide.


A binary collision is characterized by the two particles with masses, m1 and m2.

Let’s be in a system where the second particle with m2 is in rest at the origin. This system change be chosen without losing the generality.

First particle (with m1) flies from infinite -x, toward the origin, with a speed of v1 along x axis. Just by rotation, we can select a frame that the first particle is in the (-x, +y) quadrant, center in z=0 plane, with v1>0 with only vx component.

Then, after the collision, the motion of two particles should be confined in x-y plane since no force acting in the z direction. Assume the resulting velocity vector as (V1, W1) for particle m1, and (V2, W2) for particle m2.

Momentum conservation will give you

\[m_1 v_1 = m_1 V_1 + m_2 V_2\]


\[0 = m_1 W_1 + m_2 W_2\]

Energy conservation will give you

\[m_1 v_1^2 = m_1 V_1^2 + m_1 W_1^2 + m_2 V_2^2 + m_2 W_2^2\]

The force only act on the collision, so that the particle m2 should have the following geometric relation of velocity.

\[W_2 = -\frac{d}{\sqrt{(r_1+r_2)^2 - d^2}} V_2\]

Solving above four equations to derive the V1, W1, V2 and W2. For simplicity, we use the following notations.

\[\begin{split}\mu &= \frac{m_2}{m_1} \\ \delta &= \frac{d}{\sqrt{(r_1+r_2)^2 - d^2}} \\ \alpha &= (\mu+1)(1+\delta^2)\end{split}\]

The solutions are

\[\begin{split}V_1 &= v_1 (1 - \frac{2\mu}{\alpha}) \\ W_1 &= \frac{2v_1\mu\delta}{\alpha} \\ V_2 &= \frac{2v_1}{\alpha} \\ W_2 &= -\frac{2v_1\delta}{\alpha} \\\end{split}\]


To check the above formulation is correct. In particular the fourth equation should be checked. How to? Probably we may need another formulation using center of gravity system…