problem with merging two data

Dear Lammps developers and users,

I am going to merge two data file using LAMMPS, stable version 12 Aug 2018 .To do this following steps were done:

  • First simulation was performed using NVT and first data file are generated by “write_data”. This system consists of calcite and aqueous solution (lowereq.data).

  • Second simulation was performed using NPT and second data file are generated by “write_data”. This system consists of another aqueous solution with different composition (uppereq.data).

-Then two data file were joined according to “join.in” to obtain “total.data”.

  • Final simulation (final.in) was performed using “total.data”.

Although merging two data file are done, there is a problem with final.in. My job starting and minimize the structure then hang in step 1! The following warning is received:

WARNING: Inconsistent image flags (…/domain.cpp:782)

WARNING: Bond/angle/dihedral extent > half of periodic box length (…/domain.cpp:903)

I suppose that this problem is due to periodic boundary condition in z direction which causes the bond that would be acceptable for pbc in second data file, is incorrect after merging two data file. But I don’t know how to solve this problems. I used the “set atom image” before “write_data” command, but it couldn’t help.

The input files are attached.

Any hint will be appreciated.


input files.rar (2.68 KB)

WARNING: Inconsistent image flags (../domain.cpp:782)
WARNING: Bond/angle/dihedral extent > half of periodic box length (../domain.cpp:903)

One possible explanation for the second warning is the size of your
simulation box is too small. (...or one of your bonds is extremely
long, but that seems less likely.)
I suppose it's possible that this -might- also cause the other warning
(inconsistent image flags).

The best way to tell what is going on is to look at your new data file.
Have you tried visualizing your system?
There are some instructions for doing that using VMD below
https://github.com/jewettaij/moltemplate/blob/master/examples/all_atom/force_field_OPLSAA/ethylene%2Bbenzene/README_visualize.txt
Specific instructions for displaying the boundary box and the periodic
images are in part 4) near the bottom of that file.

If there is a problem with your simulation box, you can edit the
header portion of the DATA file manually using a text editor. The
format of a data file is explained here:
https://lammps.sandia.gov/doc/2001/data_format.html
If you don't want to manually edit the file, you can load it and then
change the boundary box using the "change_box" command:
https://lammps.sandia.gov/doc/change_box.html

I don't know if this will help.
Sorry, I was too lazy to read your input files carefully.
(Incidentally, please don't attach files in .RAR format. ZIP or
TAR.GZ format are preferred.)

Cheers
Andrew

Dear Andrew,

Thanks for your help

I visualized the structure using ovito. The images first and second data file (lowereq and uppereq)as well as total.data (after merging two data file) are attached. It seems that there is a problem with periodic boundary condition.

I change the size of box but it didn’t help and the simulation hang in the first step with “Inconsistent image flags (…/domain.cpp:782)” warning.

I tried some scenario for better understanding of the problem:

-First data file (lowereq.data) was loaded in the simulation. Although inconsistent image flags warning is received again, but the simulation proceed normally.

-Second data file (uppereq.data) was loaded in another simulation. the simulation proceeds without any warning.

  • In the next try, first data file merge with a new data file (which was the second data file before equilibration (upper.data) and the load in a simulation. In this case the simulation proceeds as well although the warning is received again.

However I didn’t succeed to run the simulation after merging two data (uppereq.data and lowereq.data). I would appreciate if any one help me with this. Is there a solution for merging two box which are fully periodic. How should set image flag to avoid this problem?

Due to the restriction imposed by mailing list on the size of attachments, I cannot send associating data file, but, it will be OK to send anyone if want.

Any hint is welcome

WARNING: Inconsistent image flags (…/domain.cpp:782)
WARNING: Bond/angle/dihedral extent > half of periodic box length (…/domain.cpp:903)

One possible explanation for the second warning is the size of your
simulation box is too small. (…or one of your bonds is extremely
long, but that seems less likely.)
I suppose it’s possible that this -might- also cause the other warning
(inconsistent image flags).

The best way to tell what is going on is to look at your new data file.
Have you tried visualizing your system?
There are some instructions for doing that using VMD below
https://github.com/jewettaij/moltemplate/blob/master/examples/all_atom/force_field_OPLSAA/ethylene%2Bbenzene/README_visualize.txt
Specific instructions for displaying the boundary box and the periodic
images are in part 4) near the bottom of that file.

If there is a problem with your simulation box, you can edit the
header portion of the DATA file manually using a text editor. The
format of a data file is explained here:
https://lammps.sandia.gov/doc/2001/data_format.html
If you don’t want to manually edit the file, you can load it and then
change the boundary box using the “change_box” command:
https://lammps.sandia.gov/doc/change_box.html

I don’t know if this will help.
Sorry, I was too lazy to read your input files carefully.
(Incidentally, please don’t attach files in .RAR format. ZIP or
TAR.GZ format are preferred.)

Cheers
Andrew

lowereq.jpg

total.jpg

uppereq.jpg

please note, that you are creating those "inconsistent image flags"
yourself with the command "set atom * image 0 0 0".
this is only safe to use for atomic systems, but yours is molecular.
this is how you create bonds reaching across the box. LAMMPS can still
run such simulations, but as soon as you will use the change_box
(which is implied when adding a second data file with a different box
size) or replicate command, you will have a broken/invalid topology.

