Dear LAMMPS community!

I've been developing a compute that calculates a peratom array and

reuses some of the quantities to calculate a global scalar if requested

in the input script. To do so I implemented a compute_peratom() method

as well as a compute_scalar() method, where the latter calls the former

in order to have up-to-date data available.

However, recently I ran into trouble with this approach when using

neighbor lists within the compute (they contained indices that were

larger than nlocal+nghost when the compute_peratom method was called

from the compute_scalar method). So I have a couple of questions:

-) Firstly, this kind of use, combining a scalar and a peratom quantity

is not done in any of the computes that come with LAMMPS (at least I

couldn't find one), which leads me to believe, that this was not

actually the intended use. Should one strictly separate per-atom and

global computes?

-) Is there some sort of guarantee, that compute_peratom is called

before compute_scalar? It does work in the examples I have tried,

however, I am not sure this is true in general.

-) I use the neighborlist in pretty much the same way, it is used in

other computes that calculate peratom values. Is there a different way

to use them from the compute_scalar() method?

I can also provide a minimal example of the issue with the neighbor

lists mentioned above, if that is of any help.

Thank you for your help!

Best regards,

Clemens Moritz