fix with per atom attribute

Dear LAMMPS users,

1) Struggling with the following problem - I want to introduce a new
per atom attribute in my fix, this attribute might be the same for
some atoms so I can find a correspondence between some special atoms.
I also should mention that during my simulation atoms are added and
Thus, in my fix I implemented necessary methods:

//in constructor
  create_attribute = 1;

Added methods:
void grow_arrays(int nmax) { myArray.resize(nmax, 0); } // myArray is
void copy_arrays(int i, int j, int delflag) {myArray[j] = myArray[i];}
void set_arrays(int indexOfCreatedAtom) { myArray[i] = 0; }

And it works for a while, than for some reason my mapping becomes
invalid. It means that the one of the atoms has wrong attribute (it
should have another). it is difficult to track back where it happens
because of sorting. So it happens only if sorting is on (I tried turn
it off using atom_modify) and on more than one processors (for one it
I wonder - did I miss something? Shall I implement also some other
methods (for sending info to other processors or something)?

2) Another question - are bond indices sort invariant? I mean if I
read a bond with index K, does it mean that it will be K in bondlist
all the execution time? As far as I see it is created only once in
Neighbor::bond_all and never rewritten.

I don’t see (un)pack_exchange() in your list of methods.
Without those, the atom property won’t get carried
along when the atom migrates. You can look at

fix store/state for all the methods it adds to support
a stored atom “property” (in this case the stored state).

You can also look at fix property/atom which is an input
script command which can be used to define a property

you want to “add” to atoms.

There is also a fix store that is an “internal” fix that

other computes invoke to store per-atom data. I suppose
your fix could as well, though some thought would have
to be given if a fix was going to invoke another fix.


Thank you Steve,
The part of the problem was pack/unpack.