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:

  1. choose randomly the positions of the particles in $x$- and $y$-axis in square of the side length equal to $a$.

  2. compute the distance between every pair of particles, using the periodic boundaries and minimum image conditions.

  3. 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?

  • 3
    $\begingroup$ Welcome to SciComp.SE! It is difficult to understand what the problem is, because you are skipping a lot of details: What do you mean by "more dense"? What are the "minimum image conditions"? What do you mean precisely by "the program diverges"? If at all possible, please use mathematical formulas in your description (using LaTeX notation). $\endgroup$ Oct 8, 2015 at 13:20

1 Answer 1


As I am assuming by the word random you mean "liquid or gas like" is there any reason you can't use your MD program itself?

  1. Pick the number of particles and the volume of the unit cell so as to get the density you want
  2. Set the particles up on a regular lattice such as face centred or body centred cubic with some vacancies if required by the number of particles
  3. Run a constant volume simulation at high enough temperature to melt the solid
  4. Re-equilibrate at the temperature of interest

Now I realise this won't exactly satisfy your greater than $2^{1/6}\sigma$ criterion, but to satisfy that exactly will be unphysical and probably not what you want - and any sensible inter-atomic potential will mean there are few such separations. And if you are not using constant volume there are other problems, but I don't see why you can't use a recipe similar to the above.

The method you outline above is going to get very slow for high density systems, random numbers will just lead to too many atomic overlaps. Unfortunately I can't tell you at what reduced density this will start to cause problems in your set up, but in a related one I did many years ago anything for which ${N \over V}\sigma^3$ was greater than about 0.1 ran into problems if (and this is a big if, it's over 20 years ago) I remember correctly.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.