[lammps-users] question about the fixes with end_of_step() option

Hi,

I have a question with regard to fixes that store atom information from time to time, like fix_ave_atom.cpp or fix_store_state.cpp, etc,
It is unclear to me how the allocation of the memory is managed for the array if an atom is being cummunicated between neighboring processors.
It seems to me that the allocation of this array is done only once at the constructor of these fixes with a number of row that correctly considers the number of the local + ghost atoms. (atom->nmax)

But what happend if say that during the runs the nmax = nlocal+nghost becomes bigger than the initial one? Don't you run in memory issues.
It seems to me that there is no check if this condition applyes in the end_of_step() function which could than call the grow_array(nmax).

Best,

Tomorr

Hi,

I have a question with regard to fixes that store atom information from time to time, like fix_ave_atom.cpp or fix_store_state.cpp, etc,
It is unclear to me how the allocation of the memory is managed for the array if an atom is being cummunicated between neighboring processors.
It seems to me that the allocation of this array is done only once at the constructor of these fixes with a number of row that correctly considers the number of the local + ghost atoms. (atom->nmax)

But what happend if say that during the runs the nmax = nlocal+nghost becomes bigger than the initial one? Don't you run in memory issues.
It seems to me that there is no check if this condition applyes in the end_of_step() function which could than call the grow_array(nmax).

you have to look a little closer at the code. the call to grow the arrays
is not initiated by the fix itself, but rather by the respective atom style.
note those two "innocent" calls. they register the fix that you are in
to have its grow_array method being call whenever the atom data is
grown:

  atom->add_callback(0);

or when a restart is read in:

  atom->add_callback(1);

cheers,
    axel.