Hello community, long time no speak!
Tested on LAMMPS (12 Jun 2025), but the same warning is issued with the current develop branch.
I am running a MD simulation with a type-I force field. The following code:
group g1 type 7 8
compute ac1 g1 chunk/atom molecule
compute msqdis1 all msd/chunk ac1
produces the following warning:
WARNING: One or more chunks do not contain all atoms in molecule (../compute_chunk_atom.cpp:1198)
which is triggered by the compute msd/chunk command. The warning is not issued if the command is replaced by compute com/chunk as in the following:
group g1 type 7 8
compute ac1 g1 chunk/atom molecule
compute mcom1 all com/chunk ac1
Drawing inspiration from this post, I changed the setup in compute_msd_chunk.cpp following the same logic of compute_com_chunk.cpp:
@@ -25,6 +25,7 @@
using namespace LAMMPS_NS;
+enum { ONCE, NFREQ, EVERY };
/* ---------------------------------------------------------------------- */
ComputeMSDChunk::ComputeMSDChunk(LAMMPS *lmp, int narg, char **arg) :
@@ -92,7 +93,7 @@
void ComputeMSDChunk::setup()
{
- if (!firstflag) return;
+ if (!firstflag || cchunk->idsflag != ONCE) return;
compute_array();
firstflag = 0;
The warning is gone, but I appreciate a second thought on this patch. Thanks!
Well, the key question here would be:
are there molecules that have atoms with other atom types than 7 or 8?
Since @sjplimp replied on the post you were referencing, it is probably best to contact him (as the main architect of the whole “chunk” infrastructure) for advice. There may be other computes that would need the same treatment, if it is correct.
1 Like
Yes there are, but these molecules should not be included. In reality the setup to define the groups is a bit more complex than how I reported it:
group water type 7 8
group unit molecule <= 360
group g1 intersect water unit
Let me prepare a small toy system to reproduce this error in a controlled setting.
If you do this, you could then submit it as a bug report issue on GitHub.
That makes it easier to get @sjplimp involved (who has significant time
constraints these days).
Or I could pass it to an AI coding agent and see what it comes up with to fix the issue.
1 Like
Bug report opened: [BUG] compute msd/chunk wrongly produces a warning message · Issue #5003 · lammps/lammps · GitHub
It seems that the order of molecules triggers the warning. Sample01 has a sequence of 120 (water-formamide) dimers, followed by more water molecules. The following commands produce the warning message:
group water type 6 7
group unit molecule <= 20
group g1 intersect water unit
compute ac1 g1 chunk/atom molecule
compute msqdis1 all msd/chunk ac1
Note that the group g1 is a subset of unit:
group water type 6 7
1575 atoms in group water
group unit molecule <= 20
90 atoms in group unit
group g1 intersect water unit
30 atoms in group g1
While the same selection applied to sample02 produces:
group water type 6 7
1215 atoms in group water
group unit molecule <= 20
60 atoms in group unit
group g1 intersect water unit
60 atoms in group g1
and no warning.
@hothello This looks like a bug report that is perfect for an AI coding agent to work on since it has sufficient context. We are currently exploring in a more systematic way, how we can utilize coding agents to take care of work (be it bugfixes, be it new features) for which we are lacking time or motivation. I am curious what will be the result.
After about 5 minutes it has found the same thing that you noticed but now it is digging deeper to understand what is going on.
Here is the result: Collected Small Changes and Fixes by akohlmey · Pull Request #5004 · lammps/lammps · GitHub
The warning was bogus. The required fix needs to be done in compute_chunk_atom.cpp.
1 Like
Very nice Axel, thank you so much!