Note on GCMC and dump sorted by atom id

In the past, I endured random segfaults on fix gcmc
on molecules when writing configurations w/sorted atoms.
This resulted, after maybe hours or even days, in random
crashes without extra information. It had to be somewhere
within the dump routine because the output file *was* created
(and had size 0).

Example: when running 20 simulations on different molecular
densities, 10 of those (maybe those with larger fluctuations
on atom id's) would segfault during the next days
when (for example)

     dump conf all xyz 10000 config/c.*.xyz
     dump_modify conf sort id

was set in the input file.

Later I found out this could be completely resolved by
removing sorting (# dump_modify conf sort id), and,
of course, switching to other (custom) output formats
containing a molecule identifier (because atoms now
written out in random order).

Q: is this a known restriction or is this behavior
unknown and rewards further digging?


This sounds like you have found a hard to reproduce bug with the sorting method. I cannot easily check the source right now, but you should be able to revert to a (slower) sort method when compiling with -DLAMMPS_QSORT or something similar.

Please let me know if that makes a difference.

Thanks, Axel.

Could you also attach an example script that reproduces this problem? Easier for us to debug :smiley: