I am creating a random configuration of particles for a molecular dynamics simulation, where I would like to guarantee a certain density. The strategy is as follows:
choose randomly the positions of the particles in $x$- and $y$-axis in square of the side length equal to $a$.
compute the distance between every pair of particles, using the periodic boundaries and minimum image conditions.
if the distance is less than $2^{1/6}\sigma$ then we should generate them once again to avoid overlaps.
My problem is that the program for the side length $a=10$, number of particles $n=100$ and the $\sigma=1$ diverges. The maximum $\sigma$ value for which the program gives an output is $0.74$. What is the reason?
Should I change the length side to a higher value? Or there is a other way to make the system more dense?