Commit c01fb5f7 authored by Steven J. Plimpton's avatar Steven J. Plimpton
Browse files

new loop structure in pair ATM

parent 44bda245
...@@ -98,6 +98,10 @@ void PairATM::compute(int eflag, int vflag) ...@@ -98,6 +98,10 @@ void PairATM::compute(int eflag, int vflag)
numneigh = list->numneigh; numneigh = list->numneigh;
firstneigh = list->firstneigh; firstneigh = list->firstneigh;
int count1 = 0;
int count2 = 0;
int count3 = 0;
for (ii = 0; ii < inum; ii++) { for (ii = 0; ii < inum; ii++) {
i = ilist[ii]; i = ilist[ii];
xi = x[i][0]; xi = x[i][0];
...@@ -108,7 +112,10 @@ void PairATM::compute(int eflag, int vflag) ...@@ -108,7 +112,10 @@ void PairATM::compute(int eflag, int vflag)
jnum = numneigh[i]; jnum = numneigh[i];
jnumm1 = jnum - 1; jnumm1 = jnum - 1;
for (jj = 0; jj < jnumm1; jj++) { // for (jj = 0; jj < jnumm1; jj++) {
// replace with this line:
for (jj = 0; jj < jnum; jj++) {
j = jlist[jj]; j = jlist[jj];
j &= NEIGHMASK; j &= NEIGHMASK;
rij[0] = x[j][0] - xi; rij[0] = x[j][0] - xi;
...@@ -118,9 +125,15 @@ void PairATM::compute(int eflag, int vflag) ...@@ -118,9 +125,15 @@ void PairATM::compute(int eflag, int vflag)
rij[2] = x[j][2] - zi; rij[2] = x[j][2] - zi;
if (rij[0] == 0.0 and rij[1] == 0.0 and rij[2] < 0.0) continue; if (rij[0] == 0.0 and rij[1] == 0.0 and rij[2] < 0.0) continue;
rij2 = rij[0]*rij[0] + rij[1]*rij[1] + rij[2]*rij[2]; rij2 = rij[0]*rij[0] + rij[1]*rij[1] + rij[2]*rij[2];
count1++;
if (rij2 > cutoff_squared) continue; if (rij2 > cutoff_squared) continue;
count2++;
//for (kk = jj+1; kk < jnum; kk++) {
// replace with these two lines:
for (kk = 0; kk < jnum; kk++) {
if (kk == jj) continue;
for (kk = jj+1; kk < jnum; kk++) {
k = jlist[kk]; k = jlist[kk];
k &= NEIGHMASK; k &= NEIGHMASK;
...@@ -145,6 +158,7 @@ void PairATM::compute(int eflag, int vflag) ...@@ -145,6 +158,7 @@ void PairATM::compute(int eflag, int vflag)
nu_local = nu[type[i]][type[j]][type[k]]; nu_local = nu[type[i]][type[j]][type[k]];
if (nu_local == 0.0) continue; if (nu_local == 0.0) continue;
count3++;
interaction_ddd(nu_local, interaction_ddd(nu_local,
r6,rij2,rik2,rjk2,rij,rik,rjk,fj,fk,eflag,evdwl); r6,rij2,rik2,rjk2,rij,rik,rjk,fj,fk,eflag,evdwl);
...@@ -163,6 +177,15 @@ void PairATM::compute(int eflag, int vflag) ...@@ -163,6 +177,15 @@ void PairATM::compute(int eflag, int vflag)
} }
} }
int count = count1;
MPI_Allreduce(&count,&count1,1,MPI_INT,MPI_SUM,world);
count = count2;
MPI_Allreduce(&count,&count2,1,MPI_INT,MPI_SUM,world);
count = count3;
MPI_Allreduce(&count,&count3,1,MPI_INT,MPI_SUM,world);
printf("FORCE %g %d %d %d\n",cutoff_squared,count1,count2,count3);
if (vflag_fdotr) virial_fdotr_compute(); if (vflag_fdotr) virial_fdotr_compute();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment