Issue with local & global atomic IDs

Dear LAMMPS developers,

I am having an issue with local and global atomic IDs. Specifically, I am trying to implement the following: for each local atom (atom->nlocal) to loop for all global atoms (atom->natoms). For each local and global atom I need position (atom->x) and type (atom->type). Is there a way to obtain the values of these two variables for the global atoms (since using atom->map() may return -1)? I am using lammps-7Aug19 with USER-REAXC.

Thank you very much for your help,
Efstratios

You cannot do this without severely impacting performance and parallel efficiently and doing extra communications.

LAMMPS’ principal parallelization is based on domain decomposition and that means, that by default no MPI rank holds the information about all atoms. This design and the effective communication patterns by combining all data that needs to be communicated between subdomains into a single buffer is what allows LAMMPS to scale to a very large number of MPI ranks and handle very large systems efficiently, i.e. have good strong and weak parallel scaling.

Thus each MPI rank holds (in the simplest case) only atoms that are local to the domain plus ghost atoms up to the communication cutoff (which is by default the largest pair cutoff plus the neighborlist bin size).

To have access to all atoms you would either have to allocate local arrays to collect the desired data for the entire system with collective MPI calls, or you have to extend the communication cutoff until the entire system (and then some) is included as ghost atoms. This will blow up your memory use and - as mentioned before - negatively impact your performance and parallel efficiency.

Axel.

Dear Axel,

Thank you very much for your quick and detailed response. I can see now the problem of my approach. May I ask one final question on the topic: whether you know if the communication cutoff, you mentioned, for reax/c is equal to the non-bonded interactions cutoff (i.e. 10 Ang) or larger.

Thank you again,
Efstratios

The value of the communication cutoff is printed at the beginning of a run. look for “ghost atom cutoff”, and you can increase it, if desired, using comm_modify.
axel.