Dear lammps users,

I had some questions on neighbor list and periodic boundary condition when I tried to understand the source code of pair_lj_cut.cpp. I really appreciate your help.

(1) With 3D periodic boundary condition and a simple cubic lattice system, I checked jnum for each particle i and found that every particle had different number of neighbors. I guess if particle j is in particle i's neighbor list, then i will not be in j's list. Is it right? Can someone explain a bit that ideally how the neighbor list is constructed?

(2) In pair_lj_cut.cpp, the relative distance between i and j (if they are neighbors) is calculated as

xtmp = x[i][0];

ytmp = x[i][1];

ztmp = x[i][2];

delx = xtmp-x[j][0];

dely = ytmp-x[j][1];

delz = ztmp-x[j][2];

rsq = delx*delx + dely*dely + delz*delz;

and there is no nearest periodic boundary image correction, why?

I was using lammps 22Jan08 release and the input and data files are attached. Thanks,

-Peng

data.lj (17.8 KB)

in.lj (542 Bytes)

Dear lammps users,

dear peng,

I had some questions on neighbor list and periodic boundary condition when I

tried to understand the source code of pair_lj_cut.cpp. I really appreciate

your help.

(1) With 3D periodic boundary condition and a simple cubic lattice system, I

checked jnum for each particle i and found that every particle had different

number of neighbors. I guess if particle j is in particle i's neighbor

list, then i will not be in j's list. Is it right? Can someone explain a

bit that ideally how the neighbor list is constructed?

(2) In pair_lj_cut.cpp, the relative distance between i and j (if they are

neighbors) is calculated as

xtmp = x[i][0];

ytmp = x[i][1];

ztmp = x[i][2];

delx = xtmp-x[j][0];

dely = ytmp-x[j][1];

delz = ztmp-x[j][2];

rsq = delx*delx + dely*dely + delz*delz;

and there is no nearest periodic boundary image correction, why?

because of the way lammps does domain decomposition and neighbor lists.

the details are in the lammps papers and talks that you can find on the

web and in published literature.

the following is a simplified description:

each node "owns" a set of atoms and then also maintains and

additional "skin" of "ghost" atoms. those are the periodic images

or the neighbors from neighboring domains up to the a distance

that includes the larges cutoff and a safety margin (skin).

so in the nonbonded innerloops you don't have to worry about PBC.

cheers,

axel.

Thanks Axel!

So if particle i and j are neighbors, are they (or their periodic image) in eath other's neighbor list? I was suspecting that if i in j's neighborlist then j will NOT be in i's neighbor list.

-Peng

If the newton pair flag is on, the i-j pair appears only once (in

either i or j list). If it is off, then the answer is the same

unless i and j are on differernt procs, in which case the pair

appears twice.

Steve