Dear Lammps-users,
Sort of a naive question but I would appreciate some advice on how to
split a local neighbor list into an inner list and an outer list.
For example, the Short_neigh() subroutine uses the approach:
for (jj = 0; jj < jnum; jj++) {
....
neighptrj = &pages[npage][npntj];
....
if (rsq > cutmin) continue;
neighptrj[nj++] = j;
}
sht_first[i] = neighptrj;
sht_num[i] = nj;
npntj += nj;
I would like to do something where I can split this into two:
for (jj = 0; jj < jnum; jj++) {
....
neighptrj = &pages[npage][npntj];
.....
if (rsq > outer) continue;
if (rsq < inner) neighptrj[nj++] = j;
else neighptr2[nj2++] = j;
}
sht_inner[i] = neighptrj;
sht_innernum[i] = nj;
sht_outer[i] = neighptrj2;
sht_outernum[i] = nj2;
npntj += nj;
npntj2 += nj2;
Unfortunately I am getting segmentation faults, and I am not sure what to
do about neighptrj. Does it make sense to do:
neighptrj = &pages[npage][npntj];
neighptrj2 = &pages[npage][npntj2];
Thanks for the help!!
John
Dear Lammps-users,
Sort of a naive question but I would appreciate some advice on how to
split a local neighbor list into an inner list and an outer list.
have a look at the assembly of the r-RESPA neighbor lists
in src/neigh_respa.cpp they construct three regions.
For example, the Short_neigh() subroutine uses the approach:
for (jj = 0; jj < jnum; jj++) {
....
neighptrj = &pages[npage][npntj];
....
if (rsq > cutmin) continue;
neighptrj[nj++] = j;
}
sht_first[i] = neighptrj;
sht_num[i] = nj;
npntj += nj;
I would like to do something where I can split this into two:
for (jj = 0; jj < jnum; jj++) {
....
neighptrj = &pages[npage][npntj];
.....
if (rsq > outer) continue;
if (rsq < inner) neighptrj[nj++] = j;
else neighptr2[nj2++] = j;
}
sht_inner[i] = neighptrj;
sht_innernum[i] = nj;
sht_outer[i] = neighptrj2;
sht_outernum[i] = nj2;
npntj += nj;
npntj2 += nj2;
Unfortunately I am getting segmentation faults, and I am not sure what to
of course. if you are messing with "pointer magic"
without knowing what you are doing. think of "the
sourcerer's apprentice" and let it be a warning.
do about neighptrj. Does it make sense to do:
neighptrj = &pages[npage][npntj];
neighptrj2 = &pages[npage][npntj2];
NOOO. you cannot build two neighbor lists
off the same storage. that will create a mess
and get you into segfault hell.
axel.