# neighbor list

Hi!

I found the default neighbor list to calculate the pair forces is half neighbor list. Here, j >i, so a pair appears once. I want to calculate force for a single particle, not all particles, hence looking for the full neighbor list where the pair (i,j) appears twice. I attempted to use listfull instead of list while calling neighbor list in the pair potential code, pasted as below. But I get segmentation fault. So please let me know, how to call full neighborlist? Thanks.

Regards,

Moumita

ilist = listfull->ilist;
numneigh = listfull->numneigh;
firstneigh = listfull->firstneigh;

// loop over neighbors of my atom index ii
i = ilist[ii];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
itype = type[i];
jlist = firstneigh[i];
jnum = numneigh[i];

for (jj = 0; jj < jnum; jj++) {
j = jlist[jj];

You don’t give any context for what you are trying

to do or why, or whether it’s part of a new pair style

or a diagnostic. Many pair styles use full neighbor

lists, though maybe not for the same purpose

Steve

Dear Steve,

I perform minimization with a modified pair_style of repulsive harmonic potential. Here I need to calculate energy of all particles. During minimization, before each minimization step I have one more modification. A single particle is moved such that energy is maximized locally, where I need single particle energy. Hence I am looking for full neighbor list.

Please let me know which pair style uses full neighbor list and which uses half neighbor list, then I can follow them to understand the difference.

Regards,

Moumita

pair styles with full neighbor lists:

% grep “full = 1” pair*cpp
pair_airebo.cpp: neighbor->requests[irequest]->full = 1;
pair_bop.cpp: neighbor->requests[irequest]->full = 1;
pair_brownian_poly.cpp: neighbor->requests[irequest]->full = 1;
pair_comb.cpp: neighbor->requests[irequest]->full = 1;
pair_comb3.cpp: neighbor->requests[irequest]->full = 1;
pair_coul_streitz.cpp: neighbor->requests[irequest]->full = 1;
pair_hbond_dreiding_lj.cpp: neighbor->requests[irequest]->full = 1;
pair_hbond_dreiding_morse.cpp: neighbor->requests[irequest]->full = 1;
pair_lcbop.cpp: neighbor->requests[irequest]->full = 1;
pair_lubricateU_poly.cpp: neighbor->requests[irequest]->full = 1;
pair_lubricate_poly.cpp: neighbor->requests[irequest]->full = 1;
pair_nb3b_harmonic.cpp: neighbor->requests[irequest]->full = 1;
pair_polymorphic.cpp: neighbor->requests[irequest]->full = 1;
pair_snap.cpp: neighbor->requests[irequest]->full = 1;
pair_sw.cpp: neighbor->requests[irequest]->full = 1;
pair_tersoff.cpp: neighbor->requests[irequest]->full = 1;
pair_vashishta.cpp: neighbor->requests[irequest]->full = 1;

I’m not sure why you would need such a neighbor list to

get the energy of an atom. LAMMPS will do that

for you as a diagnostic, e.g. compute pe/atom.

Steve

Thanks Steve.

May be you are correct that I do not need such a neighbor list, but I need force(only for one particle) as well to compute gradient for maximization. I see you have compute stress/atom which can be modified to have force instead of stress. I will try.

Regards,

Moumita

Forces on atoms can be easily dumped by using the dump command (fx, fy, and fz).

Ray

Thanks! But I do not want to dump single particle forces. I need them inside the code for certain calculations. So, I have following problem:

I move only one particle and rest of it are fixed in their positions. Then, total energy can be written as e = e_R + e_S, e_S is the single particle energy, e_R is the energy from rest of the particles. So, only e_S changes when the single particle is moved, and I need also the single particle force during this change for maximization. So, I want to perform only single particle calculation to save time and I solved this now with full neighbor list in pair potential code.

It would be great if one can point out whether reneighboring is possible for only one particle if it crosses the skin distance. In principle it should be.

Regards,

Moumita

It would be great if one can point out whether reneighboring is possible for only one particle if it crosses the >skin distance. In principle it should be.

Nothing in LAMMPS does that (or needs it). It is also

not very parallel.

You can look at the Monte Carlo fixes like fix gcmc in the src/MC dir.

Maybe some variant of a single-particle MC move is what you are looking for.

Steve

Thanks! But I do not want to dump single particle forces. I need them
inside the code for certain calculations. So, I have following problem:

I move only one particle and rest of it are fixed in their positions.
Then, total energy can be written as e = e_R + e_S, e_S is the single
particle energy, e_R is the energy from rest of the particles. So, only e_S
changes when the single particle is moved, and I need also the single
particle force during this change for maximization. So, I want to perform

No quite right. Even though rest of the atoms are fixed, neighbors of the
moved single particle would have their energies changed as well - since the
distance changed. That means not only e_S changes, e_R would change as
well.

Is this fact going to change the way you wish to do with the neighbor list?

Ray

Thanks Steve.

You are right that it is not very parallel. Sometimes I have an advantage.

I have independent 0 to 1000 single particle moves calculation in each step depending on some probability value unlike single particle MC move. If I have same number of processors as the number of single moves, it is good case for parallelization.

I have a bad situation when the system size is large and only 1 or 0 single particle move is there in each step. I run this in parallel but with as low the number of processors as possible.

Regards,

Moumita