atom indices validity after reading restart

Dear LAMMPS users,

1) I wrote a fix that writes to the restart file some additional
information about atoms - mapping between pair of atoms. I need to
save this information to restart file. It can be done by local indices
or tags (I suppose this is the correct option). Is it guaranteed that
after reading tags from the restart file they will be the same as tags
in LAMMPS (or they will be regenerated by LAMMPS after reading)? So
after reading tags from the restart I could use map() and get a valid
local index.

2) In addition, is there an extension that adds global indices to
lammps different than tags? I'm facing with some complications with
using tags because I delete atoms on the fly and, hence, have to
reassign tags after the deletion:

void FixDeleteAtoms::deletePostProcessing(int nlocal)
{
  atom->nlocal = nlocal;

  if (atom->molecular == 0) {
    int *tag = atom->tag;

    for (int i = 0; i < nlocal; ++i) tag[i] = 0;
    atom->tag_extend();
  }

  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();
  }
}

Dear LAMMPS users,

  1. I wrote a fix that writes to the restart file some additional
    information about atoms - mapping between pair of atoms. I need to
    save this information to restart file. It can be done by local indices
    or tags (I suppose this is the correct option). Is it guaranteed that
    after reading tags from the restart file they will be the same as tags
    in LAMMPS (or they will be regenerated by LAMMPS after reading)? So
    after reading tags from the restart I could use map() and get a valid
    local index.

Yes.

  1. In addition, is there an extension that adds global indices to
    lammps different than tags?

You could use molecule id. This an arbitrary tag.

Axel.