Hi,
I am confused about the different meaning of these two methods for force calculations. I thought they will get the same results, but the test show that when I use the first method, the system will explode under NPT ensemble during relax and the second way is good.
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
…
jlist = firstneigh[i];
jnum = numneigh[i];
for (jj = 0; jj < jnum; jj++) {
j = jlist[jj];
…
The first mehod is :
twobody(¶ms[ijparam],rsq,gfinal,fpair,eflag,evdwl,f2w);
f[i][0] += delxfpair;
f[i][1] += delyfpair;
f[i][2] += delz*fpair;
if (evflag) ev_tally_full(i,evdwl,0.0,fpair,delx,dely,delz);
}
}
And the other way is :
twobody(¶ms[ijparam],rsq,gfinal,fpair,eflag,evdwl,f2w);
fpair=fpair/2.0;
evdwl=evdwl/2.0;
f[i][0] += delxfpair;
f[i][1] += delyfpair;
f[i][2] += delzfpair;
f[j][0] -= delxfpair;
f[j][1] -= delyfpair;
f[j][2] -= delzfpair;
if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz);
Thanks.
Lisa