# pairwise forces loops!!

Dear Axel,
I have a question about the pairwise coulombic interactions. I see that loops (e.g. in the pair_lj_cut_coul_long.cpp) are written as:

for(ii=0 ; ii<inum; ii++) //iunm is the number of particles
i=ilist[ii];

qtmp=q[i];
xtmp=x[i][0];

jlist= firstneigh[i]
junm=numneigh[i]
for (jj=0; jj <jnum ; j++)
j=jlist[jj];
//calculate the force between i & j of they are in the cuttoff
I am confused about these ilist & jlist things, would you mind kindly give me a hint about these? I thought the loops should be around all particles, and force be calculated for those existed in the cuttoff

simply as
for(ii=0 ; ii<inum; ii++)

qtmp=q[ii];
xtmp=x[ii][0];

for (jj=0; jj <jnum ; j++)
//calculate f btw ii & jj (considering 1/2 factor due to twice pair calculations

Thanks
Arshia
.

Dear Axel,
I have a question about the pairwise coulombic interactions. I see that
loops (e.g. in the pair_lj_cut_coul_long.cpp) are written as:

for(ii=0 ; ii<inum; ii++) //iunm is the number of particles
i=ilist[ii];
qtmp=q[i];
xtmp=x[i][0];
......
jlist= firstneigh[i]
junm=numneigh[i]
for (jj=0; jj <jnum ; j++)
j=jlist[jj];
//calculate the force between i & j of they are in the
cuttoff
I am confused about these ilist & jlist things, would you mind kindly give
me a hint about these? I thought the loops should be around all particles,
and force be calculated for those existed in the cuttoff

they are about all particles within the cutoff.
have you ever heard of neighbor lists or verlet lists?
if not, i highly recommend to read up on those.

axel.

oh, and if you want to figure it out "the hard way", you
can have a look at the toy MD code for LJ only.
you can check out the code and the lecture posted here: