A possible bug in fix gcmc

Dear lammps developers and users:

I did a test of fix-nvt combined with fix-gcmc on single-atom molecule system.

An error message always came out as below, no matter the version of (Aug-10, 2015) or (Nov-20, 2015):

“Fix gcmc cannot exchange individual atoms belonging to a molecule”

But my data file looks correct. Then I checked the code, it says

if ((mode == ATOM) && atom->molecule_flag) {
tagint *molecule = atom->molecule;
int flag = 0;
for (int i = 0; i < atom->nlocal; i++)
if (type[i] == ngcmc_type)
if (molecule[i]) flag = 1;
int flagall;
MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world);
if (flagall && comm->me == 0)
error->all(FLERR,
“Fix gcmc cannot exchange individual atoms belonging to a molecule”);
}

According to my understanding, it is because the molecule tag is “true” or non-zero.

So I chaged the value of the second colum of atom section in the data file to “0” (see below), and find that now the simulation runs well.

211 0 1 0.0000000000000000e+00 3.1898532923322918e+01 3.6188228234423754e+01 3.3377194938172757e+01 0 0 0
1059 0 1 0.0000000000000000e+00 3.3361777098795386e+01 3.2875578953413743e+01 3.2801519184811710e+01 0 1 0
928 0 1 0.0000000000000000e+00 3.7673275109041505e+01 3.3226375209204406e+01 3.3208391721964787e+01 0 0 0
930 0 1 0.0000000000000000e+00 3.5011966086107911e+01 3.2972938183063803e+01 3.5870208427942686e+01 0 1 0
874 0 1 0.0000000000000000e+00 3.6152930713186159e+01 3.6293443198065887e+01 3.4903137850748237e+01 0 0 0
92 0 1 0.0000000000000000e+00 4.1562926996148384e+01 3.2629795108606565e+01 3.6636654710633891e+01 0 0 1
1158 0 1 0.0000000000000000e+00 4.1160303561764223e+01 3.7522344520690012e+01 3.0956540535588903e+01 0 0 1
1658 0 1 0.0000000000000000e+00 4.0132653419084605e+01 3.5734175228386931e+01 3.3746790623521960e+01 0 0 0
1655 0 1 0.0000000000000000e+00 4.1573790152234977e+01 3.0982433671822175e+01 3.2517332510837932e+01 0 0 0

I am not sure whether it is a bug or not.

Yongbiao

Dear lammps developers and users:

    I did a test of fix-nvt combined with fix-gcmc on single-atom molecule
system.
An error message always came out as below, no matter the version of (Aug-10,
2015) or (Nov-20, 2015):

"Fix gcmc cannot exchange individual atoms belonging to a molecule"

But my data file looks correct. Then I checked the code, it says

  if ((mode == ATOM) && atom->molecule_flag) {
    tagint *molecule = atom->molecule;
    int flag = 0;
    for (int i = 0; i < atom->nlocal; i++)
      if (type[i] == ngcmc_type)
        if (molecule[i]) flag = 1;
    int flagall;
    MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world);
    if (flagall && comm->me == 0)
      error->all(FLERR,
       "Fix gcmc cannot exchange individual atoms belonging to a molecule");
  }

According to my understanding, it is because the molecule tag is "true" or
non-zero.
So I chaged the value of the second colum of atom section in the data file
to "0" (see below), and find that now the simulation runs well.

211 0 1 0.0000000000000000e+00 3.1898532923322918e+01 3.6188228234423754e+01
3.3377194938172757e+01 0 0 0
1059 0 1 0.0000000000000000e+00 3.3361777098795386e+01
3.2875578953413743e+01 3.2801519184811710e+01 0 1 0
928 0 1 0.0000000000000000e+00 3.7673275109041505e+01 3.3226375209204406e+01
3.3208391721964787e+01 0 0 0
930 0 1 0.0000000000000000e+00 3.5011966086107911e+01 3.2972938183063803e+01
3.5870208427942686e+01 0 1 0
874 0 1 0.0000000000000000e+00 3.6152930713186159e+01 3.6293443198065887e+01
3.4903137850748237e+01 0 0 0
92 0 1 0.0000000000000000e+00 4.1562926996148384e+01 3.2629795108606565e+01
3.6636654710633891e+01 0 0 1
1158 0 1 0.0000000000000000e+00 4.1160303561764223e+01
3.7522344520690012e+01 3.0956540535588903e+01 0 0 1
1658 0 1 0.0000000000000000e+00 4.0132653419084605e+01
3.5734175228386931e+01 3.3746790623521960e+01 0 0 0
1655 0 1 0.0000000000000000e+00 4.1573790152234977e+01
3.0982433671822175e+01 3.2517332510837932e+01 0 0 0

I am not sure whether it is a bug or not.

it is not. this is documented behavior and also the usual convention,
i.e. atoms that do not belong to a molecule are supposed to be
assigned the molecule id 0.

axel.

There is no simple way to determine whether an atom is bonded to any
other. An expedient proxy for this is checking whether the atom has
been assigned a non-zero molecule ID, something that is controlled by
the user. The user may choose to do this for atoms that are not
actually bonded to anything e.g. for purposes of tracking membership
in a group, or the data file may just happen to contain non-zero
molecule IDs. Since the second case is purely accidental, and the
first one will be broken by fix gcmc, I do not see any problem with
prohibiting them. Hence a feature, not a bug.

Dear Axel and Aidan,

According to my understanding, “single-atom molecule” is also a “molecule”, so I thought single-atom molecule should also be sign a non-zero molecule ID. Actually, this is done by “packmol” which I use to create my initial configuration.

Thanks a lot.

Best,

Yongbiao

Dear Axel and Aidan,

    According to my understanding, "single-atom molecule" is also a
"molecule", so I thought single-atom molecule should also be sign a non-zero
molecule ID. Actually, this is done by "packmol" which I use to create my
initial configuration.

LAMMPS is a computer program and thus there is no point in arguing
over semantics.

what counts is what is in the code and the assumed conventions as
described in the documentation. as i wrote before, the fix gcmc
documentation *states* that it will assume that atoms with a non-zero
molecule id have bonds and thus cannot be exchanged in atom mode.

axel.