Dear lammps-users,
I am new to the community and not sure if this question has been asked before. Could someone please tell me how to invoke two neighbor lists (one full, another half) in the same compute, or point me to the place where this issue was previously discussed and solved?
Thank you very much,
Manas
Dear lammps-users,
I am new to the community and not sure if this question has been asked
before. Could someone please tell me how to invoke two neighbor lists (one
full, another half) in the same compute, or point me to the place where this
issue was previously discussed and solved?
just create two NeighRequest instances and change the settings accordingly.
but it is usually simpler to only request a full neighbor list and
then skip half the pairs for the case of requiring a half neighbor
list as a lot of the manybody potentials do it when they compute the
pairwise additive part of the forces. this is done with a code segment
like this:
// loop over full neighbor list of my atoms
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
itag = tag[i];
itype = map[type[i]];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
// two-body interactions, skip half of them
jlist = firstneigh[i];
jnum = numneigh[i];
for (jj = 0; jj < jnum; jj++) {
j = jlist[jj];
j &= NEIGHMASK;
jtag = tag[j];
if (itag > jtag) {
if ((itag+jtag) 2 == 0\) continue;
\} else if \(itag < jtag\) \{
if \(\(itag\+jtag\) 2 == 1) continue;
} else {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp && x[j][1] < ytmp) continue;
if (x[j][2] == ztmp && x[j][1] == ytmp && x[j][0] < xtmp) continue;
}
...
Thanks for your reply Axel. There is a complication with using the full neighbor list. I am trying to add a modification to the pair_eam.cpp file. The original computation of the interaction forces makes use of only the half neighbor list (this is already invoked). But I am trying to store the two body interaction forces for all the atoms. To do this I need a full neighbor list. My first attempt was to change the neighbor request parameters in the PairEAM::init_style() such that the full neighbor list would be used everywhere.
void PairEAM::init_style()
{
// convert read-in file(s) to arrays and spline them
file2array();
array2spline();
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->pair = 0;
neighbor->requests[irequest]->compute = 1;
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->requests[irequest]->occasional = 1;
}
I got the following error message:
ERROR: Illegal pair_modify command (../pair.cpp:129)
At that point I reverted back to the original half list. It doesn't make sense to start modifying what seems to be a major part of the code. That is why I was wondering if it would be possible to invoke both half and full lists simultaneously so that I can leave the original components of pairEAM::compute unscathed.
Thanks,
Manas
Thanks for your reply Axel. There is a complication with using the full neighbor list. I am trying to add a modification to the pair_eam.cpp file. The original
rule #1 when hacking LAMMPS to add a modified interaction: *never*
modify the original file. always create a new style. if you only want
to modify some parts, you can just create a derived class and only
replace the methods that you need to change. this way you always have
the original as a reference.
second rule. to avoid confusion, please be precise in your
nomenclature. you are asking about the "compute method of a pair
style", but your question read like you would be implementing a
"compute style". these are two totally different entities in LAMMPS,
and to avoid being given bad advice, you should make an effort to be
specific and to the point in your description and questions.
computation of the interaction forces makes use of only the half neighbor list (this is already invoked). But I am trying to store the two body interaction forces for all the atoms. To do this I need a full neighbor list. My first attempt was to change the neighbor request parameters in the PairEAM::init_style() such that the full neighbor list would be used everywhere.
i don't see the connection. why do you need a full neighbor list to
get the two body interactions? just leave out or subtract the
embedding term. and you have it. have a closer look at the source code
and the flow of control. when using a full neighbor list, you just
artificially double the computational effort without gaining anything.
void PairEAM::init_style()
{
// convert read-in file(s) to arrays and spline them
file2array();
array2spline();
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->pair = 0;
neighbor->requests[irequest]->compute = 1;
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->full = 1;
neighbor->requests[irequest]->occasional = 1;
requesting an occasional neighbor list for a pair style is wrong.
}
I got the following error message:
ERROR: Illegal pair_modify command (../pair.cpp:129)
this error message has nothing to do with the change in the neighbor
list request.
axel.