Accessing neighbor's neighbor list in MPI multi-process runs

Dear LAMMPS users,

In MPI multi-process simulation, when I want to add a local density dependent term in force calculation,

F_ij = … + B_ij * (rho_i + rho_j) * wd(r_ij) e_ij

where rho_i = sigma_{j != i} wp(rho_ij) for r<rc

I may not be able to correctly calculate rho_j, since the neighbor particle j’s neighbors may not reside in the same partition with particle i.

So I assume LAMMPS by default does not guarantee the neighbor’s neighbor list accessible in MPI mode. I am wondering if such algorithm is possible to be implemented in LAMMPS? Please let me know if I can refer to any existing piece of code for dealing with this situation.

Thanks in advance for any comment!

Best regard,

Dear LAMMPS users,

In MPI multi-process simulation, when I want to add a local density
dependent term in force calculation,

F_ij = ... + B_ij * (rho_i + rho_j) * wd(r_ij) e_ij

where rho_i = sigma_{j != i} wp(rho_ij) for r<rc

I may not be able to correctly calculate rho_j, since the neighbor particle
j's neighbors may not reside in the same partition with particle i.

So I assume LAMMPS by default does not guarantee the neighbor's neighbor
list accessible in MPI mode. I am wondering if such algorithm is possible to
be implemented in LAMMPS? Please let me know if I can refer to any existing
piece of code for dealing with this situation.

it is already available and as far as i can tell used in the pair
styles airebo, bop, comb3, lcbop, reax/c, and snap.
if you read the respective code, you'll see, that you have to modify
the neighbor list request to set the ghost flag to 1 and also tell the
pair style through setting ghostneigt to 1 in the respective
constructor that you need the neighbors of ghosts.

axel.

Cool, thanks a lot for your prompt reply — I found those files in the MANYBODY folder. Will take a hard look at them.

One more minor question that is related:

I am not quite clear how atom->nmax is calculated, and its arithmetic relation to atom->nlocal and atom->nghost. Here I suppose a “p p p” system with predefined number of atoms.

Thanks,

One more minor question that is related:

I am not quite clear how atom->nmax is calculated, and its arithmetic
relation to atom->nlocal and atom->nghost. Here I suppose a "p p p" system
with predefined number of atoms.

atom->nmax is the largest value of atom->nlocal + atom->nghost that
has existed across all subdomains (i.e. MPI processes) during the
LAMMPS run so far. it can only grow, never shrinks.

axel.

FYI, variables like this are documented in the comments of the header
files where they are declared. so in atom.h you have:

  // atom counts

  bigint natoms; // total # of atoms in system, could be 0
                                // natoms may not be current if atoms lost
  int nlocal,nghost; // # of owned and ghost atoms on this proc
  int nmax; // max # of owned+ghost in arrays on this proc
  int tag_enable; // 0/1 if atom ID tags are defined
  int molecular; // 0 = atomic, 1 = standard molecular system,
                                // 2 = molecule template system

Your formula for density dependence looks a lot like EAM,

in which case you do not really need neighbors of ghost atoms.

Instead you should look at how pair_eam.cpp does communication

of quantities computed for atoms owned by other procs and stored by ghost atoms.

Steve

Thanks for the advice! I have been following the way done in pair_eam.cpp for calculating the local density for ghost atoms.

Best regard,