Collision function for N-body codes

Collision function for N-body codes