retagging particles in verlet run

Dear LAMMPS users,

I’m adding/deleting particles in my fix and after doing it call the following code which I got from delete_atoms:

bigint nblocal = atom->nlocal;

MPI_Allreduce(&nblocal, &atom->natoms, 1, MPI_LMP_BIGINT, MPI_SUM, world);

if (atom->map_style) {

atom->nghost = 0;

atom->map_init();

atom->map_set();

}

Depending on the place this code is called I have different errors. if I put this code in post_force, I got the error when LAMMPS is checking that the simulation was valid it founds out some :

Bond atom missing in box size check (…/domain.cpp:642)

If I call it in post_integrate, surprisingly, I have a different error - wrong mapping when neighbor->build(); is called in verlet.cpp:

Bond atoms 1972 1727 missing on proc 1 at step 316 (…/neigh_bond.cpp:55)

This error happens only if I run the application on several cores, when a molecule is between processors.

Do you know possible ways to fix this problem? In the first case, I think it is because tags were changed but neighbor information hasn’t been renewed. Can I do it somehow in post_run or in other method which is called before domain checks?

Dear LAMMPS users,

I'm adding/deleting particles in my fix and after doing it call the
following code which I got from delete_atoms:

  bigint nblocal = atom->nlocal;

  MPI_Allreduce(&nblocal, &atom->natoms, 1, MPI_LMP_BIGINT, MPI_SUM, world);

  if (atom->map_style) {

    atom->nghost = 0;

    atom->map_init();

    atom->map_set();

  }

Depending on the place this code is called I have different errors. if I put
this code in post_force, I got the error when LAMMPS is checking that the
simulation was valid it founds out some :

Bond atom missing in box size check (../domain.cpp:642)

If I call it in post_integrate, surprisingly, I have a different error -
wrong mapping when neighbor->build(); is called in verlet.cpp:

Bond atoms 1972 1727 missing on proc 1 at step 316 (../neigh_bond.cpp:55)

This error happens only if I run the application on several cores, when a
molecule is between processors.

Do you know possible ways to fix this problem? In the first case, I think it
is because tags were changed but neighbor information hasn't been renewed.
Can I do it somehow in post_run or in other method which is called before
domain checks?

please have a look at fix gcmc. it runs at the pre-exchange phase of
an MD step and does similar things.

axel.