merging of systems that were pre-equilibrated with periodic boundary
conditions from inside LAMMPS is complicated and can fail easily since
LAMMPS doesn't have an option to wrap/translate all atoms inside the
same molecule in the same way. i've done this a few times in the past,
but i don't remember all the details, but that i went back and forth
between LAMMPS and VMD to make sure the final data files used for
merging have consistent and suitable image flags through adjusting the
box in VMD, not LAMMPS, since VMD stores absolute coordinates
internally and can do per-molecule wrapping of atoms. that way there
are no image flag issues with adjusting the box for molecular systems
with PBC.

axel.

please note, that you are creating those “inconsistent image flags”
yourself with the command “set atom * image 0 0 0”.
this is only safe to use for atomic systems, but yours is molecular.
this is how you create bonds reaching across the box. LAMMPS can still
run such simulations, but as soon as you will use the change_box
(which is implied when adding a second data file with a different box
size) or replicate command, you will have a broken/invalid topology.

merging of systems that were pre-equilibrated with periodic boundary
conditions from inside LAMMPS is complicated and can fail easily since
LAMMPS doesn’t have an option to wrap/translate all atoms inside the
same molecule in the same way. i’ve done this a few times in the past,
but i don’t remember all the details, but that i went back and forth
between LAMMPS and VMD to make sure the final data files used for
merging have consistent and suitable image flags through adjusting the
box in VMD, not LAMMPS, since VMD stores absolute coordinates
internally and can do per-molecule wrapping of atoms. that way there
are no image flag issues with adjusting the box for molecular systems
with PBC.

Thanks Axel for replying.

Unfortunately, I can’t think of anything else which is very useful to add to Axel’s reply. Perhaps just a few minor details…

-First data file (lowereq.data) was loaded in the simulation.
Although inconsistent image flags warning is received again, but the simulation proceed normally.

From your description, fundamentally, it sounds like the problem is in the (first) data file itself.
(The problem has little to do with combining the data files.)
You will have to repair this file, or (better yet) generate it again from scratch using the software you originally used.

If the bonds are being split by the periodic boundaries, then as Axel said, you will have to “unwrap” each of these molecules. Using “unwrapped” coordinates means that atoms in the same molecule will be placed nearby, even if this places them on opposite sides of a periodic boundary. Usually, the center-of-mass of each molecule will lie in the same periodic image (cell), However individual atoms may in different images (different cells), in order to minimize the lengths of the bonds connecting them to the other atoms in the molecule.

It’s always better to begin a LAMMPS simulation using unwrapped coordinates.

---- vmd ----
As Axel said, VMD has useful commands for fixing this problem. See the pbctools documentation.

I’m not sure this is helpful, but I’ve been using this command to “unwrap” the coordinates of atoms in molecules.
pbc wrap -compound res -all

(usage_example)
That commands works fine when you use it to view a trajectory file (a “dump” file containing molecule ID numbers) of a LAMMPS simulation which was begun using an undamaged DATA file. However I’m not sure if it will work when you load a previously damaged DATA file (with wrapped atom coordinates). If not, there are probably other commands in VMD which will work (study the pbctools documentation).

---- pizza.py -----

Alternatively if pbctools fails, you can try using pizza.py’s dump tool. I don’t know if this will work. To use it, I suppose you will have to create a DUMP file. To do that, load the DATA file in lammps, create a dump file (using the dump command with the following keywords: (dump 1 all custom 0 traj.lammpstrj id mol type x y z ix iy iz), run for 0 timesteps (run 0).

Then load the dump file (“traj.lammpstrj”) in pizza.py and use the “unwrap()” function. Again, I’ve never tried this, so I don’t know if it will work.
https://pizza.sandia.gov/doc/dump.html

Failing that, if you have to write your own script to unwrap the atom coordinates, it should not be that difficult.

Welcome to running MD simulations.
Good luck.

Andrew

[...]

---- vmd ----
As Axel said, VMD has useful commands for fixing this problem. See the pbctools documentation.

I'm not sure this is helpful, but I've been using this command to "unwrap" the coordinates of atoms in molecules.
pbc wrap -compound res -all
(usage_example)

that does not *unwrap*, but *wrap*. but with keeping "residues"
intact. a better choice would be -compound fragment as residue ids
(actually molecule ids) are arbitrary in LAMMPS.
to reconstruct molecules joined by bonds, you would be using "pbc
join". there is a "pbc unwrap", too, which will unwrap a trajectory by
comparing adjacent frames and undoing jumps due to atoms being
replaced by their periodic replica when passing through a box boundary
with PBC and wrapping active.

That commands works fine when you use it to view a trajectory file (a "dump" file containing molecule ID numbers) of a LAMMPS simulation which was begun using an undamaged DATA file. However I'm not sure if it will work when you load a previously damaged DATA file (with wrapped atom coordinates). If not, there are probably other commands in VMD which will work (study the pbctools documentation).

pbc join might help, but it is not a magic tool that can compensate
for any issue. it has limitations, too. sometimes things require
explicit scripting to be fixed in VMD.

axel.