[lammps-users] periodic boundary conditions

Dear LAMMPS users,

I would like to know how periodic boundary conditions are applied in pairwise interactions and neighbor list building.

For instance, in pair_lj_cut.cpp, I see that the difference in positions between atoms i and j is computed by delx, dely and delz which are basically (x[i][0] - x[j][0]), etc. The same is in neigh_full.cpp.

By the way, why the position of i is saved into xtmp, ytmp and ztmp before calculating the distance?

Thanks,

-Trung

PBC distances are added to ghost atoms when they are communicated,
so PBCs don't need to be handled in the pair or neighbor routines.

xtmp,ytmp,ztmp are simply temporary storage to avoid array lookups.

Steve