Fix rigid: Atoms have moved too far apart

Dear all,

I am using LAMMPS version 2 Aug 2023 - Update 2. I use the “fix rigid” command to simulate CO2 with the TraPPE model. However, when I write two “run” commands at the beginning of the second run or use the data file output as another simulation input, I sometimes encounter the following error:

ERROR on proc 0: Atoms have moved too far apart (734.0632310066682) for minimum image (src/domain.cpp:994).

What should be done to solve this error? Is this a software bug? I also tested with the version (7 Feb 2024 version) and got the same results.

Best regards,
Saeed

That depends on what you do in your input.

Unlikely.

I am running into the same problem.
I use the lammps binary from 21 Nov 2023.

I have rigid methane like molecules.
The inputfile: in.gcmc.sio4 (2.2 KB)
The molecule file: SiO4.txt (697 Bytes)
The input file where I try to restart:in.gcmc.sio4 (1.8 KB)
The restart files
restartfile.80000000 (937.3 KB)
restartfile.80000000.rigid (375.3 KB)

I have the same problem when restart the simulation. could you fix this?

Hi all - thanks JPBergsma for posting a set of files that reproduces the problem.

The issue is that fix rigid/small is using the mimimum_image() method in the Domain
class to do an operation that used to be OK for fix rigid/small, but now isn’t b/c the minimum_image()
method was changed to avoid problems with other use cases when with bad dynamics blew atoms out of the box to be “infinitely” far away. It had the unintended side effect that it breaks fix rigid/small when you run for a long time and a rigid body crosses the periodic boundary more
than 16 times, which is the case with JPBergsma’s files.

If any of you can re-compile LAMMPS yourself, you can change this line in src/domain.cpp
static constexpr double MAXIMGCOUNT = 16;
to a larger value, e.g. 1024, then recompile and your restart script should run.

A more robust solution will require the developers to post a new PR and then merge it into the
develop branch and do a new code release (likely sometime in the next week or two).

1 Like

I should clarify the issue is when a rigid body in the restart file is 16+ box lengths away from its starting position, not just crossed a periodic boundary 16 times, e.g. back and forth.

Personally I like this approach a lot better: Alternative `minimum_image` code by stanmoore1 · Pull Request #3721 · lammps/lammps · GitHub.

The more general fix is now available as PR #4123 using the code suggested by @stamoor

I compiled it on my computer, and it works now; the problem has been fixed.

Thanks for reporting. Please make sure you update to the next LAMMPS feature release when it becomes available to have the proper fix.