Question on: "delete_atoms" with "fix shake"

Dear lammps users:

You should delete_atoms before using fix shake,
at least conceptually. Can you post a simple
small data file and input script which reads in
some waters and deletes them but does not
delete entire water molecules? I presume
your input has entire water molecules with
the same molecule ID? If not, then delete_atoms
will probably not work as advertised.



As you suggested,

I set up a small water file and simple script file to test the behavior of the “delete_atoms” command.

Enclosed is the script file “test_delete_atoms.lmp” and a 10 spc/e water molecules data file

To artificially create closeness of molecules,
inside the water data file, I simply shifted molecule 7 coordinates by 0.2 to get molecule 8 coordinates)

test_delete_atoms.lmp (1.06 KB) (4.11 KB)

However, I noticed that delete_atoms with " mol yes" does not seem to remove the whole molecule.

The 30Apr patch allows the mol yes option to be used
with all the delete_atoms styles. So your script no
longer deletes only partial molecules.


Thank you for the detailed explanations.

I will experiment further with the updated/patch lammps version.

Hi Steve, Shankar,

Have you used the improved delete_atoms command with dihedrals?

I have used the delete_atoms command with both the overlap and mol options:
delete_atoms overlap 1.0 groupA groupB mol yes

and have run into two problems with the code. The first is that I get an error:
ERROR on proc 4: Dihedral atoms 86508 112741 112742 112743 missing on proc 4 at step 0 (…/neigh_bond.cpp:540)

when I run across multiple processors. I can avoid this issue by using a single processor.

Unfortunately, the second issue is that when I run a single processor job I find that atoms, bonds and angles have been deleted and updated properly, but dihedrals have not. In fact, there are fewer dihedrals than in the original configuration as expected, but if I write a data file using the write_data command the number of dihedrals listed in the header hasn’t changed. This leads to an unexpected end of data file error upon reading the new datafile. This would suggest that the dihedrals are properly deleted but the count is not updated. If the count is manually changed to reflect the actual number of dihedrals remaining after the delete_atoms command then the data file is still unusable as lammps complains of dihedral atoms missing (also true for a restart file).

I am using lammps version 9May14 and can probably come up with a stripped down input and data file if needed for debugging. I think this is a great feature, btw.


yes, if you can provide a simple input script/data file
that produces the problem, that would be great


Apologies All,
I had a typo in my datafile that was propagated forward and created the missing dihedral error. I am still consistently seeing a miscount of dihedrals in the header of the lammps data file from the “write_data” command after using the “delete_atoms” command, but this is a minor problem since the actual dihedrals listed are correct and starting from a restart file works.


Mike - can you post a simple example of the remaining
problem with the miscount of dihedrals?


Hi Steve,

I apologize for letting this slip. I was so pleased that I found my mistake I just went ahead and used the command. This input script and datafile should illustrate my problem. After deleting one of the molecules the restart file can be used, but the data file gives the unexpected end of file error, I think because it’s looking for twice as many dihedrals. I also seem to get an incorrect # of dihedrals for other variations of the command (not just overlap, but group too). I’ve been using 9-May-14 to test this.

Hope this is helpful.

Mike (7.85 KB) (795 Bytes)

I think I fixed it - will be in next patch.

thanks for the example script,