Hi all - I’m doing something a little out of the usual lammps paradigm, and I’m hoping someone can help me fix my problem in a clean way.
Basically, what I want to do is this:
- Use the python interface to do an MD trajectory near the stability edge, so occasionally atoms explode and end up at positions that look like 1e20
- Correct for these explosions, so the next evaluation will be with a sensible configuration
The problem is that at the end of step one, the lammps arrays contain the crazy position values. Then, when I do step 2, I try to do the following two things:
a. Send a “change_box …” command from the python interface
b. Send the new positions with a scatter() python call
The problem is that the change_box command calls ChangeBox::command(), which, near the end, calls Domain::remap(). Note that this is not the change_box command line argument ‘remap’ (which I don’t need or want), and it always happens. The loop inside Domain::remap() never ends, either because I’m not patient enough to wait for the position to be shifted from 1e+22 to 0, or because it’ll never happen because of underflows.
I thought this would be easy to fix, just switch the order of b and a. Change box (without remap) isn’t supposed to move atoms. However, in this (weird, I admit) case it does. Starting in line 200, there’s a sequence of calls, one of which (domain->reset_box(), I think), trigger a call do Domain::remap(). This remap() maps atoms (which were set in step a, and correspond to the box that will be set later in ChangeBox::command()), using the previous box. Then, when the actual new pbcs are set later in ChangeBox::command() (the calls to set_global_box), the atom has already been moved to the wrong place.
The only solution I can think for this is to go to my original order, but first test for crazy positions (perhaps non-trivial cost to check), and reset them (with a possibly expensive scatter call).
Does anyone have any suggestions for a cleaner way of dealing with my problems? I have new, sensible positions and a box. How do I change lammps’s state from the old one with broken positions to the new one?
thanks,
Noam