diff --git a/src/USER-OMP/angle_charmm_omp.cpp b/src/USER-OMP/angle_charmm_omp.cpp index 4cc86dd11c..8b091ba84a 100644 --- a/src/USER-OMP/angle_charmm_omp.cpp +++ b/src/USER-OMP/angle_charmm_omp.cpp @@ -90,40 +90,40 @@ void AngleCharmmOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; double delxUB,delyUB,delzUB,rsqUB,rUB,dr,rk,forceUB; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const anglelist = neighbor->anglelist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = anglelist[n][0]; - i2 = anglelist[n][1]; - i3 = anglelist[n][2]; - type = anglelist[n][3]; + i1 = anglelist[n].a; + i2 = anglelist[n].b; + i3 = anglelist[n].c; + type = anglelist[n].t; // 1st bond - delx1 = x[i1][0] - x[i2][0]; - dely1 = x[i1][1] - x[i2][1]; - delz1 = x[i1][2] - x[i2][2]; + delx1 = x[i1].x - x[i2].x; + dely1 = x[i1].y - x[i2].y; + delz1 = x[i1].z - x[i2].z; rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); // 2nd bond - delx2 = x[i3][0] - x[i2][0]; - dely2 = x[i3][1] - x[i2][1]; - delz2 = x[i3][2] - x[i2][2]; + delx2 = x[i3].x - x[i2].x; + dely2 = x[i3].y - x[i2].y; + delz2 = x[i3].z - x[i2].z; rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); // Urey-Bradley bond - delxUB = x[i3][0] - x[i1][0]; - delyUB = x[i3][1] - x[i1][1]; - delzUB = x[i3][2] - x[i1][2]; + delxUB = x[i3].x - x[i1].x; + delyUB = x[i3].y - x[i1].y; + delzUB = x[i3].z - x[i1].z; rsqUB = delxUB*delxUB + delyUB*delyUB + delzUB*delzUB; rUB = sqrt(rsqUB); @@ -173,21 +173,21 @@ void AngleCharmmOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 3 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= f1[0] + f3[0]; - f[i2][1] -= f1[1] + f3[1]; - f[i2][2] -= f1[2] + f3[2]; + f[i2].x -= f1[0] + f3[0]; + f[i2].y -= f1[1] + f3[1]; + f[i2].z -= f1[2] + f3[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (EVFLAG) ev_tally_thr(this,i1,i2,i3,nlocal,NEWTON_BOND,eangle,f1,f3, diff --git a/src/USER-OMP/angle_class2_omp.cpp b/src/USER-OMP/angle_class2_omp.cpp index ef887a93e2..f31574da4a 100644 --- a/src/USER-OMP/angle_class2_omp.cpp +++ b/src/USER-OMP/angle_class2_omp.cpp @@ -91,31 +91,31 @@ void AngleClass2OMP::eval(int nfrom, int nto, ThrData * const thr) double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22,b1,b2; double vx11,vx12,vy11,vy12,vz11,vz12,vx21,vx22,vy21,vy22,vz21,vz22; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const anglelist = neighbor->anglelist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = anglelist[n][0]; - i2 = anglelist[n][1]; - i3 = anglelist[n][2]; - type = anglelist[n][3]; + i1 = anglelist[n].a; + i2 = anglelist[n].b; + i3 = anglelist[n].c; + type = anglelist[n].t; // 1st bond - delx1 = x[i1][0] - x[i2][0]; - dely1 = x[i1][1] - x[i2][1]; - delz1 = x[i1][2] - x[i2][2]; + delx1 = x[i1].x - x[i2].x; + dely1 = x[i1].y - x[i2].y; + delz1 = x[i1].z - x[i2].z; rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); // 2nd bond - delx2 = x[i3][0] - x[i2][0]; - dely2 = x[i3][1] - x[i2][1]; - delz2 = x[i3][2] - x[i2][2]; + delx2 = x[i3].x - x[i2].x; + dely2 = x[i3].y - x[i2].y; + delz2 = x[i3].z - x[i2].z; rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); @@ -217,21 +217,21 @@ void AngleClass2OMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 3 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= f1[0] + f3[0]; - f[i2][1] -= f1[1] + f3[1]; - f[i2][2] -= f1[2] + f3[2]; + f[i2].x -= f1[0] + f3[0]; + f[i2].y -= f1[1] + f3[1]; + f[i2].z -= f1[2] + f3[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (EVFLAG) ev_tally_thr(this,i1,i2,i3,nlocal,NEWTON_BOND,eangle,f1,f3, diff --git a/src/USER-OMP/angle_cosine_delta_omp.cpp b/src/USER-OMP/angle_cosine_delta_omp.cpp index caf259b15c..29eb271d2a 100644 --- a/src/USER-OMP/angle_cosine_delta_omp.cpp +++ b/src/USER-OMP/angle_cosine_delta_omp.cpp @@ -88,31 +88,31 @@ void AngleCosineDeltaOMP::eval(int nfrom, int nto, ThrData * const thr) double eangle,f1[3],f3[3]; double rsq1,rsq2,r1,r2,c,a,cot,a11,a12,a22,b11,b12,b22,c0,s0,s; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const anglelist = neighbor->anglelist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = anglelist[n][0]; - i2 = anglelist[n][1]; - i3 = anglelist[n][2]; - type = anglelist[n][3]; + i1 = anglelist[n].a; + i2 = anglelist[n].b; + i3 = anglelist[n].c; + type = anglelist[n].t; // 1st bond - delx1 = x[i1][0] - x[i2][0]; - dely1 = x[i1][1] - x[i2][1]; - delz1 = x[i1][2] - x[i2][2]; + delx1 = x[i1].x - x[i2].x; + dely1 = x[i1].y - x[i2].y; + delz1 = x[i1].z - x[i2].z; rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); // 2nd bond - delx2 = x[i3][0] - x[i2][0]; - dely2 = x[i3][1] - x[i2][1]; - delz2 = x[i3][2] - x[i2][2]; + delx2 = x[i3].x - x[i2].x; + dely2 = x[i3].y - x[i2].y; + delz2 = x[i3].z - x[i2].z; rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); @@ -166,21 +166,21 @@ void AngleCosineDeltaOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 3 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= f1[0] + f3[0]; - f[i2][1] -= f1[1] + f3[1]; - f[i2][2] -= f1[2] + f3[2]; + f[i2].x -= f1[0] + f3[0]; + f[i2].y -= f1[1] + f3[1]; + f[i2].z -= f1[2] + f3[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (EVFLAG) ev_tally_thr(this,i1,i2,i3,nlocal,NEWTON_BOND,eangle,f1,f3, diff --git a/src/USER-OMP/angle_cosine_omp.cpp b/src/USER-OMP/angle_cosine_omp.cpp index 51d3494a4f..96e4b9bbb9 100644 --- a/src/USER-OMP/angle_cosine_omp.cpp +++ b/src/USER-OMP/angle_cosine_omp.cpp @@ -88,31 +88,31 @@ void AngleCosineOMP::eval(int nfrom, int nto, ThrData * const thr) double eangle,f1[3],f3[3]; double rsq1,rsq2,r1,r2,c,a,a11,a12,a22; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const anglelist = neighbor->anglelist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = anglelist[n][0]; - i2 = anglelist[n][1]; - i3 = anglelist[n][2]; - type = anglelist[n][3]; + i1 = anglelist[n].a; + i2 = anglelist[n].b; + i3 = anglelist[n].c; + type = anglelist[n].t; // 1st bond - delx1 = x[i1][0] - x[i2][0]; - dely1 = x[i1][1] - x[i2][1]; - delz1 = x[i1][2] - x[i2][2]; + delx1 = x[i1].x - x[i2].x; + dely1 = x[i1].y - x[i2].y; + delz1 = x[i1].z - x[i2].z; rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); // 2nd bond - delx2 = x[i3][0] - x[i2][0]; - dely2 = x[i3][1] - x[i2][1]; - delz2 = x[i3][2] - x[i2][2]; + delx2 = x[i3].x - x[i2].x; + dely2 = x[i3].y - x[i2].y; + delz2 = x[i3].z - x[i2].z; rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); @@ -143,21 +143,21 @@ void AngleCosineOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 3 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= f1[0] + f3[0]; - f[i2][1] -= f1[1] + f3[1]; - f[i2][2] -= f1[2] + f3[2]; + f[i2].x -= f1[0] + f3[0]; + f[i2].y -= f1[1] + f3[1]; + f[i2].z -= f1[2] + f3[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (EVFLAG) ev_tally_thr(this,i1,i2,i3,nlocal,NEWTON_BOND,eangle,f1,f3, diff --git a/src/USER-OMP/angle_cosine_periodic_omp.cpp b/src/USER-OMP/angle_cosine_periodic_omp.cpp index e43fabafdd..69d3b73865 100644 --- a/src/USER-OMP/angle_cosine_periodic_omp.cpp +++ b/src/USER-OMP/angle_cosine_periodic_omp.cpp @@ -91,31 +91,31 @@ void AngleCosinePeriodicOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; double tn,tn_1,tn_2,un,un_1,un_2; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const anglelist = neighbor->anglelist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = anglelist[n][0]; - i2 = anglelist[n][1]; - i3 = anglelist[n][2]; - type = anglelist[n][3]; + i1 = anglelist[n].a; + i2 = anglelist[n].b; + i3 = anglelist[n].c; + type = anglelist[n].t; // 1st bond - delx1 = x[i1][0] - x[i2][0]; - dely1 = x[i1][1] - x[i2][1]; - delz1 = x[i1][2] - x[i2][2]; + delx1 = x[i1].x - x[i2].x; + dely1 = x[i1].y - x[i2].y; + delz1 = x[i1].z - x[i2].z; rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); // 2nd bond - delx2 = x[i3][0] - x[i2][0]; - dely2 = x[i3][1] - x[i2][1]; - delz2 = x[i3][2] - x[i2][2]; + delx2 = x[i3].x - x[i2].x; + dely2 = x[i3].y - x[i2].y; + delz2 = x[i3].z - x[i2].z; rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); @@ -183,21 +183,21 @@ void AngleCosinePeriodicOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 3 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= f1[0] + f3[0]; - f[i2][1] -= f1[1] + f3[1]; - f[i2][2] -= f1[2] + f3[2]; + f[i2].x -= f1[0] + f3[0]; + f[i2].y -= f1[1] + f3[1]; + f[i2].z -= f1[2] + f3[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (EVFLAG) ev_tally_thr(this,i1,i2,i3,nlocal,NEWTON_BOND,eangle,f1,f3, diff --git a/src/USER-OMP/angle_cosine_shift_exp_omp.cpp b/src/USER-OMP/angle_cosine_shift_exp_omp.cpp index 18af91cf7d..3276167fbd 100644 --- a/src/USER-OMP/angle_cosine_shift_exp_omp.cpp +++ b/src/USER-OMP/angle_cosine_shift_exp_omp.cpp @@ -89,31 +89,31 @@ void AngleCosineShiftExpOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq1,rsq2,r1,r2,c,s,a11,a12,a22; double exp2,aa,uumin,cccpsss,cssmscc; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const anglelist = neighbor->anglelist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = anglelist[n][0]; - i2 = anglelist[n][1]; - i3 = anglelist[n][2]; - type = anglelist[n][3]; + i1 = anglelist[n].a; + i2 = anglelist[n].b; + i3 = anglelist[n].c; + type = anglelist[n].t; // 1st bond - delx1 = x[i1][0] - x[i2][0]; - dely1 = x[i1][1] - x[i2][1]; - delz1 = x[i1][2] - x[i2][2]; + delx1 = x[i1].x - x[i2].x; + dely1 = x[i1].y - x[i2].y; + delz1 = x[i1].z - x[i2].z; rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); // 2nd bond - delx2 = x[i3][0] - x[i2][0]; - dely2 = x[i3][1] - x[i2][1]; - delz2 = x[i3][2] - x[i2][2]; + delx2 = x[i3].x - x[i2].x; + dely2 = x[i3].y - x[i2].y; + delz2 = x[i3].z - x[i2].z; rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); @@ -164,21 +164,21 @@ void AngleCosineShiftExpOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 3 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= f1[0] + f3[0]; - f[i2][1] -= f1[1] + f3[1]; - f[i2][2] -= f1[2] + f3[2]; + f[i2].x -= f1[0] + f3[0]; + f[i2].y -= f1[1] + f3[1]; + f[i2].z -= f1[2] + f3[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (EVFLAG) ev_tally_thr(this,i1,i2,i3,nlocal,NEWTON_BOND,eangle,f1,f3, diff --git a/src/USER-OMP/angle_cosine_shift_omp.cpp b/src/USER-OMP/angle_cosine_shift_omp.cpp index a7f40fee8a..2a0ce662af 100644 --- a/src/USER-OMP/angle_cosine_shift_omp.cpp +++ b/src/USER-OMP/angle_cosine_shift_omp.cpp @@ -88,32 +88,32 @@ void AngleCosineShiftOMP::eval(int nfrom, int nto, ThrData * const thr) double f1[3],f3[3]; double rsq1,rsq2,r1,r2,c,s,cps,a11,a12,a22; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const anglelist = neighbor->anglelist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; double eangle = 0.0; for (n = nfrom; n < nto; n++) { - i1 = anglelist[n][0]; - i2 = anglelist[n][1]; - i3 = anglelist[n][2]; - type = anglelist[n][3]; + i1 = anglelist[n].a; + i2 = anglelist[n].b; + i3 = anglelist[n].c; + type = anglelist[n].t; // 1st bond - delx1 = x[i1][0] - x[i2][0]; - dely1 = x[i1][1] - x[i2][1]; - delz1 = x[i1][2] - x[i2][2]; + delx1 = x[i1].x - x[i2].x; + dely1 = x[i1].y - x[i2].y; + delz1 = x[i1].z - x[i2].z; rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); // 2nd bond - delx2 = x[i3][0] - x[i2][0]; - dely2 = x[i3][1] - x[i2][1]; - delz2 = x[i3][2] - x[i2][2]; + delx2 = x[i3].x - x[i2].x; + dely2 = x[i3].y - x[i2].y; + delz2 = x[i3].z - x[i2].z; rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); @@ -149,21 +149,21 @@ void AngleCosineShiftOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 3 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= f1[0] + f3[0]; - f[i2][1] -= f1[1] + f3[1]; - f[i2][2] -= f1[2] + f3[2]; + f[i2].x -= f1[0] + f3[0]; + f[i2].y -= f1[1] + f3[1]; + f[i2].z -= f1[2] + f3[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (EVFLAG) ev_tally_thr(this,i1,i2,i3,nlocal,NEWTON_BOND,eangle,f1,f3, diff --git a/src/USER-OMP/angle_cosine_squared_omp.cpp b/src/USER-OMP/angle_cosine_squared_omp.cpp index e8eaff6b2a..fbf03a0d1d 100644 --- a/src/USER-OMP/angle_cosine_squared_omp.cpp +++ b/src/USER-OMP/angle_cosine_squared_omp.cpp @@ -89,31 +89,31 @@ void AngleCosineSquaredOMP::eval(int nfrom, int nto, ThrData * const thr) double dcostheta,tk; double rsq1,rsq2,r1,r2,c,a,a11,a12,a22; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const anglelist = neighbor->anglelist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = anglelist[n][0]; - i2 = anglelist[n][1]; - i3 = anglelist[n][2]; - type = anglelist[n][3]; + i1 = anglelist[n].a; + i2 = anglelist[n].b; + i3 = anglelist[n].c; + type = anglelist[n].t; // 1st bond - delx1 = x[i1][0] - x[i2][0]; - dely1 = x[i1][1] - x[i2][1]; - delz1 = x[i1][2] - x[i2][2]; + delx1 = x[i1].x - x[i2].x; + dely1 = x[i1].y - x[i2].y; + delz1 = x[i1].z - x[i2].z; rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); // 2nd bond - delx2 = x[i3][0] - x[i2][0]; - dely2 = x[i3][1] - x[i2][1]; - delz2 = x[i3][2] - x[i2][2]; + delx2 = x[i3].x - x[i2].x; + dely2 = x[i3].y - x[i2].y; + delz2 = x[i3].z - x[i2].z; rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); @@ -148,21 +148,21 @@ void AngleCosineSquaredOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 3 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= f1[0] + f3[0]; - f[i2][1] -= f1[1] + f3[1]; - f[i2][2] -= f1[2] + f3[2]; + f[i2].x -= f1[0] + f3[0]; + f[i2].y -= f1[1] + f3[1]; + f[i2].z -= f1[2] + f3[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (EVFLAG) ev_tally_thr(this,i1,i2,i3,nlocal,NEWTON_BOND,eangle,f1,f3, diff --git a/src/USER-OMP/angle_fourier_omp.cpp b/src/USER-OMP/angle_fourier_omp.cpp index 6765129947..152130ac71 100644 --- a/src/USER-OMP/angle_fourier_omp.cpp +++ b/src/USER-OMP/angle_fourier_omp.cpp @@ -89,31 +89,31 @@ void AngleFourierOMP::eval(int nfrom, int nto, ThrData * const thr) double term; double rsq1,rsq2,r1,r2,c,c2,a,a11,a12,a22; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const anglelist = neighbor->anglelist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = anglelist[n][0]; - i2 = anglelist[n][1]; - i3 = anglelist[n][2]; - type = anglelist[n][3]; + i1 = anglelist[n].a; + i2 = anglelist[n].b; + i3 = anglelist[n].c; + type = anglelist[n].t; // 1st bond - delx1 = x[i1][0] - x[i2][0]; - dely1 = x[i1][1] - x[i2][1]; - delz1 = x[i1][2] - x[i2][2]; + delx1 = x[i1].x - x[i2].x; + dely1 = x[i1].y - x[i2].y; + delz1 = x[i1].z - x[i2].z; rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); // 2nd bond - delx2 = x[i3][0] - x[i2][0]; - dely2 = x[i3][1] - x[i2][1]; - delz2 = x[i3][2] - x[i2][2]; + delx2 = x[i3].x - x[i2].x; + dely2 = x[i3].y - x[i2].y; + delz2 = x[i3].z - x[i2].z; rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); @@ -148,21 +148,21 @@ void AngleFourierOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 3 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= f1[0] + f3[0]; - f[i2][1] -= f1[1] + f3[1]; - f[i2][2] -= f1[2] + f3[2]; + f[i2].x -= f1[0] + f3[0]; + f[i2].y -= f1[1] + f3[1]; + f[i2].z -= f1[2] + f3[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (EVFLAG) ev_tally_thr(this,i1,i2,i3,nlocal,NEWTON_BOND,eangle,f1,f3, diff --git a/src/USER-OMP/angle_fourier_simple_omp.cpp b/src/USER-OMP/angle_fourier_simple_omp.cpp index d344028b9c..6d092d2bc2 100644 --- a/src/USER-OMP/angle_fourier_simple_omp.cpp +++ b/src/USER-OMP/angle_fourier_simple_omp.cpp @@ -89,31 +89,31 @@ void AngleFourierSimpleOMP::eval(int nfrom, int nto, ThrData * const thr) double term,sgn; double rsq1,rsq2,r1,r2,c,cn,th,nth,a,a11,a12,a22; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const anglelist = neighbor->anglelist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = anglelist[n][0]; - i2 = anglelist[n][1]; - i3 = anglelist[n][2]; - type = anglelist[n][3]; + i1 = anglelist[n].a; + i2 = anglelist[n].b; + i3 = anglelist[n].c; + type = anglelist[n].t; // 1st bond - delx1 = x[i1][0] - x[i2][0]; - dely1 = x[i1][1] - x[i2][1]; - delz1 = x[i1][2] - x[i2][2]; + delx1 = x[i1].x - x[i2].x; + dely1 = x[i1].y - x[i2].y; + delz1 = x[i1].z - x[i2].z; rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); // 2nd bond - delx2 = x[i3][0] - x[i2][0]; - dely2 = x[i3][1] - x[i2][1]; - delz2 = x[i3][2] - x[i2][2]; + delx2 = x[i3].x - x[i2].x; + dely2 = x[i3].y - x[i2].y; + delz2 = x[i3].z - x[i2].z; rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); @@ -165,21 +165,21 @@ void AngleFourierSimpleOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 3 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= f1[0] + f3[0]; - f[i2][1] -= f1[1] + f3[1]; - f[i2][2] -= f1[2] + f3[2]; + f[i2].x -= f1[0] + f3[0]; + f[i2].y -= f1[1] + f3[1]; + f[i2].z -= f1[2] + f3[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (EVFLAG) ev_tally_thr(this,i1,i2,i3,nlocal,NEWTON_BOND,eangle,f1,f3, diff --git a/src/USER-OMP/angle_harmonic_omp.cpp b/src/USER-OMP/angle_harmonic_omp.cpp index c30f830b77..5f0443bc77 100644 --- a/src/USER-OMP/angle_harmonic_omp.cpp +++ b/src/USER-OMP/angle_harmonic_omp.cpp @@ -89,31 +89,31 @@ void AngleHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) double dtheta,tk; double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const anglelist = neighbor->anglelist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = anglelist[n][0]; - i2 = anglelist[n][1]; - i3 = anglelist[n][2]; - type = anglelist[n][3]; + i1 = anglelist[n].a; + i2 = anglelist[n].b; + i3 = anglelist[n].c; + type = anglelist[n].t; // 1st bond - delx1 = x[i1][0] - x[i2][0]; - dely1 = x[i1][1] - x[i2][1]; - delz1 = x[i1][2] - x[i2][2]; + delx1 = x[i1].x - x[i2].x; + dely1 = x[i1].y - x[i2].y; + delz1 = x[i1].z - x[i2].z; rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); // 2nd bond - delx2 = x[i3][0] - x[i2][0]; - dely2 = x[i3][1] - x[i2][1]; - delz2 = x[i3][2] - x[i2][2]; + delx2 = x[i3].x - x[i2].x; + dely2 = x[i3].y - x[i2].y; + delz2 = x[i3].z - x[i2].z; rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); @@ -152,21 +152,21 @@ void AngleHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 3 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= f1[0] + f3[0]; - f[i2][1] -= f1[1] + f3[1]; - f[i2][2] -= f1[2] + f3[2]; + f[i2].x -= f1[0] + f3[0]; + f[i2].y -= f1[1] + f3[1]; + f[i2].z -= f1[2] + f3[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (EVFLAG) ev_tally_thr(this,i1,i2,i3,nlocal,NEWTON_BOND,eangle,f1,f3, diff --git a/src/USER-OMP/angle_quartic_omp.cpp b/src/USER-OMP/angle_quartic_omp.cpp index 7306cc2f7d..254fdfb161 100644 --- a/src/USER-OMP/angle_quartic_omp.cpp +++ b/src/USER-OMP/angle_quartic_omp.cpp @@ -89,31 +89,31 @@ void AngleQuarticOMP::eval(int nfrom, int nto, ThrData * const thr) double dtheta,dtheta2,dtheta3,dtheta4,tk; double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const anglelist = neighbor->anglelist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = anglelist[n][0]; - i2 = anglelist[n][1]; - i3 = anglelist[n][2]; - type = anglelist[n][3]; + i1 = anglelist[n].a; + i2 = anglelist[n].b; + i3 = anglelist[n].c; + type = anglelist[n].t; // 1st bond - delx1 = x[i1][0] - x[i2][0]; - dely1 = x[i1][1] - x[i2][1]; - delz1 = x[i1][2] - x[i2][2]; + delx1 = x[i1].x - x[i2].x; + dely1 = x[i1].y - x[i2].y; + delz1 = x[i1].z - x[i2].z; rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); // 2nd bond - delx2 = x[i3][0] - x[i2][0]; - dely2 = x[i3][1] - x[i2][1]; - delz2 = x[i3][2] - x[i2][2]; + delx2 = x[i3].x - x[i2].x; + dely2 = x[i3].y - x[i2].y; + delz2 = x[i3].z - x[i2].z; rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); @@ -157,21 +157,21 @@ void AngleQuarticOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 3 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= f1[0] + f3[0]; - f[i2][1] -= f1[1] + f3[1]; - f[i2][2] -= f1[2] + f3[2]; + f[i2].x -= f1[0] + f3[0]; + f[i2].y -= f1[1] + f3[1]; + f[i2].z -= f1[2] + f3[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (EVFLAG) ev_tally_thr(this,i1,i2,i3,nlocal,NEWTON_BOND,eangle,f1,f3, diff --git a/src/USER-OMP/angle_sdk_omp.cpp b/src/USER-OMP/angle_sdk_omp.cpp index bd780e0fe0..577b154606 100644 --- a/src/USER-OMP/angle_sdk_omp.cpp +++ b/src/USER-OMP/angle_sdk_omp.cpp @@ -91,31 +91,31 @@ void AngleSDKOMP::eval(int nfrom, int nto, ThrData * const thr) double dtheta,tk; double rsq1,rsq2,rsq3,r1,r2,c,s,a,a11,a12,a22; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const anglelist = neighbor->anglelist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = anglelist[n][0]; - i2 = anglelist[n][1]; - i3 = anglelist[n][2]; - type = anglelist[n][3]; + i1 = anglelist[n].a; + i2 = anglelist[n].b; + i3 = anglelist[n].c; + type = anglelist[n].t; // 1st bond - delx1 = x[i1][0] - x[i2][0]; - dely1 = x[i1][1] - x[i2][1]; - delz1 = x[i1][2] - x[i2][2]; + delx1 = x[i1].x - x[i2].x; + dely1 = x[i1].y - x[i2].y; + delz1 = x[i1].z - x[i2].z; rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); // 2nd bond - delx2 = x[i3][0] - x[i2][0]; - dely2 = x[i3][1] - x[i2][1]; - delz2 = x[i3][2] - x[i2][2]; + delx2 = x[i3].x - x[i2].x; + dely2 = x[i3].y - x[i2].y; + delz2 = x[i3].z - x[i2].z; rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); @@ -142,9 +142,9 @@ void AngleSDKOMP::eval(int nfrom, int nto, ThrData * const thr) if (repflag) { - delx3 = x[i1][0] - x[i3][0]; - dely3 = x[i1][1] - x[i3][1]; - delz3 = x[i1][2] - x[i3][2]; + delx3 = x[i1].x - x[i3].x; + dely3 = x[i1].y - x[i3].y; + delz3 = x[i1].z - x[i3].z; rsq3 = delx3*delx3 + dely3*dely3 + delz3*delz3; const int type1 = atom->type[i1]; @@ -203,21 +203,21 @@ void AngleSDKOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of the 3 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0] + f13*delx3; - f[i1][1] += f1[1] + f13*dely3; - f[i1][2] += f1[2] + f13*delz3; + f[i1].x += f1[0] + f13*delx3; + f[i1].y += f1[1] + f13*dely3; + f[i1].z += f1[2] + f13*delz3; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= f1[0] + f3[0]; - f[i2][1] -= f1[1] + f3[1]; - f[i2][2] -= f1[2] + f3[2]; + f[i2].x -= f1[0] + f3[0]; + f[i2].y -= f1[1] + f3[1]; + f[i2].z -= f1[2] + f3[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0] - f13*delx3; - f[i3][1] += f3[1] - f13*dely3; - f[i3][2] += f3[2] - f13*delz3; + f[i3].x += f3[0] - f13*delx3; + f[i3].y += f3[1] - f13*dely3; + f[i3].z += f3[2] - f13*delz3; } if (EVFLAG) { diff --git a/src/USER-OMP/angle_table_omp.cpp b/src/USER-OMP/angle_table_omp.cpp index 15c32c8943..e4732b466b 100644 --- a/src/USER-OMP/angle_table_omp.cpp +++ b/src/USER-OMP/angle_table_omp.cpp @@ -89,31 +89,31 @@ void AngleTableOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; double theta,u,mdu; //mdu: minus du, -du/dx=f - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const anglelist = neighbor->anglelist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = anglelist[n][0]; - i2 = anglelist[n][1]; - i3 = anglelist[n][2]; - type = anglelist[n][3]; + i1 = anglelist[n].a; + i2 = anglelist[n].b; + i3 = anglelist[n].c; + type = anglelist[n].t; // 1st bond - delx1 = x[i1][0] - x[i2][0]; - dely1 = x[i1][1] - x[i2][1]; - delz1 = x[i1][2] - x[i2][2]; + delx1 = x[i1].x - x[i2].x; + dely1 = x[i1].y - x[i2].y; + delz1 = x[i1].z - x[i2].z; rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); // 2nd bond - delx2 = x[i3][0] - x[i2][0]; - dely2 = x[i3][1] - x[i2][1]; - delz2 = x[i3][2] - x[i2][2]; + delx2 = x[i3].x - x[i2].x; + dely2 = x[i3].y - x[i2].y; + delz2 = x[i3].z - x[i2].z; rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); @@ -152,21 +152,21 @@ void AngleTableOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 3 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= f1[0] + f3[0]; - f[i2][1] -= f1[1] + f3[1]; - f[i2][2] -= f1[2] + f3[2]; + f[i2].x -= f1[0] + f3[0]; + f[i2].y -= f1[1] + f3[1]; + f[i2].z -= f1[2] + f3[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (EVFLAG) ev_tally_thr(this,i1,i2,i3,nlocal,NEWTON_BOND,eangle,f1,f3, diff --git a/src/USER-OMP/bond_class2_omp.cpp b/src/USER-OMP/bond_class2_omp.cpp index 580d9b9804..91560b0d1c 100644 --- a/src/USER-OMP/bond_class2_omp.cpp +++ b/src/USER-OMP/bond_class2_omp.cpp @@ -83,19 +83,19 @@ void BondClass2OMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,dr2,dr3,dr4,de_bond; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const bondlist = neighbor->bondlist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = bondlist[n][0]; - i2 = bondlist[n][1]; - type = bondlist[n][2]; + i1 = bondlist[n].a; + i2 = bondlist[n].b; + type = bondlist[n].t; - delx = x[i1][0] - x[i2][0]; - dely = x[i1][1] - x[i2][1]; - delz = x[i1][2] - x[i2][2]; + delx = x[i1].x - x[i2].x; + dely = x[i1].y - x[i2].y; + delz = x[i1].z - x[i2].z; rsq = delx*delx + dely*dely + delz*delz; r = sqrt(rsq); @@ -115,15 +115,15 @@ void BondClass2OMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 2 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += delx*fbond; - f[i1][1] += dely*fbond; - f[i1][2] += delz*fbond; + f[i1].x += delx*fbond; + f[i1].y += dely*fbond; + f[i1].z += delz*fbond; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= delx*fbond; - f[i2][1] -= dely*fbond; - f[i2][2] -= delz*fbond; + f[i2].x -= delx*fbond; + f[i2].y -= dely*fbond; + f[i2].z -= delz*fbond; } if (EVFLAG) ev_tally_thr(this,i1,i2,nlocal,NEWTON_BOND, diff --git a/src/USER-OMP/bond_fene_expand_omp.cpp b/src/USER-OMP/bond_fene_expand_omp.cpp index 4706ef8232..e705235841 100644 --- a/src/USER-OMP/bond_fene_expand_omp.cpp +++ b/src/USER-OMP/bond_fene_expand_omp.cpp @@ -85,20 +85,20 @@ void BondFENEExpandOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq,r0sq,rlogarg,sr2,sr6; double r,rshift,rshiftsq; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const bondlist = neighbor->bondlist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; const int tid = thr->get_tid(); for (n = nfrom; n < nto; n++) { - i1 = bondlist[n][0]; - i2 = bondlist[n][1]; - type = bondlist[n][2]; + i1 = bondlist[n].a; + i2 = bondlist[n].b; + type = bondlist[n].t; - delx = x[i1][0] - x[i2][0]; - dely = x[i1][1] - x[i2][1]; - delz = x[i1][2] - x[i2][2]; + delx = x[i1].x - x[i2].x; + dely = x[i1].y - x[i2].y; + delz = x[i1].z - x[i2].z; rsq = delx*delx + dely*dely + delz*delz; r = sqrt(rsq); @@ -145,15 +145,15 @@ void BondFENEExpandOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 2 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += delx*fbond; - f[i1][1] += dely*fbond; - f[i1][2] += delz*fbond; + f[i1].x += delx*fbond; + f[i1].y += dely*fbond; + f[i1].z += delz*fbond; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= delx*fbond; - f[i2][1] -= dely*fbond; - f[i2][2] -= delz*fbond; + f[i2].x -= delx*fbond; + f[i2].y -= dely*fbond; + f[i2].z -= delz*fbond; } if (EVFLAG) ev_tally_thr(this,i1,i2,nlocal,NEWTON_BOND, diff --git a/src/USER-OMP/bond_fene_omp.cpp b/src/USER-OMP/bond_fene_omp.cpp index 34f90ea3a0..040e907217 100644 --- a/src/USER-OMP/bond_fene_omp.cpp +++ b/src/USER-OMP/bond_fene_omp.cpp @@ -84,20 +84,20 @@ void BondFENEOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r0sq,rlogarg,sr2,sr6; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const bondlist = neighbor->bondlist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; const int tid = thr->get_tid(); for (n = nfrom; n < nto; n++) { - i1 = bondlist[n][0]; - i2 = bondlist[n][1]; - type = bondlist[n][2]; + i1 = bondlist[n].a; + i2 = bondlist[n].b; + type = bondlist[n].t; - delx = x[i1][0] - x[i2][0]; - dely = x[i1][1] - x[i2][1]; - delz = x[i1][2] - x[i2][2]; + delx = x[i1].x - x[i2].x; + dely = x[i1].y - x[i2].y; + delz = x[i1].z - x[i2].z; rsq = delx*delx + dely*dely + delz*delz; r0sq = r0[type] * r0[type]; @@ -141,15 +141,15 @@ void BondFENEOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 2 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += delx*fbond; - f[i1][1] += dely*fbond; - f[i1][2] += delz*fbond; + f[i1].x += delx*fbond; + f[i1].y += dely*fbond; + f[i1].z += delz*fbond; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= delx*fbond; - f[i2][1] -= dely*fbond; - f[i2][2] -= delz*fbond; + f[i2].x -= delx*fbond; + f[i2].y -= dely*fbond; + f[i2].z -= delz*fbond; } if (EVFLAG) ev_tally_thr(this,i1,i2,nlocal,NEWTON_BOND, diff --git a/src/USER-OMP/bond_harmonic_omp.cpp b/src/USER-OMP/bond_harmonic_omp.cpp index dc8bab1c54..61ed89e394 100644 --- a/src/USER-OMP/bond_harmonic_omp.cpp +++ b/src/USER-OMP/bond_harmonic_omp.cpp @@ -82,19 +82,19 @@ void BondHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,rk; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const bondlist = neighbor->bondlist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = bondlist[n][0]; - i2 = bondlist[n][1]; - type = bondlist[n][2]; + i1 = bondlist[n].a; + i2 = bondlist[n].b; + type = bondlist[n].t; - delx = x[i1][0] - x[i2][0]; - dely = x[i1][1] - x[i2][1]; - delz = x[i1][2] - x[i2][2]; + delx = x[i1].x - x[i2].x; + dely = x[i1].y - x[i2].y; + delz = x[i1].z - x[i2].z; rsq = delx*delx + dely*dely + delz*delz; r = sqrt(rsq); @@ -111,15 +111,15 @@ void BondHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 2 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += delx*fbond; - f[i1][1] += dely*fbond; - f[i1][2] += delz*fbond; + f[i1].x += delx*fbond; + f[i1].y += dely*fbond; + f[i1].z += delz*fbond; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= delx*fbond; - f[i2][1] -= dely*fbond; - f[i2][2] -= delz*fbond; + f[i2].x -= delx*fbond; + f[i2].y -= dely*fbond; + f[i2].z -= delz*fbond; } if (EVFLAG) ev_tally_thr(this,i1,i2,nlocal,NEWTON_BOND, diff --git a/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp b/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp index 97f7715bfb..ff9fc554e5 100644 --- a/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp +++ b/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp @@ -82,19 +82,19 @@ void BondHarmonicShiftCutOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,rk; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const bondlist = neighbor->bondlist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = bondlist[n][0]; - i2 = bondlist[n][1]; - type = bondlist[n][2]; + i1 = bondlist[n].a; + i2 = bondlist[n].b; + type = bondlist[n].t; - delx = x[i1][0] - x[i2][0]; - dely = x[i1][1] - x[i2][1]; - delz = x[i1][2] - x[i2][2]; + delx = x[i1].x - x[i2].x; + dely = x[i1].y - x[i2].y; + delz = x[i1].z - x[i2].z; rsq = delx*delx + dely*dely + delz*delz; r = sqrt(rsq); @@ -115,15 +115,15 @@ void BondHarmonicShiftCutOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 2 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += delx*fbond; - f[i1][1] += dely*fbond; - f[i1][2] += delz*fbond; + f[i1].x += delx*fbond; + f[i1].y += dely*fbond; + f[i1].z += delz*fbond; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= delx*fbond; - f[i2][1] -= dely*fbond; - f[i2][2] -= delz*fbond; + f[i2].x -= delx*fbond; + f[i2].y -= dely*fbond; + f[i2].z -= delz*fbond; } if (EVFLAG) ev_tally_thr(this,i1,i2,nlocal,NEWTON_BOND, diff --git a/src/USER-OMP/bond_harmonic_shift_omp.cpp b/src/USER-OMP/bond_harmonic_shift_omp.cpp index 49d985b871..710507a517 100644 --- a/src/USER-OMP/bond_harmonic_shift_omp.cpp +++ b/src/USER-OMP/bond_harmonic_shift_omp.cpp @@ -82,19 +82,19 @@ void BondHarmonicShiftOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,rk; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const bondlist = neighbor->bondlist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = bondlist[n][0]; - i2 = bondlist[n][1]; - type = bondlist[n][2]; + i1 = bondlist[n].a; + i2 = bondlist[n].b; + type = bondlist[n].t; - delx = x[i1][0] - x[i2][0]; - dely = x[i1][1] - x[i2][1]; - delz = x[i1][2] - x[i2][2]; + delx = x[i1].x - x[i2].x; + dely = x[i1].y - x[i2].y; + delz = x[i1].z - x[i2].z; rsq = delx*delx + dely*dely + delz*delz; r = sqrt(rsq); @@ -112,15 +112,15 @@ void BondHarmonicShiftOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 2 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += delx*fbond; - f[i1][1] += dely*fbond; - f[i1][2] += delz*fbond; + f[i1].x += delx*fbond; + f[i1].y += dely*fbond; + f[i1].z += delz*fbond; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= delx*fbond; - f[i2][1] -= dely*fbond; - f[i2][2] -= delz*fbond; + f[i2].x -= delx*fbond; + f[i2].y -= dely*fbond; + f[i2].z -= delz*fbond; } if (EVFLAG) ev_tally_thr(this,i1,i2,nlocal,NEWTON_BOND, diff --git a/src/USER-OMP/bond_morse_omp.cpp b/src/USER-OMP/bond_morse_omp.cpp index 21063c636a..fe5f90c0bd 100644 --- a/src/USER-OMP/bond_morse_omp.cpp +++ b/src/USER-OMP/bond_morse_omp.cpp @@ -82,19 +82,19 @@ void BondMorseOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,ralpha; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const bondlist = neighbor->bondlist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = bondlist[n][0]; - i2 = bondlist[n][1]; - type = bondlist[n][2]; + i1 = bondlist[n].a; + i2 = bondlist[n].b; + type = bondlist[n].t; - delx = x[i1][0] - x[i2][0]; - dely = x[i1][1] - x[i2][1]; - delz = x[i1][2] - x[i2][2]; + delx = x[i1].x - x[i2].x; + dely = x[i1].y - x[i2].y; + delz = x[i1].z - x[i2].z; rsq = delx*delx + dely*dely + delz*delz; r = sqrt(rsq); @@ -112,15 +112,15 @@ void BondMorseOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 2 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += delx*fbond; - f[i1][1] += dely*fbond; - f[i1][2] += delz*fbond; + f[i1].x += delx*fbond; + f[i1].y += dely*fbond; + f[i1].z += delz*fbond; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= delx*fbond; - f[i2][1] -= dely*fbond; - f[i2][2] -= delz*fbond; + f[i2].x -= delx*fbond; + f[i2].y -= dely*fbond; + f[i2].z -= delz*fbond; } if (EVFLAG) ev_tally_thr(this,i1,i2,nlocal,NEWTON_BOND, diff --git a/src/USER-OMP/bond_nonlinear_omp.cpp b/src/USER-OMP/bond_nonlinear_omp.cpp index 9e61ca3215..29f7c8484d 100644 --- a/src/USER-OMP/bond_nonlinear_omp.cpp +++ b/src/USER-OMP/bond_nonlinear_omp.cpp @@ -82,19 +82,19 @@ void BondNonlinearOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,drsq,lamdasq,denom,denomsq; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const bondlist = neighbor->bondlist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = bondlist[n][0]; - i2 = bondlist[n][1]; - type = bondlist[n][2]; + i1 = bondlist[n].a; + i2 = bondlist[n].b; + type = bondlist[n].t; - delx = x[i1][0] - x[i2][0]; - dely = x[i1][1] - x[i2][1]; - delz = x[i1][2] - x[i2][2]; + delx = x[i1].x - x[i2].x; + dely = x[i1].y - x[i2].y; + delz = x[i1].z - x[i2].z; rsq = delx*delx + dely*dely + delz*delz; r = sqrt(rsq); @@ -112,15 +112,15 @@ void BondNonlinearOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 2 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += delx*fbond; - f[i1][1] += dely*fbond; - f[i1][2] += delz*fbond; + f[i1].x += delx*fbond; + f[i1].y += dely*fbond; + f[i1].z += delz*fbond; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= delx*fbond; - f[i2][1] -= dely*fbond; - f[i2][2] -= delz*fbond; + f[i2].x -= delx*fbond; + f[i2].y -= dely*fbond; + f[i2].z -= delz*fbond; } if (EVFLAG) ev_tally_thr(this,i1,i2,nlocal,NEWTON_BOND, diff --git a/src/USER-OMP/bond_table_omp.cpp b/src/USER-OMP/bond_table_omp.cpp index 3184991315..2ed42bb388 100644 --- a/src/USER-OMP/bond_table_omp.cpp +++ b/src/USER-OMP/bond_table_omp.cpp @@ -83,19 +83,19 @@ void BondTableOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq,r; double u,mdu; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const bondlist = neighbor->bondlist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = bondlist[n][0]; - i2 = bondlist[n][1]; - type = bondlist[n][2]; + i1 = bondlist[n].a; + i2 = bondlist[n].b; + type = bondlist[n].t; - delx = x[i1][0] - x[i2][0]; - dely = x[i1][1] - x[i2][1]; - delz = x[i1][2] - x[i2][2]; + delx = x[i1].x - x[i2].x; + dely = x[i1].y - x[i2].y; + delz = x[i1].z - x[i2].z; rsq = delx*delx + dely*dely + delz*delz; r = sqrt(rsq); @@ -109,15 +109,15 @@ void BondTableOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 2 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += delx*fbond; - f[i1][1] += dely*fbond; - f[i1][2] += delz*fbond; + f[i1].x += delx*fbond; + f[i1].y += dely*fbond; + f[i1].z += delz*fbond; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] -= delx*fbond; - f[i2][1] -= dely*fbond; - f[i2][2] -= delz*fbond; + f[i2].x -= delx*fbond; + f[i2].y -= dely*fbond; + f[i2].z -= delz*fbond; } if (EVFLAG) ev_tally_thr(this,i1,i2,nlocal,NEWTON_BOND, diff --git a/src/USER-OMP/dihedral_charmm_omp.cpp b/src/USER-OMP/dihedral_charmm_omp.cpp index b069af43c5..f8e21fcca2 100644 --- a/src/USER-OMP/dihedral_charmm_omp.cpp +++ b/src/USER-OMP/dihedral_charmm_omp.cpp @@ -104,32 +104,32 @@ void DihedralCharmmOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; const int * const atomtype = atom->type; - const int * const * const dihedrallist = neighbor->dihedrallist; + const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const double qqrd2e = force->qqrd2e; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = dihedrallist[n][0]; - i2 = dihedrallist[n][1]; - i3 = dihedrallist[n][2]; - i4 = dihedrallist[n][3]; - type = dihedrallist[n][4]; + i1 = dihedrallist[n].a; + i2 = dihedrallist[n].b; + i3 = dihedrallist[n].c; + i4 = dihedrallist[n].d; + type = dihedrallist[n].t; // 1st bond - vb1x = x[i1][0] - x[i2][0]; - vb1y = x[i1][1] - x[i2][1]; - vb1z = x[i1][2] - x[i2][2]; + vb1x = x[i1].x - x[i2].x; + vb1y = x[i1].y - x[i2].y; + vb1z = x[i1].z - x[i2].z; // 2nd bond - vb2x = x[i3][0] - x[i2][0]; - vb2y = x[i3][1] - x[i2][1]; - vb2z = x[i3][2] - x[i2][2]; + vb2x = x[i3].x - x[i2].x; + vb2y = x[i3].y - x[i2].y; + vb2z = x[i3].z - x[i2].z; vb2xm = -vb2x; vb2ym = -vb2y; @@ -137,9 +137,9 @@ void DihedralCharmmOMP::eval(int nfrom, int nto, ThrData * const thr) // 3rd bond - vb3x = x[i4][0] - x[i3][0]; - vb3y = x[i4][1] - x[i3][1]; - vb3z = x[i4][2] - x[i3][2]; + vb3x = x[i4].x - x[i3].x; + vb3y = x[i4].y - x[i3].y; + vb3z = x[i4].z - x[i3].z; // c,s calculation @@ -176,13 +176,13 @@ void DihedralCharmmOMP::eval(int nfrom, int nto, ThrData * const thr) atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", - me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1].x,x[i1].y,x[i1].z); fprintf(screen," 2nd atom: %d %g %g %g\n", - me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2].x,x[i2].y,x[i2].z); fprintf(screen," 3rd atom: %d %g %g %g\n", - me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3].x,x[i3].y,x[i3].z); fprintf(screen," 4th atom: %d %g %g %g\n", - me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4].x,x[i4].y,x[i4].z); } } @@ -253,27 +253,27 @@ void DihedralCharmmOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 4 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += f2[0]; - f[i2][1] += f2[1]; - f[i2][2] += f2[2]; + f[i2].x += f2[0]; + f[i2].y += f2[1]; + f[i2].z += f2[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += f4[0]; - f[i4][1] += f4[1]; - f[i4][2] += f4[2]; + f[i4].x += f4[0]; + f[i4].y += f4[1]; + f[i4].z += f4[2]; } if (EVFLAG) @@ -286,9 +286,9 @@ void DihedralCharmmOMP::eval(int nfrom, int nto, ThrData * const thr) itype = atomtype[i1]; jtype = atomtype[i4]; - delx = x[i1][0] - x[i4][0]; - dely = x[i1][1] - x[i4][1]; - delz = x[i1][2] - x[i4][2]; + delx = x[i1].x - x[i4].x; + dely = x[i1].y - x[i4].y; + delz = x[i1].z - x[i4].z; rsq = delx*delx + dely*dely + delz*delz; r2inv = 1.0/rsq; r6inv = r2inv*r2inv*r2inv; @@ -305,14 +305,14 @@ void DihedralCharmmOMP::eval(int nfrom, int nto, ThrData * const thr) } if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += delx*fpair; - f[i1][1] += dely*fpair; - f[i1][2] += delz*fpair; + f[i1].x += delx*fpair; + f[i1].y += dely*fpair; + f[i1].z += delz*fpair; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] -= delx*fpair; - f[i4][1] -= dely*fpair; - f[i4][2] -= delz*fpair; + f[i4].x -= delx*fpair; + f[i4].y -= dely*fpair; + f[i4].z -= delz*fpair; } if (EVFLAG) ev_tally_thr(force->pair,i1,i4,nlocal,NEWTON_BOND, diff --git a/src/USER-OMP/dihedral_class2_omp.cpp b/src/USER-OMP/dihedral_class2_omp.cpp index d21c2869e9..516840c48f 100644 --- a/src/USER-OMP/dihedral_class2_omp.cpp +++ b/src/USER-OMP/dihedral_class2_omp.cpp @@ -99,29 +99,29 @@ void DihedralClass2OMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const dihedrallist = neighbor->dihedrallist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = dihedrallist[n][0]; - i2 = dihedrallist[n][1]; - i3 = dihedrallist[n][2]; - i4 = dihedrallist[n][3]; - type = dihedrallist[n][4]; + i1 = dihedrallist[n].a; + i2 = dihedrallist[n].b; + i3 = dihedrallist[n].c; + i4 = dihedrallist[n].d; + type = dihedrallist[n].t; // 1st bond - vb1x = x[i1][0] - x[i2][0]; - vb1y = x[i1][1] - x[i2][1]; - vb1z = x[i1][2] - x[i2][2]; + vb1x = x[i1].x - x[i2].x; + vb1y = x[i1].y - x[i2].y; + vb1z = x[i1].z - x[i2].z; // 2nd bond - vb2x = x[i3][0] - x[i2][0]; - vb2y = x[i3][1] - x[i2][1]; - vb2z = x[i3][2] - x[i2][2]; + vb2x = x[i3].x - x[i2].x; + vb2y = x[i3].y - x[i2].y; + vb2z = x[i3].z - x[i2].z; vb2xm = -vb2x; vb2ym = -vb2y; @@ -129,9 +129,9 @@ void DihedralClass2OMP::eval(int nfrom, int nto, ThrData * const thr) // 3rd bond - vb3x = x[i4][0] - x[i3][0]; - vb3y = x[i4][1] - x[i3][1]; - vb3z = x[i4][2] - x[i3][2]; + vb3x = x[i4].x - x[i3].x; + vb3y = x[i4].y - x[i3].y; + vb3z = x[i4].z - x[i3].z; // distances @@ -188,13 +188,13 @@ void DihedralClass2OMP::eval(int nfrom, int nto, ThrData * const thr) atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", - me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1].x,x[i1].y,x[i1].z); fprintf(screen," 2nd atom: %d %g %g %g\n", - me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2].x,x[i2].y,x[i2].z); fprintf(screen," 3rd atom: %d %g %g %g\n", - me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3].x,x[i3].y,x[i3].z); fprintf(screen," 4th atom: %d %g %g %g\n", - me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4].x,x[i4].y,x[i4].z); } } @@ -500,27 +500,27 @@ void DihedralClass2OMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 4 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += fabcd[0][0]; - f[i1][1] += fabcd[0][1]; - f[i1][2] += fabcd[0][2]; + f[i1].x += fabcd[0][0]; + f[i1].y += fabcd[0][1]; + f[i1].z += fabcd[0][2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += fabcd[1][0]; - f[i2][1] += fabcd[1][1]; - f[i2][2] += fabcd[1][2]; + f[i2].x += fabcd[1][0]; + f[i2].y += fabcd[1][1]; + f[i2].z += fabcd[1][2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += fabcd[2][0]; - f[i3][1] += fabcd[2][1]; - f[i3][2] += fabcd[2][2]; + f[i3].x += fabcd[2][0]; + f[i3].y += fabcd[2][1]; + f[i3].z += fabcd[2][2]; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += fabcd[3][0]; - f[i4][1] += fabcd[3][1]; - f[i4][2] += fabcd[3][2]; + f[i4].x += fabcd[3][0]; + f[i4].y += fabcd[3][1]; + f[i4].z += fabcd[3][2]; } if (EVFLAG) diff --git a/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp b/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp index ecb1a85fa4..538ff1bbc5 100644 --- a/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp +++ b/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp @@ -94,29 +94,29 @@ void DihedralCosineShiftExpOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const dihedrallist = neighbor->dihedrallist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = dihedrallist[n][0]; - i2 = dihedrallist[n][1]; - i3 = dihedrallist[n][2]; - i4 = dihedrallist[n][3]; - type = dihedrallist[n][4]; + i1 = dihedrallist[n].a; + i2 = dihedrallist[n].b; + i3 = dihedrallist[n].c; + i4 = dihedrallist[n].d; + type = dihedrallist[n].t; // 1st bond - vb1x = x[i1][0] - x[i2][0]; - vb1y = x[i1][1] - x[i2][1]; - vb1z = x[i1][2] - x[i2][2]; + vb1x = x[i1].x - x[i2].x; + vb1y = x[i1].y - x[i2].y; + vb1z = x[i1].z - x[i2].z; // 2nd bond - vb2x = x[i3][0] - x[i2][0]; - vb2y = x[i3][1] - x[i2][1]; - vb2z = x[i3][2] - x[i2][2]; + vb2x = x[i3].x - x[i2].x; + vb2y = x[i3].y - x[i2].y; + vb2z = x[i3].z - x[i2].z; vb2xm = -vb2x; vb2ym = -vb2y; @@ -124,9 +124,9 @@ void DihedralCosineShiftExpOMP::eval(int nfrom, int nto, ThrData * const thr) // 3rd bond - vb3x = x[i4][0] - x[i3][0]; - vb3y = x[i4][1] - x[i3][1]; - vb3z = x[i4][2] - x[i3][2]; + vb3x = x[i4].x - x[i3].x; + vb3y = x[i4].y - x[i3].y; + vb3z = x[i4].z - x[i3].z; // c,s calculation @@ -163,13 +163,13 @@ void DihedralCosineShiftExpOMP::eval(int nfrom, int nto, ThrData * const thr) atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", - me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1].x,x[i1].y,x[i1].z); fprintf(screen," 2nd atom: %d %g %g %g\n", - me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2].x,x[i2].y,x[i2].z); fprintf(screen," 3rd atom: %d %g %g %g\n", - me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3].x,x[i3].y,x[i3].z); fprintf(screen," 4th atom: %d %g %g %g\n", - me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4].x,x[i4].y,x[i4].z); } } @@ -232,27 +232,27 @@ void DihedralCosineShiftExpOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 4 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += f2[0]; - f[i2][1] += f2[1]; - f[i2][2] += f2[2]; + f[i2].x += f2[0]; + f[i2].y += f2[1]; + f[i2].z += f2[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += f4[0]; - f[i4][1] += f4[1]; - f[i4][2] += f4[2]; + f[i4].x += f4[0]; + f[i4].y += f4[1]; + f[i4].z += f4[2]; } if (EVFLAG) diff --git a/src/USER-OMP/dihedral_fourier_omp.cpp b/src/USER-OMP/dihedral_fourier_omp.cpp index 6b14367271..66c2c54510 100644 --- a/src/USER-OMP/dihedral_fourier_omp.cpp +++ b/src/USER-OMP/dihedral_fourier_omp.cpp @@ -93,29 +93,29 @@ void DihedralFourierOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const dihedrallist = neighbor->dihedrallist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = dihedrallist[n][0]; - i2 = dihedrallist[n][1]; - i3 = dihedrallist[n][2]; - i4 = dihedrallist[n][3]; - type = dihedrallist[n][4]; + i1 = dihedrallist[n].a; + i2 = dihedrallist[n].b; + i3 = dihedrallist[n].c; + i4 = dihedrallist[n].d; + type = dihedrallist[n].t; // 1st bond - vb1x = x[i1][0] - x[i2][0]; - vb1y = x[i1][1] - x[i2][1]; - vb1z = x[i1][2] - x[i2][2]; + vb1x = x[i1].x - x[i2].x; + vb1y = x[i1].y - x[i2].y; + vb1z = x[i1].z - x[i2].z; // 2nd bond - vb2x = x[i3][0] - x[i2][0]; - vb2y = x[i3][1] - x[i2][1]; - vb2z = x[i3][2] - x[i2][2]; + vb2x = x[i3].x - x[i2].x; + vb2y = x[i3].y - x[i2].y; + vb2z = x[i3].z - x[i2].z; vb2xm = -vb2x; vb2ym = -vb2y; @@ -123,9 +123,9 @@ void DihedralFourierOMP::eval(int nfrom, int nto, ThrData * const thr) // 3rd bond - vb3x = x[i4][0] - x[i3][0]; - vb3y = x[i4][1] - x[i3][1]; - vb3z = x[i4][2] - x[i3][2]; + vb3x = x[i4].x - x[i3].x; + vb3y = x[i4].y - x[i3].y; + vb3z = x[i4].z - x[i3].z; ax = vb1y*vb2zm - vb1z*vb2ym; ay = vb1z*vb2xm - vb1x*vb2zm; @@ -160,13 +160,13 @@ void DihedralFourierOMP::eval(int nfrom, int nto, ThrData * const thr) atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", - me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1].x,x[i1].y,x[i1].z); fprintf(screen," 2nd atom: %d %g %g %g\n", - me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2].x,x[i2].y,x[i2].z); fprintf(screen," 3rd atom: %d %g %g %g\n", - me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3].x,x[i3].y,x[i3].z); fprintf(screen," 4th atom: %d %g %g %g\n", - me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4].x,x[i4].y,x[i4].z); } } @@ -244,27 +244,27 @@ void DihedralFourierOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 4 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += f2[0]; - f[i2][1] += f2[1]; - f[i2][2] += f2[2]; + f[i2].x += f2[0]; + f[i2].y += f2[1]; + f[i2].z += f2[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += f4[0]; - f[i4][1] += f4[1]; - f[i4][2] += f4[2]; + f[i4].x += f4[0]; + f[i4].y += f4[1]; + f[i4].z += f4[2]; } if (EVFLAG) diff --git a/src/USER-OMP/dihedral_harmonic_omp.cpp b/src/USER-OMP/dihedral_harmonic_omp.cpp index e3b94c8f9a..625a5743db 100644 --- a/src/USER-OMP/dihedral_harmonic_omp.cpp +++ b/src/USER-OMP/dihedral_harmonic_omp.cpp @@ -93,29 +93,29 @@ void DihedralHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const dihedrallist = neighbor->dihedrallist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = dihedrallist[n][0]; - i2 = dihedrallist[n][1]; - i3 = dihedrallist[n][2]; - i4 = dihedrallist[n][3]; - type = dihedrallist[n][4]; + i1 = dihedrallist[n].a; + i2 = dihedrallist[n].b; + i3 = dihedrallist[n].c; + i4 = dihedrallist[n].d; + type = dihedrallist[n].t; // 1st bond - vb1x = x[i1][0] - x[i2][0]; - vb1y = x[i1][1] - x[i2][1]; - vb1z = x[i1][2] - x[i2][2]; + vb1x = x[i1].x - x[i2].x; + vb1y = x[i1].y - x[i2].y; + vb1z = x[i1].z - x[i2].z; // 2nd bond - vb2x = x[i3][0] - x[i2][0]; - vb2y = x[i3][1] - x[i2][1]; - vb2z = x[i3][2] - x[i2][2]; + vb2x = x[i3].x - x[i2].x; + vb2y = x[i3].y - x[i2].y; + vb2z = x[i3].z - x[i2].z; vb2xm = -vb2x; vb2ym = -vb2y; @@ -123,9 +123,9 @@ void DihedralHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) // 3rd bond - vb3x = x[i4][0] - x[i3][0]; - vb3y = x[i4][1] - x[i3][1]; - vb3z = x[i4][2] - x[i3][2]; + vb3x = x[i4].x - x[i3].x; + vb3y = x[i4].y - x[i3].y; + vb3z = x[i4].z - x[i3].z; // c,s calculation @@ -162,13 +162,13 @@ void DihedralHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", - me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1].x,x[i1].y,x[i1].z); fprintf(screen," 2nd atom: %d %g %g %g\n", - me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2].x,x[i2].y,x[i2].z); fprintf(screen," 3rd atom: %d %g %g %g\n", - me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3].x,x[i3].y,x[i3].z); fprintf(screen," 4th atom: %d %g %g %g\n", - me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4].x,x[i4].y,x[i4].z); } } @@ -239,27 +239,27 @@ void DihedralHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 4 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += f2[0]; - f[i2][1] += f2[1]; - f[i2][2] += f2[2]; + f[i2].x += f2[0]; + f[i2].y += f2[1]; + f[i2].z += f2[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += f4[0]; - f[i4][1] += f4[1]; - f[i4][2] += f4[2]; + f[i4].x += f4[0]; + f[i4].y += f4[1]; + f[i4].z += f4[2]; } if (EVFLAG) diff --git a/src/USER-OMP/dihedral_helix_omp.cpp b/src/USER-OMP/dihedral_helix_omp.cpp index fd7025cdb4..3dc071201a 100644 --- a/src/USER-OMP/dihedral_helix_omp.cpp +++ b/src/USER-OMP/dihedral_helix_omp.cpp @@ -97,29 +97,29 @@ void DihedralHelixOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const dihedrallist = neighbor->dihedrallist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = dihedrallist[n][0]; - i2 = dihedrallist[n][1]; - i3 = dihedrallist[n][2]; - i4 = dihedrallist[n][3]; - type = dihedrallist[n][4]; + i1 = dihedrallist[n].a; + i2 = dihedrallist[n].b; + i3 = dihedrallist[n].c; + i4 = dihedrallist[n].d; + type = dihedrallist[n].t; // 1st bond - vb1x = x[i1][0] - x[i2][0]; - vb1y = x[i1][1] - x[i2][1]; - vb1z = x[i1][2] - x[i2][2]; + vb1x = x[i1].x - x[i2].x; + vb1y = x[i1].y - x[i2].y; + vb1z = x[i1].z - x[i2].z; // 2nd bond - vb2x = x[i3][0] - x[i2][0]; - vb2y = x[i3][1] - x[i2][1]; - vb2z = x[i3][2] - x[i2][2]; + vb2x = x[i3].x - x[i2].x; + vb2y = x[i3].y - x[i2].y; + vb2z = x[i3].z - x[i2].z; vb2xm = -vb2x; vb2ym = -vb2y; @@ -127,9 +127,9 @@ void DihedralHelixOMP::eval(int nfrom, int nto, ThrData * const thr) // 3rd bond - vb3x = x[i4][0] - x[i3][0]; - vb3y = x[i4][1] - x[i3][1]; - vb3z = x[i4][2] - x[i3][2]; + vb3x = x[i4].x - x[i3].x; + vb3y = x[i4].y - x[i3].y; + vb3z = x[i4].z - x[i3].z; // c0 calculation @@ -194,13 +194,13 @@ void DihedralHelixOMP::eval(int nfrom, int nto, ThrData * const thr) atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", - me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1].x,x[i1].y,x[i1].z); fprintf(screen," 2nd atom: %d %g %g %g\n", - me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2].x,x[i2].y,x[i2].z); fprintf(screen," 3rd atom: %d %g %g %g\n", - me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3].x,x[i3].y,x[i3].z); fprintf(screen," 4th atom: %d %g %g %g\n", - me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4].x,x[i4].y,x[i4].z); } } @@ -252,27 +252,27 @@ void DihedralHelixOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 4 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += f2[0]; - f[i2][1] += f2[1]; - f[i2][2] += f2[2]; + f[i2].x += f2[0]; + f[i2].y += f2[1]; + f[i2].z += f2[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += f4[0]; - f[i4][1] += f4[1]; - f[i4][2] += f4[2]; + f[i4].x += f4[0]; + f[i4].y += f4[1]; + f[i4].z += f4[2]; } if (EVFLAG) diff --git a/src/USER-OMP/dihedral_multi_harmonic_omp.cpp b/src/USER-OMP/dihedral_multi_harmonic_omp.cpp index a68bebfdf6..8afee5c636 100644 --- a/src/USER-OMP/dihedral_multi_harmonic_omp.cpp +++ b/src/USER-OMP/dihedral_multi_harmonic_omp.cpp @@ -94,29 +94,29 @@ void DihedralMultiHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const dihedrallist = neighbor->dihedrallist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = dihedrallist[n][0]; - i2 = dihedrallist[n][1]; - i3 = dihedrallist[n][2]; - i4 = dihedrallist[n][3]; - type = dihedrallist[n][4]; + i1 = dihedrallist[n].a; + i2 = dihedrallist[n].b; + i3 = dihedrallist[n].c; + i4 = dihedrallist[n].d; + type = dihedrallist[n].t; // 1st bond - vb1x = x[i1][0] - x[i2][0]; - vb1y = x[i1][1] - x[i2][1]; - vb1z = x[i1][2] - x[i2][2]; + vb1x = x[i1].x - x[i2].x; + vb1y = x[i1].y - x[i2].y; + vb1z = x[i1].z - x[i2].z; // 2nd bond - vb2x = x[i3][0] - x[i2][0]; - vb2y = x[i3][1] - x[i2][1]; - vb2z = x[i3][2] - x[i2][2]; + vb2x = x[i3].x - x[i2].x; + vb2y = x[i3].y - x[i2].y; + vb2z = x[i3].z - x[i2].z; vb2xm = -vb2x; vb2ym = -vb2y; @@ -124,9 +124,9 @@ void DihedralMultiHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) // 3rd bond - vb3x = x[i4][0] - x[i3][0]; - vb3y = x[i4][1] - x[i3][1]; - vb3z = x[i4][2] - x[i3][2]; + vb3x = x[i4].x - x[i3].x; + vb3y = x[i4].y - x[i3].y; + vb3z = x[i4].z - x[i3].z; // c0 calculation @@ -184,13 +184,13 @@ void DihedralMultiHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", - me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1].x,x[i1].y,x[i1].z); fprintf(screen," 2nd atom: %d %g %g %g\n", - me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2].x,x[i2].y,x[i2].z); fprintf(screen," 3rd atom: %d %g %g %g\n", - me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3].x,x[i3].y,x[i3].z); fprintf(screen," 4th atom: %d %g %g %g\n", - me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4].x,x[i4].y,x[i4].z); } } @@ -239,27 +239,27 @@ void DihedralMultiHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 4 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += f2[0]; - f[i2][1] += f2[1]; - f[i2][2] += f2[2]; + f[i2].x += f2[0]; + f[i2].y += f2[1]; + f[i2].z += f2[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += f4[0]; - f[i4][1] += f4[1]; - f[i4][2] += f4[2]; + f[i4].x += f4[0]; + f[i4].y += f4[1]; + f[i4].z += f4[2]; } if (EVFLAG) diff --git a/src/USER-OMP/dihedral_nharmonic_omp.cpp b/src/USER-OMP/dihedral_nharmonic_omp.cpp index 8adf19a899..a842917fe4 100644 --- a/src/USER-OMP/dihedral_nharmonic_omp.cpp +++ b/src/USER-OMP/dihedral_nharmonic_omp.cpp @@ -93,29 +93,29 @@ void DihedralNHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const dihedrallist = neighbor->dihedrallist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = dihedrallist[n][0]; - i2 = dihedrallist[n][1]; - i3 = dihedrallist[n][2]; - i4 = dihedrallist[n][3]; - type = dihedrallist[n][4]; + i1 = dihedrallist[n].a; + i2 = dihedrallist[n].b; + i3 = dihedrallist[n].c; + i4 = dihedrallist[n].d; + type = dihedrallist[n].t; // 1st bond - vb1x = x[i1][0] - x[i2][0]; - vb1y = x[i1][1] - x[i2][1]; - vb1z = x[i1][2] - x[i2][2]; + vb1x = x[i1].x - x[i2].x; + vb1y = x[i1].y - x[i2].y; + vb1z = x[i1].z - x[i2].z; // 2nd bond - vb2x = x[i3][0] - x[i2][0]; - vb2y = x[i3][1] - x[i2][1]; - vb2z = x[i3][2] - x[i2][2]; + vb2x = x[i3].x - x[i2].x; + vb2y = x[i3].y - x[i2].y; + vb2z = x[i3].z - x[i2].z; vb2xm = -vb2x; vb2ym = -vb2y; @@ -123,9 +123,9 @@ void DihedralNHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) // 3rd bond - vb3x = x[i4][0] - x[i3][0]; - vb3y = x[i4][1] - x[i3][1]; - vb3z = x[i4][2] - x[i3][2]; + vb3x = x[i4].x - x[i3].x; + vb3y = x[i4].y - x[i3].y; + vb3z = x[i4].z - x[i3].z; // c0 calculation @@ -184,13 +184,13 @@ void DihedralNHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", - me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1].x,x[i1].y,x[i1].z); fprintf(screen," 2nd atom: %d %g %g %g\n", - me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2].x,x[i2].y,x[i2].z); fprintf(screen," 3rd atom: %d %g %g %g\n", - me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3].x,x[i3].y,x[i3].z); fprintf(screen," 4th atom: %d %g %g %g\n", - me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4].x,x[i4].y,x[i4].z); } } @@ -243,27 +243,27 @@ void DihedralNHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 4 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += f2[0]; - f[i2][1] += f2[1]; - f[i2][2] += f2[2]; + f[i2].x += f2[0]; + f[i2].y += f2[1]; + f[i2].z += f2[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += f4[0]; - f[i4][1] += f4[1]; - f[i4][2] += f4[2]; + f[i4].x += f4[0]; + f[i4].y += f4[1]; + f[i4].z += f4[2]; } if (EVFLAG) diff --git a/src/USER-OMP/dihedral_opls_omp.cpp b/src/USER-OMP/dihedral_opls_omp.cpp index 3810dc1985..7e60f63a09 100644 --- a/src/USER-OMP/dihedral_opls_omp.cpp +++ b/src/USER-OMP/dihedral_opls_omp.cpp @@ -95,29 +95,29 @@ void DihedralOPLSOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const dihedrallist = neighbor->dihedrallist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = dihedrallist[n][0]; - i2 = dihedrallist[n][1]; - i3 = dihedrallist[n][2]; - i4 = dihedrallist[n][3]; - type = dihedrallist[n][4]; + i1 = dihedrallist[n].a; + i2 = dihedrallist[n].b; + i3 = dihedrallist[n].c; + i4 = dihedrallist[n].d; + type = dihedrallist[n].t; // 1st bond - vb1x = x[i1][0] - x[i2][0]; - vb1y = x[i1][1] - x[i2][1]; - vb1z = x[i1][2] - x[i2][2]; + vb1x = x[i1].x - x[i2].x; + vb1y = x[i1].y - x[i2].y; + vb1z = x[i1].z - x[i2].z; // 2nd bond - vb2x = x[i3][0] - x[i2][0]; - vb2y = x[i3][1] - x[i2][1]; - vb2z = x[i3][2] - x[i2][2]; + vb2x = x[i3].x - x[i2].x; + vb2y = x[i3].y - x[i2].y; + vb2z = x[i3].z - x[i2].z; vb2xm = -vb2x; vb2ym = -vb2y; @@ -125,9 +125,9 @@ void DihedralOPLSOMP::eval(int nfrom, int nto, ThrData * const thr) // 3rd bond - vb3x = x[i4][0] - x[i3][0]; - vb3y = x[i4][1] - x[i3][1]; - vb3z = x[i4][2] - x[i3][2]; + vb3x = x[i4].x - x[i3].x; + vb3y = x[i4].y - x[i3].y; + vb3z = x[i4].z - x[i3].z; // c0 calculation @@ -192,13 +192,13 @@ void DihedralOPLSOMP::eval(int nfrom, int nto, ThrData * const thr) atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", - me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1].x,x[i1].y,x[i1].z); fprintf(screen," 2nd atom: %d %g %g %g\n", - me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2].x,x[i2].y,x[i2].z); fprintf(screen," 3rd atom: %d %g %g %g\n", - me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3].x,x[i3].y,x[i3].z); fprintf(screen," 4th atom: %d %g %g %g\n", - me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4].x,x[i4].y,x[i4].z); } } @@ -255,27 +255,27 @@ void DihedralOPLSOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 4 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += f2[0]; - f[i2][1] += f2[1]; - f[i2][2] += f2[2]; + f[i2].x += f2[0]; + f[i2].y += f2[1]; + f[i2].z += f2[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += f4[0]; - f[i4][1] += f4[1]; - f[i4][2] += f4[2]; + f[i4].x += f4[0]; + f[i4].y += f4[1]; + f[i4].z += f4[2]; } if (EVFLAG) diff --git a/src/USER-OMP/dihedral_quadratic_omp.cpp b/src/USER-OMP/dihedral_quadratic_omp.cpp index 3e5fc243b9..4139e69698 100644 --- a/src/USER-OMP/dihedral_quadratic_omp.cpp +++ b/src/USER-OMP/dihedral_quadratic_omp.cpp @@ -94,29 +94,29 @@ void DihedralQuadraticOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const dihedrallist = neighbor->dihedrallist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = dihedrallist[n][0]; - i2 = dihedrallist[n][1]; - i3 = dihedrallist[n][2]; - i4 = dihedrallist[n][3]; - type = dihedrallist[n][4]; + i1 = dihedrallist[n].a; + i2 = dihedrallist[n].b; + i3 = dihedrallist[n].c; + i4 = dihedrallist[n].d; + type = dihedrallist[n].t; // 1st bond - vb1x = x[i1][0] - x[i2][0]; - vb1y = x[i1][1] - x[i2][1]; - vb1z = x[i1][2] - x[i2][2]; + vb1x = x[i1].x - x[i2].x; + vb1y = x[i1].y - x[i2].y; + vb1z = x[i1].z - x[i2].z; // 2nd bond - vb2x = x[i3][0] - x[i2][0]; - vb2y = x[i3][1] - x[i2][1]; - vb2z = x[i3][2] - x[i2][2]; + vb2x = x[i3].x - x[i2].x; + vb2y = x[i3].y - x[i2].y; + vb2z = x[i3].z - x[i2].z; vb2xm = -vb2x; vb2ym = -vb2y; @@ -124,9 +124,9 @@ void DihedralQuadraticOMP::eval(int nfrom, int nto, ThrData * const thr) // 3rd bond - vb3x = x[i4][0] - x[i3][0]; - vb3y = x[i4][1] - x[i3][1]; - vb3z = x[i4][2] - x[i3][2]; + vb3x = x[i4].x - x[i3].x; + vb3y = x[i4].y - x[i3].y; + vb3z = x[i4].z - x[i3].z; // c0 calculation @@ -191,13 +191,13 @@ void DihedralQuadraticOMP::eval(int nfrom, int nto, ThrData * const thr) atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", - me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1].x,x[i1].y,x[i1].z); fprintf(screen," 2nd atom: %d %g %g %g\n", - me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2].x,x[i2].y,x[i2].z); fprintf(screen," 3rd atom: %d %g %g %g\n", - me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3].x,x[i3].y,x[i3].z); fprintf(screen," 4th atom: %d %g %g %g\n", - me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4].x,x[i4].y,x[i4].z); } } @@ -256,27 +256,27 @@ void DihedralQuadraticOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 4 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += f2[0]; - f[i2][1] += f2[1]; - f[i2][2] += f2[2]; + f[i2].x += f2[0]; + f[i2].y += f2[1]; + f[i2].z += f2[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += f4[0]; - f[i4][1] += f4[1]; - f[i4][2] += f4[2]; + f[i4].x += f4[0]; + f[i4].y += f4[1]; + f[i4].z += f4[2]; } if (EVFLAG) diff --git a/src/USER-OMP/domain_omp.cpp b/src/USER-OMP/domain_omp.cpp index 6bde2ce992..f51ee4fe94 100644 --- a/src/USER-OMP/domain_omp.cpp +++ b/src/USER-OMP/domain_omp.cpp @@ -21,7 +21,7 @@ using namespace LAMMPS_NS; -typedef struct { double x,y,z; } vec3_t; +typedef struct { double x,y,z; } dbl3_t; #if defined(__GNUC__) #define _noalias __restrict #else @@ -41,8 +41,8 @@ typedef struct { double x,y,z; } vec3_t; void DomainOMP::pbc() { - vec3_t * _noalias const x = (vec3_t *)&atom->x[0][0]; - vec3_t * _noalias const v = (vec3_t *)&atom->v[0][0]; + dbl3_t * _noalias const x = (dbl3_t *)&atom->x[0][0]; + dbl3_t * _noalias const v = (dbl3_t *)&atom->v[0][0]; const double * _noalias const lo = (triclinic == 0) ? boxlo : boxlo_lamda; const double * _noalias const hi = (triclinic == 0) ? boxhi : boxhi_lamda; const double * _noalias const period = (triclinic == 0) ? prd : prd_lamda; @@ -146,7 +146,7 @@ void DomainOMP::pbc() void DomainOMP::lamda2x(int n) { - vec3_t * _noalias const x = (vec3_t *)&atom->x[0][0]; + dbl3_t * _noalias const x = (dbl3_t *)&atom->x[0][0]; const int num = n; int i; @@ -167,7 +167,7 @@ void DomainOMP::lamda2x(int n) void DomainOMP::x2lamda(int n) { - vec3_t * _noalias const x = (vec3_t *)&atom->x[0][0]; + dbl3_t * _noalias const x = (dbl3_t *)&atom->x[0][0]; const int num = n; int i; diff --git a/src/USER-OMP/fix_omp.cpp b/src/USER-OMP/fix_omp.cpp index ba04a9c2f9..e2aaab594c 100644 --- a/src/USER-OMP/fix_omp.cpp +++ b/src/USER-OMP/fix_omp.cpp @@ -65,12 +65,13 @@ static int get_tid() /* ---------------------------------------------------------------------- */ -FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - thr(NULL), last_omp_style(NULL), last_pair_hybrid(NULL), - _nthr(-1), _neighbor(true), _newton(false) +FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg) + : Fix(lmp, narg, arg), + thr(NULL), last_omp_style(NULL), last_pair_hybrid(NULL), + _nthr(-1), _neighbor(true), _mixed(false) { - if ((narg < 4) || (narg > 6)) error->all(FLERR,"Illegal fix OMP command"); - if (strcmp(arg[1],"all") != 0) error->all(FLERR,"Illegal fix OMP command"); + if ((narg < 4) || (narg > 7)) error->all(FLERR,"Illegal package omp command"); + if (strcmp(arg[1],"all") != 0) error->all(FLERR,"fix OMP has to operate on group 'all'"); int nthreads = 1; if (narg > 3) { @@ -84,64 +85,59 @@ FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), } if (nthreads < 1) - error->all(FLERR,"Illegal number of threads requested."); + error->all(FLERR,"Illegal number of OpenMP threads requested"); if (nthreads != comm->nthreads) { #if defined(_OPENMP) omp_set_num_threads(nthreads); #endif comm->nthreads = nthreads; - if (comm->me == 0) { - if (screen) - fprintf(screen," reset %d OpenMP thread(s) per MPI task\n", nthreads); - if (logfile) - fprintf(logfile," reset %d OpenMP thread(s) per MPI task\n", nthreads); - } } - if (narg > 4) { - if (strcmp(arg[4],"force/neigh") == 0) + int iarg = 4; + while (iarg < narg) { + if (strcmp(arg[iarg],"force/neigh") == 0) _neighbor = true; - else if (strcmp(arg[4],"force") == 0) + else if (strcmp(arg[iarg],"force") == 0) _neighbor = false; + else if (strcmp(arg[iarg],"mixed") == 0) + _mixed = true; + else if (strcmp(arg[iarg],"double") == 0) + _mixed = false; else - error->all(FLERR,"Illegal fix omp mode requested."); - - if (comm->me == 0) { - const char * const mode = _neighbor ? "OpenMP capable" : "serial"; - - if (screen) - fprintf(screen," using %s neighbor list subroutines\n", mode); - if (logfile) - fprintf(logfile," using %s neighbor list subroutines\n", mode); - } + error->all(FLERR,"Illegal package omp mode requested"); } -#if 0 /* to be enabled when we can switch between half and full neighbor lists */ - if (narg > 5) { - if (strcmp(arg[5],"neigh/half") == 0) - _newton = true; - else if (strcmp(arg[5],"neigh/full") == 0) - _newton = false; - else - error->all(FLERR,"Illegal fix OMP command"); + // print summary of settings + if (comm->me == 0) { + const char * const nmode = _neighbor ? "OpenMP capable" : "serial"; + const char * const kmode = _mixed ? "mixed" : "double"; - if (comm->me == 0) { - const char * const mode = _newton ? "half" : "full"; - - if (screen) - fprintf(screen," using /omp styles with %s neighbor list builds\n", mode); - if (logfile) - fprintf(logfile," using /omp styles with %s neighbor list builds\n", mode); + if (screen) { + fprintf(screen," reset %d OpenMP thread(s) per MPI task\n", nthreads); + fprintf(screen," using %s neighbor list subroutines\n", nmode); + if (_mixed) + fputs(" using mixed precision OpenMP force kernels where available\n", screen); + else + fputs(" using double precision OpenMP force kernels\n", screen); + } + + if (logfile) { + fprintf(logfile," reset %d OpenMP thread(s) per MPI task\n", nthreads); + fprintf(logfile," using %s neighbor list subroutines\n", nmode); + if (_mixed) + fputs(" using mixed precision OpenMP force kernels where available\n", logfile); + else + fputs(" using double precision OpenMP force kernels\n", logfile); } } -#endif // allocate list for per thread accumulator manager class instances // and then have each thread create an instance of this class to // encourage the OS to use storage that is "close" to each thread's CPU. thr = new ThrData *[nthreads]; _nthr = nthreads; + _clearforce = true; #if defined(_OPENMP) #pragma omp parallel default(none) #endif @@ -261,7 +257,7 @@ void FixOMP::init() CheckStyleForOMP(improper); CheckHybridForOMP(improper,Improper); } - + if (kspace_split >= 0) { CheckStyleForOMP(kspace); } @@ -286,10 +282,11 @@ void FixOMP::init() fprintf(logfile,"Last active /omp style is %s_style %s\n", last_force_name, last_omp_name); } else { + _clearforce = false; if (screen) fprintf(screen,"No /omp style for force computation currently active\n"); if (logfile) - fprintf(screen,"No /omp style for force computation currently active\n"); + fprintf(logfile,"No /omp style for force computation currently active\n"); } } } @@ -325,13 +322,17 @@ void FixOMP::pre_force(int) double *de = atom->de; double *drho = atom->drho; + if (_clearforce) { #if defined(_OPENMP) #pragma omp parallel default(none) shared(f,torque,erforce,de,drho) #endif - { - const int tid = get_tid(); - thr[tid]->check_tid(tid); - thr[tid]->init_force(nall,f,torque,erforce,de,drho); + { + const int tid = get_tid(); + thr[tid]->check_tid(tid); + thr[tid]->init_force(nall,f,torque,erforce,de,drho); + } + } else { + thr[0]->init_force(nall,f,torque,erforce,de,drho); } } diff --git a/src/USER-OMP/fix_omp.h b/src/USER-OMP/fix_omp.h index d797b08418..e651849984 100644 --- a/src/USER-OMP/fix_omp.h +++ b/src/USER-OMP/fix_omp.h @@ -37,17 +37,14 @@ class FixOMP : public Fix { virtual void init(); virtual void pre_force(int); - virtual void setup_pre_force(int vflag) { pre_force(vflag); }; - virtual void min_setup_pre_force(int vflag) { pre_force(vflag); }; - virtual void min_pre_force(int vflag) { pre_force(vflag); }; - virtual void setup_pre_force_respa(int vflag,int) { pre_force(vflag); }; - virtual void pre_force_respa(int vflag,int,int) { pre_force(vflag); }; + virtual void setup_pre_force(int vflag) { pre_force(vflag); } + virtual void min_setup_pre_force(int vflag) { pre_force(vflag); } + virtual void min_pre_force(int vflag) { pre_force(vflag); } + virtual void setup_pre_force_respa(int vflag,int) { pre_force(vflag); } + virtual void pre_force_respa(int vflag,int,int) { pre_force(vflag); } virtual double memory_usage(); - ThrData *get_thr(int tid) { return thr[tid]; }; - int get_nthr() const { return _nthr; } - protected: ThrData **thr; void *last_omp_style; // pointer to the style that needs @@ -56,13 +53,17 @@ class FixOMP : public Fix { // to call virial_fdot_compute() public: - bool get_neighbor() const {return _neighbor;}; - bool get_newton() const {return _newton;}; + ThrData *get_thr(int tid) { return thr[tid]; } + int get_nthr() const { return _nthr; } + + bool get_neighbor() const { return _neighbor; } + bool get_mixed() const { return _mixed; } private: int _nthr; // number of currently active ThrData object bool _neighbor; // en/disable threads for neighbor list construction - bool _newton; // en/disable newton's 3rd law for local atoms. + bool _clearforce; // whether to clear per thread data objects + bool _mixed; // whether to use a mixed precision compute kernel void set_neighbor_omp(); }; diff --git a/src/USER-OMP/improper_class2_omp.cpp b/src/USER-OMP/improper_class2_omp.cpp index 08f4a21e00..798d1db5aa 100644 --- a/src/USER-OMP/improper_class2_omp.cpp +++ b/src/USER-OMP/improper_class2_omp.cpp @@ -105,9 +105,9 @@ void ImproperClass2OMP::eval(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const improperlist = neighbor->improperlist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; for (i = 0; i < 3; i++) @@ -120,27 +120,27 @@ void ImproperClass2OMP::eval(int nfrom, int nto, ThrData * const thr) } for (n = nfrom; n < nto; n++) { - i1 = improperlist[n][0]; - i2 = improperlist[n][1]; - i3 = improperlist[n][2]; - i4 = improperlist[n][3]; - type = improperlist[n][4]; + i1 = improperlist[n].a; + i2 = improperlist[n].b; + i3 = improperlist[n].c; + i4 = improperlist[n].d; + type = improperlist[n].t; if (k0[type] == 0.0) continue; // difference vectors - delr[0][0] = x[i1][0] - x[i2][0]; - delr[0][1] = x[i1][1] - x[i2][1]; - delr[0][2] = x[i1][2] - x[i2][2]; + delr[0][0] = x[i1].x - x[i2].x; + delr[0][1] = x[i1].y - x[i2].y; + delr[0][2] = x[i1].z - x[i2].z; - delr[1][0] = x[i3][0] - x[i2][0]; - delr[1][1] = x[i3][1] - x[i2][1]; - delr[1][2] = x[i3][2] - x[i2][2]; + delr[1][0] = x[i3].x - x[i2].x; + delr[1][1] = x[i3].y - x[i2].y; + delr[1][2] = x[i3].z - x[i2].z; - delr[2][0] = x[i4][0] - x[i2][0]; - delr[2][1] = x[i4][1] - x[i2][1]; - delr[2][2] = x[i4][2] - x[i2][2]; + delr[2][0] = x[i4].x - x[i2].x; + delr[2][1] = x[i4].y - x[i2].y; + delr[2][2] = x[i4].z - x[i2].z; // bond lengths and associated values @@ -173,13 +173,13 @@ void ImproperClass2OMP::eval(int nfrom, int nto, ThrData * const thr) atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", - me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1].x,x[i1].y,x[i1].z); fprintf(screen," 2nd atom: %d %g %g %g\n", - me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2].x,x[i2].y,x[i2].z); fprintf(screen," 3rd atom: %d %g %g %g\n", - me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3].x,x[i3].y,x[i3].z); fprintf(screen," 4th atom: %d %g %g %g\n", - me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4].x,x[i4].y,x[i4].z); } } } @@ -468,27 +468,27 @@ void ImproperClass2OMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 4 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += fabcd[0][0]; - f[i1][1] += fabcd[0][1]; - f[i1][2] += fabcd[0][2]; + f[i1].x += fabcd[0][0]; + f[i1].y += fabcd[0][1]; + f[i1].z += fabcd[0][2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += fabcd[1][0]; - f[i2][1] += fabcd[1][1]; - f[i2][2] += fabcd[1][2]; + f[i2].x += fabcd[1][0]; + f[i2].y += fabcd[1][1]; + f[i2].z += fabcd[1][2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += fabcd[2][0]; - f[i3][1] += fabcd[2][1]; - f[i3][2] += fabcd[2][2]; + f[i3].x += fabcd[2][0]; + f[i3].y += fabcd[2][1]; + f[i3].z += fabcd[2][2]; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += fabcd[3][0]; - f[i4][1] += fabcd[3][1]; - f[i4][2] += fabcd[3][2]; + f[i4].x += fabcd[3][0]; + f[i4].y += fabcd[3][1]; + f[i4].z += fabcd[3][2]; } if (EVFLAG) @@ -522,31 +522,31 @@ void ImproperClass2OMP::angleangle_thr(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const improperlist = neighbor->improperlist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = improperlist[n][0]; - i2 = improperlist[n][1]; - i3 = improperlist[n][2]; - i4 = improperlist[n][3]; - type = improperlist[n][4]; + i1 = improperlist[n].a; + i2 = improperlist[n].b; + i3 = improperlist[n].c; + i4 = improperlist[n].d; + type = improperlist[n].t; // difference vectors - delxAB = x[i1][0] - x[i2][0]; - delyAB = x[i1][1] - x[i2][1]; - delzAB = x[i1][2] - x[i2][2]; + delxAB = x[i1].x - x[i2].x; + delyAB = x[i1].y - x[i2].y; + delzAB = x[i1].z - x[i2].z; - delxBC = x[i3][0] - x[i2][0]; - delyBC = x[i3][1] - x[i2][1]; - delzBC = x[i3][2] - x[i2][2]; + delxBC = x[i3].x - x[i2].x; + delyBC = x[i3].y - x[i2].y; + delzBC = x[i3].z - x[i2].z; - delxBD = x[i4][0] - x[i2][0]; - delyBD = x[i4][1] - x[i2][1]; - delzBD = x[i4][2] - x[i2][2]; + delxBD = x[i4].x - x[i2].x; + delyBD = x[i4].y - x[i2].y; + delzBD = x[i4].z - x[i2].z; // bond lengths @@ -667,27 +667,27 @@ void ImproperClass2OMP::angleangle_thr(int nfrom, int nto, ThrData * const thr) // apply force to each of 4 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += fabcd[0][0]; - f[i1][1] += fabcd[0][1]; - f[i1][2] += fabcd[0][2]; + f[i1].x += fabcd[0][0]; + f[i1].y += fabcd[0][1]; + f[i1].z += fabcd[0][2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += fabcd[1][0]; - f[i2][1] += fabcd[1][1]; - f[i2][2] += fabcd[1][2]; + f[i2].x += fabcd[1][0]; + f[i2].y += fabcd[1][1]; + f[i2].z += fabcd[1][2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += fabcd[2][0]; - f[i3][1] += fabcd[2][1]; - f[i3][2] += fabcd[2][2]; + f[i3].x += fabcd[2][0]; + f[i3].y += fabcd[2][1]; + f[i3].z += fabcd[2][2]; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += fabcd[3][0]; - f[i4][1] += fabcd[3][1]; - f[i4][2] += fabcd[3][2]; + f[i4].x += fabcd[3][0]; + f[i4].y += fabcd[3][1]; + f[i4].z += fabcd[3][2]; } if (EVFLAG) diff --git a/src/USER-OMP/improper_cossq_omp.cpp b/src/USER-OMP/improper_cossq_omp.cpp index c49cd0b3ce..0b28fb391a 100644 --- a/src/USER-OMP/improper_cossq_omp.cpp +++ b/src/USER-OMP/improper_cossq_omp.cpp @@ -90,34 +90,34 @@ void ImproperCossqOMP::eval(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const improperlist = neighbor->improperlist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = improperlist[n][0]; - i2 = improperlist[n][1]; - i3 = improperlist[n][2]; - i4 = improperlist[n][3]; - type = improperlist[n][4]; + i1 = improperlist[n].a; + i2 = improperlist[n].b; + i3 = improperlist[n].c; + i4 = improperlist[n].d; + type = improperlist[n].t; /* separation vector between i1 and i2, (i2-i1) */ - vb1x = x[i2][0] - x[i1][0]; - vb1y = x[i2][1] - x[i1][1]; - vb1z = x[i2][2] - x[i1][2]; + vb1x = x[i2].x - x[i1].x; + vb1y = x[i2].y - x[i1].y; + vb1z = x[i2].z - x[i1].z; rjisq = vb1x*vb1x + vb1y*vb1y + vb1z*vb1z ; rji = sqrt(rjisq); /* separation vector between i2 and i3 (i3-i2) */ - vb2x = x[i3][0] - x[i2][0]; - vb2y = x[i3][1] - x[i2][1]; - vb2z = x[i3][2] - x[i2][2]; + vb2x = x[i3].x - x[i2].x; + vb2y = x[i3].y - x[i2].y; + vb2z = x[i3].z - x[i2].z; /* separation vector between i3 and i4, (i4-i3) */ - vb3x = x[i4][0] - x[i3][0]; - vb3y = x[i4][1] - x[i3][1]; - vb3z = x[i4][2] - x[i3][2]; + vb3x = x[i4].x - x[i3].x; + vb3y = x[i4].y - x[i3].y; + vb3z = x[i4].z - x[i3].z; rlksq = vb3x*vb3x + vb3y*vb3y + vb3z*vb3z ; rlk = sqrt(rlksq); @@ -134,13 +134,13 @@ void ImproperCossqOMP::eval(int nfrom, int nto, ThrData * const thr) atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", - me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1].x,x[i1].y,x[i1].z); fprintf(screen," 2nd atom: %d %g %g %g\n", - me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2].x,x[i2].y,x[i2].z); fprintf(screen," 3rd atom: %d %g %g %g\n", - me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3].x,x[i3].y,x[i3].z); fprintf(screen," 4th atom: %d %g %g %g\n", - me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4].x,x[i4].y,x[i4].z); } @@ -236,27 +236,27 @@ void ImproperCossqOMP::eval(int nfrom, int nto, ThrData * const thr) /* Apply force to each of 4 atoms */ if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += f2[0]; - f[i2][1] += f2[1]; - f[i2][2] += f2[2]; + f[i2].x += f2[0]; + f[i2].y += f2[1]; + f[i2].z += f2[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += f4[0]; - f[i4][1] += f4[1]; - f[i4][2] += f4[2]; + f[i4].x += f4[0]; + f[i4].y += f4[1]; + f[i4].z += f4[2]; } if (EVFLAG) diff --git a/src/USER-OMP/improper_cvff_omp.cpp b/src/USER-OMP/improper_cvff_omp.cpp index 819a22b66e..7636f7c222 100644 --- a/src/USER-OMP/improper_cvff_omp.cpp +++ b/src/USER-OMP/improper_cvff_omp.cpp @@ -92,29 +92,29 @@ void ImproperCvffOMP::eval(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const improperlist = neighbor->improperlist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = improperlist[n][0]; - i2 = improperlist[n][1]; - i3 = improperlist[n][2]; - i4 = improperlist[n][3]; - type = improperlist[n][4]; + i1 = improperlist[n].a; + i2 = improperlist[n].b; + i3 = improperlist[n].c; + i4 = improperlist[n].d; + type = improperlist[n].t; // 1st bond - vb1x = x[i1][0] - x[i2][0]; - vb1y = x[i1][1] - x[i2][1]; - vb1z = x[i1][2] - x[i2][2]; + vb1x = x[i1].x - x[i2].x; + vb1y = x[i1].y - x[i2].y; + vb1z = x[i1].z - x[i2].z; // 2nd bond - vb2x = x[i3][0] - x[i2][0]; - vb2y = x[i3][1] - x[i2][1]; - vb2z = x[i3][2] - x[i2][2]; + vb2x = x[i3].x - x[i2].x; + vb2y = x[i3].y - x[i2].y; + vb2z = x[i3].z - x[i2].z; vb2xm = -vb2x; vb2ym = -vb2y; @@ -122,9 +122,9 @@ void ImproperCvffOMP::eval(int nfrom, int nto, ThrData * const thr) // 3rd bond - vb3x = x[i4][0] - x[i3][0]; - vb3y = x[i4][1] - x[i3][1]; - vb3z = x[i4][2] - x[i3][2]; + vb3x = x[i4].x - x[i3].x; + vb3y = x[i4].y - x[i3].y; + vb3z = x[i4].z - x[i3].z; // c0 calculation @@ -181,13 +181,13 @@ void ImproperCvffOMP::eval(int nfrom, int nto, ThrData * const thr) atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", - me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1].x,x[i1].y,x[i1].z); fprintf(screen," 2nd atom: %d %g %g %g\n", - me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2].x,x[i2].y,x[i2].z); fprintf(screen," 3rd atom: %d %g %g %g\n", - me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3].x,x[i3].y,x[i3].z); fprintf(screen," 4th atom: %d %g %g %g\n", - me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4].x,x[i4].y,x[i4].z); } } @@ -268,27 +268,27 @@ void ImproperCvffOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 4 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += f2[0]; - f[i2][1] += f2[1]; - f[i2][2] += f2[2]; + f[i2].x += f2[0]; + f[i2].y += f2[1]; + f[i2].z += f2[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += f4[0]; - f[i4][1] += f4[1]; - f[i4][2] += f4[2]; + f[i4].x += f4[0]; + f[i4].y += f4[1]; + f[i4].z += f4[2]; } if (EVFLAG) diff --git a/src/USER-OMP/improper_harmonic_omp.cpp b/src/USER-OMP/improper_harmonic_omp.cpp index 4ac8351a80..ad72cec97f 100644 --- a/src/USER-OMP/improper_harmonic_omp.cpp +++ b/src/USER-OMP/improper_harmonic_omp.cpp @@ -91,31 +91,31 @@ void ImproperHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const improperlist = neighbor->improperlist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = improperlist[n][0]; - i2 = improperlist[n][1]; - i3 = improperlist[n][2]; - i4 = improperlist[n][3]; - type = improperlist[n][4]; + i1 = improperlist[n].a; + i2 = improperlist[n].b; + i3 = improperlist[n].c; + i4 = improperlist[n].d; + type = improperlist[n].t; // geometry of 4-body - vb1x = x[i1][0] - x[i2][0]; - vb1y = x[i1][1] - x[i2][1]; - vb1z = x[i1][2] - x[i2][2]; + vb1x = x[i1].x - x[i2].x; + vb1y = x[i1].y - x[i2].y; + vb1z = x[i1].z - x[i2].z; - vb2x = x[i3][0] - x[i2][0]; - vb2y = x[i3][1] - x[i2][1]; - vb2z = x[i3][2] - x[i2][2]; + vb2x = x[i3].x - x[i2].x; + vb2y = x[i3].y - x[i2].y; + vb2z = x[i3].z - x[i2].z; - vb3x = x[i4][0] - x[i3][0]; - vb3y = x[i4][1] - x[i3][1]; - vb3z = x[i4][2] - x[i3][2]; + vb3x = x[i4].x - x[i3].x; + vb3y = x[i4].y - x[i3].y; + vb3z = x[i4].z - x[i3].z; ss1 = 1.0 / (vb1x*vb1x + vb1y*vb1y + vb1z*vb1z); ss2 = 1.0 / (vb2x*vb2x + vb2y*vb2y + vb2z*vb2z); @@ -154,13 +154,13 @@ void ImproperHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", - me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1].x,x[i1].y,x[i1].z); fprintf(screen," 2nd atom: %d %g %g %g\n", - me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2].x,x[i2].y,x[i2].z); fprintf(screen," 3rd atom: %d %g %g %g\n", - me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3].x,x[i3].y,x[i3].z); fprintf(screen," 4th atom: %d %g %g %g\n", - me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4].x,x[i4].y,x[i4].z); } } @@ -210,27 +210,27 @@ void ImproperHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 4 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]; - f[i1][1] += f1[1]; - f[i1][2] += f1[2]; + f[i1].x += f1[0]; + f[i1].y += f1[1]; + f[i1].z += f1[2]; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += f2[0]; - f[i2][1] += f2[1]; - f[i2][2] += f2[2]; + f[i2].x += f2[0]; + f[i2].y += f2[1]; + f[i2].z += f2[2]; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f3[0]; - f[i3][1] += f3[1]; - f[i3][2] += f3[2]; + f[i3].x += f3[0]; + f[i3].y += f3[1]; + f[i3].z += f3[2]; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += f4[0]; - f[i4][1] += f4[1]; - f[i4][2] += f4[2]; + f[i4].x += f4[0]; + f[i4].y += f4[1]; + f[i4].z += f4[2]; } if (EVFLAG) diff --git a/src/USER-OMP/improper_umbrella_omp.cpp b/src/USER-OMP/improper_umbrella_omp.cpp index 9a64da1fb1..dec4dce68a 100644 --- a/src/USER-OMP/improper_umbrella_omp.cpp +++ b/src/USER-OMP/improper_umbrella_omp.cpp @@ -90,35 +90,35 @@ void ImproperUmbrellaOMP::eval(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const * const improperlist = neighbor->improperlist; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; for (n = nfrom; n < nto; n++) { - i1 = improperlist[n][0]; - i2 = improperlist[n][1]; - i3 = improperlist[n][2]; - i4 = improperlist[n][3]; - type = improperlist[n][4]; + i1 = improperlist[n].a; + i2 = improperlist[n].b; + i3 = improperlist[n].c; + i4 = improperlist[n].d; + type = improperlist[n].t; // 1st bond - vb1x = x[i2][0] - x[i1][0]; - vb1y = x[i2][1] - x[i1][1]; - vb1z = x[i2][2] - x[i1][2]; + vb1x = x[i2].x - x[i1].x; + vb1y = x[i2].y - x[i1].y; + vb1z = x[i2].z - x[i1].z; // 2nd bond - vb2x = x[i3][0] - x[i1][0]; - vb2y = x[i3][1] - x[i1][1]; - vb2z = x[i3][2] - x[i1][2]; + vb2x = x[i3].x - x[i1].x; + vb2y = x[i3].y - x[i1].y; + vb2z = x[i3].z - x[i1].z; // 3rd bond - vb3x = x[i4][0] - x[i1][0]; - vb3y = x[i4][1] - x[i1][1]; - vb3z = x[i4][2] - x[i1][2]; + vb3x = x[i4].x - x[i1].x; + vb3y = x[i4].y - x[i1].y; + vb3z = x[i4].z - x[i1].z; // c0 calculation // A = vb1 X vb2 is perpendicular to IJK plane @@ -156,13 +156,13 @@ void ImproperUmbrellaOMP::eval(int nfrom, int nto, ThrData * const thr) atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str,0); fprintf(screen," 1st atom: %d %g %g %g\n", - me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1].x,x[i1].y,x[i1].z); fprintf(screen," 2nd atom: %d %g %g %g\n", - me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2].x,x[i2].y,x[i2].z); fprintf(screen," 3rd atom: %d %g %g %g\n", - me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3].x,x[i3].y,x[i3].z); fprintf(screen," 4th atom: %d %g %g %g\n", - me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4].x,x[i4].y,x[i4].z); } } @@ -226,27 +226,27 @@ void ImproperUmbrellaOMP::eval(int nfrom, int nto, ThrData * const thr) // apply force to each of 4 atoms if (NEWTON_BOND || i1 < nlocal) { - f[i1][0] += f1[0]*a; - f[i1][1] += f1[1]*a; - f[i1][2] += f1[2]*a; + f[i1].x += f1[0]*a; + f[i1].y += f1[1]*a; + f[i1].z += f1[2]*a; } if (NEWTON_BOND || i2 < nlocal) { - f[i2][0] += f3[0]*a; - f[i2][1] += f3[1]*a; - f[i2][2] += f3[2]*a; + f[i2].x += f3[0]*a; + f[i2].y += f3[1]*a; + f[i2].z += f3[2]*a; } if (NEWTON_BOND || i3 < nlocal) { - f[i3][0] += f2[0]*a; - f[i3][1] += f2[1]*a; - f[i3][2] += f2[2]*a; + f[i3].x += f2[0]*a; + f[i3].y += f2[1]*a; + f[i3].z += f2[2]*a; } if (NEWTON_BOND || i4 < nlocal) { - f[i4][0] += f4[0]*a; - f[i4][1] += f4[1]*a; - f[i4][2] += f4[2]*a; + f[i4].x += f4[0]*a; + f[i4].y += f4[1]*a; + f[i4].z += f4[2]*a; } if (EVFLAG) diff --git a/src/USER-OMP/msm_omp.cpp b/src/USER-OMP/msm_omp.cpp index 80c9d1e507..480e52ce2f 100755 --- a/src/USER-OMP/msm_omp.cpp +++ b/src/USER-OMP/msm_omp.cpp @@ -115,42 +115,44 @@ void MSMOMP::direct(int n) } template -void MSMOMP::direct_eval(const int n) +void MSMOMP::direct_eval(const int nn) { - double * const * const * const egridn = egrid[n]; - const double * const * const * const qgridn = qgrid[n]; - const double * const g_directn = g_direct[n]; - const double * const v0_directn = v0_direct[n]; - const double * const v1_directn = v1_direct[n]; - const double * const v2_directn = v2_direct[n]; - const double * const v3_directn = v3_direct[n]; - const double * const v4_directn = v4_direct[n]; - const double * const v5_directn = v5_direct[n]; + double * _noalias const * _noalias const * _noalias const egridn = egrid[nn]; + const double * _noalias const * _noalias const * _noalias const qgridn = qgrid[nn]; + const double * _noalias const g_directn = g_direct[nn]; + const double * _noalias const v0_directn = v0_direct[nn]; + const double * _noalias const v1_directn = v1_direct[nn]; + const double * _noalias const v2_directn = v2_direct[nn]; + const double * _noalias const v3_directn = v3_direct[nn]; + const double * _noalias const v4_directn = v4_direct[nn]; + const double * _noalias const v5_directn = v5_direct[nn]; double v0,v1,v2,v3,v4,v5,emsm; v0 = v1 = v2 = v3 = v4 = v5 = emsm = 0.0; - const int alphan = alpha[n]; - const int betaxn = betax[n]; - const int betayn = betay[n]; - const int betazn = betaz[n]; + const int alphan = alpha[nn]; + const int betaxn = betax[nn]; + const int betayn = betay[nn]; + const int betazn = betaz[nn]; const int nx = nxhi_direct - nxlo_direct + 1; const int ny = nyhi_direct - nylo_direct + 1; // merge three outer loops into one for better threading - const int nzlo_inn = nzlo_in[n]; - const int nylo_inn = nylo_in[n]; - const int nxlo_inn = nxlo_in[n]; - const int numz = nzhi_in[n] - nzlo_inn + 1; - const int numy = nyhi_in[n] - nylo_inn + 1; - const int numx = nxhi_in[n] - nxlo_inn + 1; + const int nzlo_inn = nzlo_in[nn]; + const int nylo_inn = nylo_in[nn]; + const int nxlo_inn = nxlo_in[nn]; + const int numz = nzhi_in[nn] - nzlo_inn + 1; + const int numy = nyhi_in[nn] - nylo_inn + 1; + const int numx = nxhi_in[nn] - nxlo_inn + 1; const int inum = numz*numy*numx; const int zper = domain->zperiodic; const int yper = domain->yperiodic; const int xper = domain->xperiodic; + const int n=nn; + #if defined(_OPENMP) #pragma omp parallel default(none) reduction(+:v0,v1,v2,v3,v4,v5,emsm) #endif @@ -188,8 +190,9 @@ void MSMOMP::direct_eval(const int n) for (iy = jmin; iy <= jmax; iy++) { const int jj = icy+iy; const int zyk = (zk + iy + nyhi_direct)*nx; + const double * _noalias const qgridnkj = & qgridn[kk][jj][icx]; for (ix = imin; ix <= imax; ix++) { - qtmp = qgridn[kk][jj][icx+ix]; + qtmp = qgridnkj[ix]; k = zyk + ix + nxhi_direct; esum += g_directn[k] * qtmp; diff --git a/src/USER-OMP/pair_adp_omp.cpp b/src/USER-OMP/pair_adp_omp.cpp index 4d05b16c70..9758aa317d 100644 --- a/src/USER-OMP/pair_adp_omp.cpp +++ b/src/USER-OMP/pair_adp_omp.cpp @@ -110,11 +110,11 @@ void PairADPOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - double * const rho_t = thr->get_rho(); - double * const * const mu_t = thr->get_mu(); - double * const * const lambda_t = thr->get_lambda(); + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + double * _noalias const rho_t = thr->get_rho(); + dbl3_t * _noalias const mu_t = (dbl3_t *) thr->get_mu()[0]; + double * const * _noalias const lambda_t = thr->get_lambda(); const int tid = thr->get_tid(); int *type = atom->type; @@ -132,9 +132,9 @@ void PairADPOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ii++) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -143,9 +143,9 @@ void PairADPOMP::eval(int iifrom, int iito, ThrData * const thr) j = jlist[jj]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; if (rsq < cutforcesq) { @@ -159,9 +159,9 @@ void PairADPOMP::eval(int iifrom, int iito, ThrData * const thr) rho_t[i] += ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6]; coeff = u2r_spline[type2u2r[jtype][itype]][m]; u2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6]; - mu_t[i][0] += u2*delx; - mu_t[i][1] += u2*dely; - mu_t[i][2] += u2*delz; + mu_t[i].x += u2*delx; + mu_t[i].y += u2*dely; + mu_t[i].z += u2*delz; coeff = w2r_spline[type2w2r[jtype][itype]][m]; w2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6]; lambda_t[i][0] += w2*delx*delx; @@ -177,9 +177,9 @@ void PairADPOMP::eval(int iifrom, int iito, ThrData * const thr) rho_t[j] += ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6]; coeff = u2r_spline[type2u2r[itype][jtype]][m]; u2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6]; - mu_t[j][0] -= u2*delx; - mu_t[j][1] -= u2*dely; - mu_t[j][2] -= u2*delz; + mu_t[j].x -= u2*delx; + mu_t[j].y -= u2*dely; + mu_t[j].z -= u2*delz; coeff = w2r_spline[type2w2r[itype][jtype]][m]; w2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6]; lambda_t[j][0] += w2*delx*delx; @@ -200,9 +200,9 @@ void PairADPOMP::eval(int iifrom, int iito, ThrData * const thr) if (NEWTON_PAIR) { // reduce per thread density - data_reduce_thr(&(rho[0]), nall, comm->nthreads, 1, tid); - data_reduce_thr(&(mu[0][0]), nall, comm->nthreads, 3, tid); - data_reduce_thr(&(lambda[0][0]), nall, comm->nthreads, 6, tid); + data_reduce_thr(&(rho_t[0]), nall, comm->nthreads, 1, tid); + data_reduce_thr(&(mu_t[0].x), nall, comm->nthreads, 3, tid); + data_reduce_thr(&(lambda_t[0][0]), nall, comm->nthreads, 6, tid); // wait until reduction is complete sync_threads(); @@ -217,9 +217,9 @@ void PairADPOMP::eval(int iifrom, int iito, ThrData * const thr) } else { // reduce per thread density - data_reduce_thr(&(rho[0]), nlocal, comm->nthreads, 1, tid); - data_reduce_thr(&(mu[0][0]), nlocal, comm->nthreads, 3, tid); - data_reduce_thr(&(lambda[0][0]), nlocal, comm->nthreads, 6, tid); + data_reduce_thr(&(rho_t[0]), nlocal, comm->nthreads, 1, tid); + data_reduce_thr(&(mu_t[0].x), nlocal, comm->nthreads, 3, tid); + data_reduce_thr(&(lambda_t[0][0]), nlocal, comm->nthreads, 6, tid); // wait until reduction is complete sync_threads(); @@ -239,13 +239,13 @@ void PairADPOMP::eval(int iifrom, int iito, ThrData * const thr) fp[i] = (coeff[0]*p + coeff[1])*p + coeff[2]; if (EFLAG) { phi = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6]; - phi += 0.5*(mu[i][0]*mu[i][0]+mu[i][1]*mu[i][1]+mu[i][2]*mu[i][2]); - phi += 0.5*(lambda[i][0]*lambda[i][0]+lambda[i][1]* - lambda[i][1]+lambda[i][2]*lambda[i][2]); - phi += 1.0*(lambda[i][3]*lambda[i][3]+lambda[i][4]* - lambda[i][4]+lambda[i][5]*lambda[i][5]); - phi -= 1.0/6.0*(lambda[i][0]+lambda[i][1]+lambda[i][2])* - (lambda[i][0]+lambda[i][1]+lambda[i][2]); + phi += 0.5*(mu_t[i].x*mu_t[i].x+mu_t[i].y*mu_t[i].y+mu_t[i].z*mu_t[i].z); + phi += 0.5*(lambda_t[i][0]*lambda_t[i][0]+lambda_t[i][1]* + lambda_t[i][1]+lambda_t[i][2]*lambda_t[i][2]); + phi += 1.0*(lambda_t[i][3]*lambda_t[i][3]+lambda_t[i][4]* + lambda_t[i][4]+lambda_t[i][5]*lambda_t[i][5]); + phi -= 1.0/6.0*(lambda_t[i][0]+lambda_t[i][1]+lambda_t[i][2])* + (lambda_t[i][0]+lambda_t[i][1]+lambda_t[i][2]); e_tally_thr(this,i,i,nlocal,/* newton_pair */ 1, phi, 0.0, thr); } } @@ -268,9 +268,9 @@ void PairADPOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ii++) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; fxtmp = fytmp = fztmp = 0.0; @@ -281,9 +281,9 @@ void PairADPOMP::eval(int iifrom, int iito, ThrData * const thr) j = jlist[jj]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; if (rsq < cutforcesq) { @@ -329,16 +329,16 @@ void PairADPOMP::eval(int iifrom, int iito, ThrData * const thr) psip = fp[i]*rhojp + fp[j]*rhoip + phip; fpair = -psip*recip; - delmux = mu[i][0]-mu[j][0]; - delmuy = mu[i][1]-mu[j][1]; - delmuz = mu[i][2]-mu[j][2]; + delmux = mu_t[i].x-mu_t[j].x; + delmuy = mu_t[i].y-mu_t[j].y; + delmuz = mu_t[i].z-mu_t[j].z; trdelmu = delmux*delx+delmuy*dely+delmuz*delz; - sumlamxx = lambda[i][0]+lambda[j][0]; - sumlamyy = lambda[i][1]+lambda[j][1]; - sumlamzz = lambda[i][2]+lambda[j][2]; - sumlamyz = lambda[i][3]+lambda[j][3]; - sumlamxz = lambda[i][4]+lambda[j][4]; - sumlamxy = lambda[i][5]+lambda[j][5]; + sumlamxx = lambda_t[i][0]+lambda_t[j][0]; + sumlamyy = lambda_t[i][1]+lambda_t[j][1]; + sumlamzz = lambda_t[i][2]+lambda_t[j][2]; + sumlamyz = lambda_t[i][3]+lambda_t[j][3]; + sumlamxz = lambda_t[i][4]+lambda_t[j][4]; + sumlamxy = lambda_t[i][5]+lambda_t[j][5]; tradellam = sumlamxx*delx*delx+sumlamyy*dely*dely+ sumlamzz*delz*delz+2.0*sumlamxy*delx*dely+ 2.0*sumlamxz*delx*delz+2.0*sumlamyz*dely*delz; @@ -363,9 +363,9 @@ void PairADPOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += fy; fztmp += fz; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= fx; - f[j][1] -= fy; - f[j][2] -= fz; + f[j].x -= fx; + f[j].y -= fy; + f[j].z -= fz; } if (EFLAG) evdwl = phi; @@ -373,9 +373,9 @@ void PairADPOMP::eval(int iifrom, int iito, ThrData * const thr) fx,fy,fz,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_beck_omp.cpp b/src/USER-OMP/pair_beck_omp.cpp index 50c27862d1..d314ab3f1d 100644 --- a/src/USER-OMP/pair_beck_omp.cpp +++ b/src/USER-OMP/pair_beck_omp.cpp @@ -86,8 +86,8 @@ void PairBeckOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; int *type = atom->type; int nlocal = atom->nlocal; double *special_lj = force->special_lj; @@ -102,9 +102,9 @@ void PairBeckOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -115,9 +115,9 @@ void PairBeckOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -138,13 +138,13 @@ void PairBeckOMP::eval(int iifrom, int iito, ThrData * const thr) fpair = factor_lj*force_beck*rinv; - f[i][0] += delx*fpair; - f[i][1] += dely*fpair; - f[i][2] += delz*fpair; + f[i].x += delx*fpair; + f[i].y += dely*fpair; + f[i].z += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -158,9 +158,9 @@ void PairBeckOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_born_coul_long_omp.cpp b/src/USER-OMP/pair_born_coul_long_omp.cpp index f627f19bac..099fadd98b 100644 --- a/src/USER-OMP/pair_born_coul_long_omp.cpp +++ b/src/USER-OMP/pair_born_coul_long_omp.cpp @@ -92,10 +92,10 @@ void PairBornCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; int nlocal = atom->nlocal; double *special_coul = force->special_coul; double *special_lj = force->special_lj; @@ -112,9 +112,9 @@ void PairBornCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -126,9 +126,9 @@ void PairBornCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -159,9 +159,9 @@ void PairBornCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -180,9 +180,9 @@ void PairBornCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_born_coul_msm_omp.cpp b/src/USER-OMP/pair_born_coul_msm_omp.cpp index dc3bf07fea..950e20e326 100755 --- a/src/USER-OMP/pair_born_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_born_coul_msm_omp.cpp @@ -85,10 +85,10 @@ void PairBornCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; int nlocal = atom->nlocal; double *special_coul = force->special_coul; double *special_lj = force->special_lj; @@ -105,9 +105,9 @@ void PairBornCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -119,9 +119,9 @@ void PairBornCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -150,9 +150,9 @@ void PairBornCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -171,9 +171,9 @@ void PairBornCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_born_coul_wolf_omp.cpp b/src/USER-OMP/pair_born_coul_wolf_omp.cpp index 35e0ac7443..761e313e7f 100644 --- a/src/USER-OMP/pair_born_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_born_coul_wolf_omp.cpp @@ -88,10 +88,10 @@ void PairBornCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; int nlocal = atom->nlocal; double *special_coul = force->special_coul; double *special_lj = force->special_lj; @@ -115,9 +115,9 @@ void PairBornCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -133,9 +133,9 @@ void PairBornCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -166,9 +166,9 @@ void PairBornCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -187,9 +187,9 @@ void PairBornCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_born_omp.cpp b/src/USER-OMP/pair_born_omp.cpp index 847efaa013..e17b2fbe94 100644 --- a/src/USER-OMP/pair_born_omp.cpp +++ b/src/USER-OMP/pair_born_omp.cpp @@ -81,8 +81,8 @@ void PairBornOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; int *type = atom->type; int nlocal = atom->nlocal; double *special_lj = force->special_lj; @@ -97,9 +97,9 @@ void PairBornOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -110,9 +110,9 @@ void PairBornOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -129,9 +129,9 @@ void PairBornOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -144,9 +144,9 @@ void PairBornOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_buck_coul_cut_omp.cpp b/src/USER-OMP/pair_buck_coul_cut_omp.cpp index 8b570ff1a0..9590fcea6d 100644 --- a/src/USER-OMP/pair_buck_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_cut_omp.cpp @@ -82,9 +82,9 @@ void PairBuckCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; int *type = atom->type; int nlocal = atom->nlocal; double *special_coul = force->special_coul; @@ -102,9 +102,9 @@ void PairBuckCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -116,9 +116,9 @@ void PairBuckCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -142,9 +142,9 @@ void PairBuckCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -162,9 +162,9 @@ void PairBuckCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_buck_coul_long_omp.cpp b/src/USER-OMP/pair_buck_coul_long_omp.cpp index 85f2b48db9..6c52768ce7 100644 --- a/src/USER-OMP/pair_buck_coul_long_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_long_omp.cpp @@ -93,9 +93,9 @@ void PairBuckCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; int *type = atom->type; int nlocal = atom->nlocal; double *special_coul = force->special_coul; @@ -113,9 +113,9 @@ void PairBuckCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -127,9 +127,9 @@ void PairBuckCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -159,9 +159,9 @@ void PairBuckCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -180,9 +180,9 @@ void PairBuckCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_buck_coul_msm_omp.cpp b/src/USER-OMP/pair_buck_coul_msm_omp.cpp index 46f230edb0..16dcc5de22 100755 --- a/src/USER-OMP/pair_buck_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_msm_omp.cpp @@ -86,9 +86,9 @@ void PairBuckCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; int *type = atom->type; int nlocal = atom->nlocal; double *special_coul = force->special_coul; @@ -106,9 +106,9 @@ void PairBuckCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -120,9 +120,9 @@ void PairBuckCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -150,9 +150,9 @@ void PairBuckCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -171,9 +171,9 @@ void PairBuckCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_buck_omp.cpp b/src/USER-OMP/pair_buck_omp.cpp index 8b32e2cfa5..f4a014be69 100644 --- a/src/USER-OMP/pair_buck_omp.cpp +++ b/src/USER-OMP/pair_buck_omp.cpp @@ -81,8 +81,8 @@ void PairBuckOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; int *type = atom->type; int nlocal = atom->nlocal; double *special_lj = force->special_lj; @@ -97,9 +97,9 @@ void PairBuckOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -110,9 +110,9 @@ void PairBuckOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -131,9 +131,9 @@ void PairBuckOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -146,9 +146,9 @@ void PairBuckOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_cdeam_omp.cpp b/src/USER-OMP/pair_cdeam_omp.cpp index bec3ce4b25..828cf53251 100644 --- a/src/USER-OMP/pair_cdeam_omp.cpp +++ b/src/USER-OMP/pair_cdeam_omp.cpp @@ -148,15 +148,15 @@ void PairCDEAMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; double * const rho_t = thr->get_rho(); double * const rhoB_t = thr->get_rhoB(); double * const D_values_t = thr->get_D_values(); const int tid = thr->get_tid(); const int nthreads = comm->nthreads; - const int * const type = atom->type; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const int nall = nlocal + atom->nghost; @@ -174,9 +174,9 @@ void PairCDEAMOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ii++) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -185,9 +185,9 @@ void PairCDEAMOMP::eval(int iifrom, int iito, ThrData * const thr) j = jlist[jj]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; if(rsq < cutforcesq) { @@ -299,9 +299,9 @@ void PairCDEAMOMP::eval(int iifrom, int iito, ThrData * const thr) // Compute intermediate value D_i for each atom. for (ii = iifrom; ii < iito; ii++) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -320,9 +320,9 @@ void PairCDEAMOMP::eval(int iifrom, int iito, ThrData * const thr) // This code line is required for ternary alloys. if(jtype != speciesA && jtype != speciesB) continue; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; if(rsq < cutforcesq) { @@ -382,9 +382,9 @@ void PairCDEAMOMP::eval(int iifrom, int iito, ThrData * const thr) // Compute force acting on each atom. for (ii = iifrom; ii < iito; ii++) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; fxtmp = fytmp = fztmp = 0.0; @@ -417,9 +417,9 @@ void PairCDEAMOMP::eval(int iifrom, int iito, ThrData * const thr) j = jlist[jj]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; if(rsq < cutforcesq) { @@ -504,9 +504,9 @@ void PairCDEAMOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if(NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if(EFLAG) evdwl = phi; @@ -514,9 +514,9 @@ void PairCDEAMOMP::eval(int iifrom, int iito, ThrData * const thr) fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_colloid_omp.cpp b/src/USER-OMP/pair_colloid_omp.cpp index e27ebb7b91..7131d8c541 100644 --- a/src/USER-OMP/pair_colloid_omp.cpp +++ b/src/USER-OMP/pair_colloid_omp.cpp @@ -85,12 +85,12 @@ void PairColloidOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const int tid = thr->get_tid(); - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -102,9 +102,9 @@ void PairColloidOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -115,9 +115,9 @@ void PairColloidOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -203,17 +203,17 @@ void PairColloidOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EVFLAG) ev_tally_thr(this, i,j,nlocal,NEWTON_PAIR, evdwl,0.0,fpair,delx,dely,delz,thr); } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_coul_cut_omp.cpp b/src/USER-OMP/pair_coul_cut_omp.cpp index 37b311f93e..db5c341f00 100644 --- a/src/USER-OMP/pair_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_coul_cut_omp.cpp @@ -83,12 +83,12 @@ void PairCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; + const double * _noalias const special_coul = force->special_coul; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp; @@ -102,9 +102,9 @@ void PairCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -115,9 +115,9 @@ void PairCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -131,9 +131,9 @@ void PairCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) @@ -143,9 +143,9 @@ void PairCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) 0.0,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_coul_debye_omp.cpp b/src/USER-OMP/pair_coul_debye_omp.cpp index 4c8aaba007..d4a2538420 100644 --- a/src/USER-OMP/pair_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_coul_debye_omp.cpp @@ -83,12 +83,12 @@ void PairCoulDebyeOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; + const double * _noalias const special_coul = force->special_coul; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp; @@ -102,9 +102,9 @@ void PairCoulDebyeOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -115,9 +115,9 @@ void PairCoulDebyeOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -133,9 +133,9 @@ void PairCoulDebyeOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) @@ -145,9 +145,9 @@ void PairCoulDebyeOMP::eval(int iifrom, int iito, ThrData * const thr) 0.0,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_coul_diel_omp.cpp b/src/USER-OMP/pair_coul_diel_omp.cpp index c583800004..8a02be5cb3 100644 --- a/src/USER-OMP/pair_coul_diel_omp.cpp +++ b/src/USER-OMP/pair_coul_diel_omp.cpp @@ -83,12 +83,12 @@ void PairCoulDielOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; + const double * _noalias const special_coul = force->special_coul; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp; @@ -102,9 +102,9 @@ void PairCoulDielOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -116,9 +116,9 @@ void PairCoulDielOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -136,9 +136,9 @@ void PairCoulDielOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -150,9 +150,9 @@ void PairCoulDielOMP::eval(int iifrom, int iito, ThrData * const thr) 0.0,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_coul_long_omp.cpp b/src/USER-OMP/pair_coul_long_omp.cpp index 5ae5478755..069fb4d186 100644 --- a/src/USER-OMP/pair_coul_long_omp.cpp +++ b/src/USER-OMP/pair_coul_long_omp.cpp @@ -94,12 +94,12 @@ void PairCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; + const double * _noalias const special_coul = force->special_coul; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp; @@ -113,9 +113,9 @@ void PairCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -126,9 +126,9 @@ void PairCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -164,9 +164,9 @@ void PairCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -183,9 +183,9 @@ void PairCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) 0.0,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_coul_msm_omp.cpp b/src/USER-OMP/pair_coul_msm_omp.cpp index 663fb47d3e..8d965afa62 100755 --- a/src/USER-OMP/pair_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_coul_msm_omp.cpp @@ -87,12 +87,12 @@ void PairCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; + const double * _noalias const special_coul = force->special_coul; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp; @@ -106,9 +106,9 @@ void PairCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -119,9 +119,9 @@ void PairCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -155,9 +155,9 @@ void PairCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -174,9 +174,9 @@ void PairCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) 0.0,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_coul_wolf_omp.cpp b/src/USER-OMP/pair_coul_wolf_omp.cpp index 16e0c4ed90..abfdef1073 100644 --- a/src/USER-OMP/pair_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_coul_wolf_omp.cpp @@ -88,12 +88,12 @@ void PairCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; + const double * _noalias const special_coul = force->special_coul; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp; @@ -114,9 +114,9 @@ void PairCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; jlist = firstneigh[i]; jnum = numneigh[i]; fxtmp=fytmp=fztmp=0.0; @@ -130,9 +130,9 @@ void PairCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; if (rsq < cut_coulsq) { @@ -150,9 +150,9 @@ void PairCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -166,9 +166,9 @@ void PairCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) 0.0,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_dipole_cut_omp.cpp b/src/USER-OMP/pair_dipole_cut_omp.cpp index 34d7e6c17e..69a0f5a01e 100644 --- a/src/USER-OMP/pair_dipole_cut_omp.cpp +++ b/src/USER-OMP/pair_dipole_cut_omp.cpp @@ -85,15 +85,15 @@ void PairDipoleCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; double * const * const torque = thr->get_torque(); - const double * const q = atom->q; - const double * const * const mu = atom->mu; - const int * const type = atom->type; + const double * _noalias const q = atom->q; + const dbl4_t * _noalias const mu = (dbl4_t *) atom->mu[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; - const double * const special_lj = force->special_lj; + const double * _noalias const special_coul = force->special_coul; + const double * _noalias const special_lj = force->special_lj; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp,t1tmp,t2tmp,t3tmp; @@ -106,9 +106,9 @@ void PairDipoleCutOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; qtmp = q[i]; itype = type[i]; jlist = firstneigh[i]; @@ -121,9 +121,9 @@ void PairDipoleCutOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -149,64 +149,64 @@ void PairDipoleCutOMP::eval(int iifrom, int iito, ThrData * const thr) forcecoulz += pre1*delz; } - if (mu[i][3] > 0.0 && mu[j][3] > 0.0) { + if (mu[i].w > 0.0 && mu[j].w > 0.0) { r3inv = r2inv*rinv; r5inv = r3inv*r2inv; r7inv = r5inv*r2inv; - pdotp = mu[i][0]*mu[j][0] + mu[i][1]*mu[j][1] + mu[i][2]*mu[j][2]; - pidotr = mu[i][0]*delx + mu[i][1]*dely + mu[i][2]*delz; - pjdotr = mu[j][0]*delx + mu[j][1]*dely + mu[j][2]*delz; + pdotp = mu[i].x*mu[j].x + mu[i].y*mu[j].y + mu[i].z*mu[j].z; + pidotr = mu[i].x*delx + mu[i].y*dely + mu[i].z*delz; + pjdotr = mu[j].x*delx + mu[j].y*dely + mu[j].z*delz; pre1 = 3.0*r5inv*pdotp - 15.0*r7inv*pidotr*pjdotr; pre2 = 3.0*r5inv*pjdotr; pre3 = 3.0*r5inv*pidotr; pre4 = -1.0*r3inv; - forcecoulx += pre1*delx + pre2*mu[i][0] + pre3*mu[j][0]; - forcecouly += pre1*dely + pre2*mu[i][1] + pre3*mu[j][1]; - forcecoulz += pre1*delz + pre2*mu[i][2] + pre3*mu[j][2]; + forcecoulx += pre1*delx + pre2*mu[i].x + pre3*mu[j].x; + forcecouly += pre1*dely + pre2*mu[i].y + pre3*mu[j].y; + forcecoulz += pre1*delz + pre2*mu[i].z + pre3*mu[j].z; - crossx = pre4 * (mu[i][1]*mu[j][2] - mu[i][2]*mu[j][1]); - crossy = pre4 * (mu[i][2]*mu[j][0] - mu[i][0]*mu[j][2]); - crossz = pre4 * (mu[i][0]*mu[j][1] - mu[i][1]*mu[j][0]); + crossx = pre4 * (mu[i].y*mu[j].z - mu[i].z*mu[j].y); + crossy = pre4 * (mu[i].z*mu[j].x - mu[i].x*mu[j].z); + crossz = pre4 * (mu[i].x*mu[j].y - mu[i].y*mu[j].x); - tixcoul += crossx + pre2 * (mu[i][1]*delz - mu[i][2]*dely); - tiycoul += crossy + pre2 * (mu[i][2]*delx - mu[i][0]*delz); - tizcoul += crossz + pre2 * (mu[i][0]*dely - mu[i][1]*delx); - tjxcoul += -crossx + pre3 * (mu[j][1]*delz - mu[j][2]*dely); - tjycoul += -crossy + pre3 * (mu[j][2]*delx - mu[j][0]*delz); - tjzcoul += -crossz + pre3 * (mu[j][0]*dely - mu[j][1]*delx); + tixcoul += crossx + pre2 * (mu[i].y*delz - mu[i].z*dely); + tiycoul += crossy + pre2 * (mu[i].z*delx - mu[i].x*delz); + tizcoul += crossz + pre2 * (mu[i].x*dely - mu[i].y*delx); + tjxcoul += -crossx + pre3 * (mu[j].y*delz - mu[j].z*dely); + tjycoul += -crossy + pre3 * (mu[j].z*delx - mu[j].x*delz); + tjzcoul += -crossz + pre3 * (mu[j].x*dely - mu[j].y*delx); } - if (mu[i][3] > 0.0 && q[j] != 0.0) { + if (mu[i].w > 0.0 && q[j] != 0.0) { r3inv = r2inv*rinv; r5inv = r3inv*r2inv; - pidotr = mu[i][0]*delx + mu[i][1]*dely + mu[i][2]*delz; + pidotr = mu[i].x*delx + mu[i].y*dely + mu[i].z*delz; pre1 = 3.0*q[j]*r5inv * pidotr; pre2 = q[j]*r3inv; - forcecoulx += pre2*mu[i][0] - pre1*delx; - forcecouly += pre2*mu[i][1] - pre1*dely; - forcecoulz += pre2*mu[i][2] - pre1*delz; - tixcoul += pre2 * (mu[i][1]*delz - mu[i][2]*dely); - tiycoul += pre2 * (mu[i][2]*delx - mu[i][0]*delz); - tizcoul += pre2 * (mu[i][0]*dely - mu[i][1]*delx); + forcecoulx += pre2*mu[i].x - pre1*delx; + forcecouly += pre2*mu[i].y - pre1*dely; + forcecoulz += pre2*mu[i].z - pre1*delz; + tixcoul += pre2 * (mu[i].y*delz - mu[i].z*dely); + tiycoul += pre2 * (mu[i].z*delx - mu[i].x*delz); + tizcoul += pre2 * (mu[i].x*dely - mu[i].y*delx); } - if (mu[j][3] > 0.0 && qtmp != 0.0) { + if (mu[j].w > 0.0 && qtmp != 0.0) { r3inv = r2inv*rinv; r5inv = r3inv*r2inv; - pjdotr = mu[j][0]*delx + mu[j][1]*dely + mu[j][2]*delz; + pjdotr = mu[j].x*delx + mu[j].y*dely + mu[j].z*delz; pre1 = 3.0*qtmp*r5inv * pjdotr; pre2 = qtmp*r3inv; - forcecoulx += pre1*delx - pre2*mu[j][0]; - forcecouly += pre1*dely - pre2*mu[j][1]; - forcecoulz += pre1*delz - pre2*mu[j][2]; - tjxcoul += -pre2 * (mu[j][1]*delz - mu[j][2]*dely); - tjycoul += -pre2 * (mu[j][2]*delx - mu[j][0]*delz); - tjzcoul += -pre2 * (mu[j][0]*dely - mu[j][1]*delx); + forcecoulx += pre1*delx - pre2*mu[j].x; + forcecouly += pre1*dely - pre2*mu[j].y; + forcecoulz += pre1*delz - pre2*mu[j].z; + tjxcoul += -pre2 * (mu[j].y*delz - mu[j].z*dely); + tjycoul += -pre2 * (mu[j].z*delx - mu[j].x*delz); + tjzcoul += -pre2 * (mu[j].x*dely - mu[j].y*delx); } } @@ -235,9 +235,9 @@ void PairDipoleCutOMP::eval(int iifrom, int iito, ThrData * const thr) t3tmp += fq*tizcoul; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= fx; - f[j][1] -= fy; - f[j][2] -= fz; + f[j].x -= fx; + f[j].y -= fy; + f[j].z -= fz; torque[j][0] += fq*tjxcoul; torque[j][1] += fq*tjycoul; torque[j][2] += fq*tjzcoul; @@ -246,11 +246,11 @@ void PairDipoleCutOMP::eval(int iifrom, int iito, ThrData * const thr) if (EFLAG) { if (rsq < cut_coulsq[itype][jtype]) { ecoul = qtmp*q[j]*rinv; - if (mu[i][3] > 0.0 && mu[j][3] > 0.0) + if (mu[i].w > 0.0 && mu[j].w > 0.0) ecoul += r3inv*pdotp - 3.0*r5inv*pidotr*pjdotr; - if (mu[i][3] > 0.0 && q[j] != 0.0) + if (mu[i].w > 0.0 && q[j] != 0.0) ecoul += -q[j]*r3inv*pidotr; - if (mu[j][3] > 0.0 && qtmp != 0.0) + if (mu[j].w > 0.0 && qtmp != 0.0) ecoul += qtmp*r3inv*pjdotr; ecoul *= factor_coul*qqrd2e; } else ecoul = 0.0; @@ -266,9 +266,9 @@ void PairDipoleCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,ecoul,fx,fy,fz,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; torque[i][0] += t1tmp; torque[i][1] += t2tmp; torque[i][2] += t3tmp; diff --git a/src/USER-OMP/pair_dipole_sf_omp.cpp b/src/USER-OMP/pair_dipole_sf_omp.cpp index f0157a4536..e5c95a0ecd 100644 --- a/src/USER-OMP/pair_dipole_sf_omp.cpp +++ b/src/USER-OMP/pair_dipole_sf_omp.cpp @@ -89,15 +89,15 @@ void PairDipoleSFOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; double * const * const torque = thr->get_torque(); - const double * const q = atom->q; - const double * const * const mu = atom->mu; - const int * const type = atom->type; + const double * _noalias const q = atom->q; + const dbl4_t * _noalias const mu = (dbl4_t *) atom->mu[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; - const double * const special_lj = force->special_lj; + const double * _noalias const special_coul = force->special_coul; + const double * _noalias const special_lj = force->special_lj; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp,t1tmp,t2tmp,t3tmp; @@ -110,9 +110,9 @@ void PairDipoleSFOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; qtmp = q[i]; itype = type[i]; jlist = firstneigh[i]; @@ -125,9 +125,9 @@ void PairDipoleSFOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -154,14 +154,14 @@ void PairDipoleSFOMP::eval(int iifrom, int iito, ThrData * const thr) forcecoulz += pre1*delz; } - if (mu[i][3] > 0.0 && mu[j][3] > 0.0) { + if (mu[i].w > 0.0 && mu[j].w > 0.0) { r3inv = r2inv*rinv; r5inv = r3inv*r2inv; rcutcoul2inv=1.0/cut_coulsq[itype][jtype]; - pdotp = mu[i][0]*mu[j][0] + mu[i][1]*mu[j][1] + mu[i][2]*mu[j][2]; - pidotr = mu[i][0]*delx + mu[i][1]*dely + mu[i][2]*delz; - pjdotr = mu[j][0]*delx + mu[j][1]*dely + mu[j][2]*delz; + pdotp = mu[i].x*mu[j].x + mu[i].y*mu[j].y + mu[i].z*mu[j].z; + pidotr = mu[i].x*delx + mu[i].y*dely + mu[i].z*delz; + pjdotr = mu[j].x*delx + mu[j].y*dely + mu[j].z*delz; afac = 1.0 - rsq*rsq * rcutcoul2inv*rcutcoul2inv; pre1 = afac * ( pdotp - 3.0 * r2inv * pidotr * pjdotr ); @@ -172,9 +172,9 @@ void PairDipoleSFOMP::eval(int iifrom, int iito, ThrData * const thr) bfac = 1.0 - 4.0*rsq*sqrt(rsq)*rcutcoul2inv*sqrt(rcutcoul2inv) + 3.0*rsq*rsq*rcutcoul2inv*rcutcoul2inv; presf = 2.0 * r2inv * pidotr * pjdotr; - bforcecoulx = bfac * (pjdotr*mu[i][0]+pidotr*mu[j][0]-presf*delx); - bforcecouly = bfac * (pjdotr*mu[i][1]+pidotr*mu[j][1]-presf*dely); - bforcecoulz = bfac * (pjdotr*mu[i][2]+pidotr*mu[j][2]-presf*delz); + bforcecoulx = bfac * (pjdotr*mu[i].x+pidotr*mu[j].x-presf*delx); + bforcecouly = bfac * (pjdotr*mu[i].y+pidotr*mu[j].y-presf*dely); + bforcecoulz = bfac * (pjdotr*mu[i].z+pidotr*mu[j].z-presf*delz); forcecoulx += 3.0 * r5inv * ( aforcecoulx + bforcecoulx ); forcecouly += 3.0 * r5inv * ( aforcecouly + bforcecouly ); @@ -184,52 +184,52 @@ void PairDipoleSFOMP::eval(int iifrom, int iito, ThrData * const thr) pre3 = 3.0 * bfac * r5inv * pidotr; pre4 = -bfac * r3inv; - crossx = pre4 * (mu[i][1]*mu[j][2] - mu[i][2]*mu[j][1]); - crossy = pre4 * (mu[i][2]*mu[j][0] - mu[i][0]*mu[j][2]); - crossz = pre4 * (mu[i][0]*mu[j][1] - mu[i][1]*mu[j][0]); + crossx = pre4 * (mu[i].y*mu[j].z - mu[i].z*mu[j].y); + crossy = pre4 * (mu[i].z*mu[j].x - mu[i].x*mu[j].z); + crossz = pre4 * (mu[i].x*mu[j].y - mu[i].y*mu[j].x); - tixcoul += crossx + pre2 * (mu[i][1]*delz - mu[i][2]*dely); - tiycoul += crossy + pre2 * (mu[i][2]*delx - mu[i][0]*delz); - tizcoul += crossz + pre2 * (mu[i][0]*dely - mu[i][1]*delx); - tjxcoul += -crossx + pre3 * (mu[j][1]*delz - mu[j][2]*dely); - tjycoul += -crossy + pre3 * (mu[j][2]*delx - mu[j][0]*delz); - tjzcoul += -crossz + pre3 * (mu[j][0]*dely - mu[j][1]*delx); + tixcoul += crossx + pre2 * (mu[i].y*delz - mu[i].z*dely); + tiycoul += crossy + pre2 * (mu[i].z*delx - mu[i].x*delz); + tizcoul += crossz + pre2 * (mu[i].x*dely - mu[i].y*delx); + tjxcoul += -crossx + pre3 * (mu[j].y*delz - mu[j].z*dely); + tjycoul += -crossy + pre3 * (mu[j].z*delx - mu[j].x*delz); + tjzcoul += -crossz + pre3 * (mu[j].x*dely - mu[j].y*delx); } - if (mu[i][3] > 0.0 && q[j] != 0.0) { + if (mu[i].w > 0.0 && q[j] != 0.0) { r3inv = r2inv*rinv; r5inv = r3inv*r2inv; - pidotr = mu[i][0]*delx + mu[i][1]*dely + mu[i][2]*delz; + pidotr = mu[i].x*delx + mu[i].y*dely + mu[i].z*delz; rcutcoul2inv=1.0/cut_coulsq[itype][jtype]; pre1 = 3.0 * q[j] * r5inv * pidotr * (1-rsq*rcutcoul2inv); pqfac = 1.0 - 3.0*rsq*rcutcoul2inv + 2.0*rsq*sqrt(rsq)*rcutcoul2inv*sqrt(rcutcoul2inv); pre2 = q[j] * r3inv * pqfac; - forcecoulx += pre2*mu[i][0] - pre1*delx; - forcecouly += pre2*mu[i][1] - pre1*dely; - forcecoulz += pre2*mu[i][2] - pre1*delz; - tixcoul += pre2 * (mu[i][1]*delz - mu[i][2]*dely); - tiycoul += pre2 * (mu[i][2]*delx - mu[i][0]*delz); - tizcoul += pre2 * (mu[i][0]*dely - mu[i][1]*delx); + forcecoulx += pre2*mu[i].x - pre1*delx; + forcecouly += pre2*mu[i].y - pre1*dely; + forcecoulz += pre2*mu[i].z - pre1*delz; + tixcoul += pre2 * (mu[i].y*delz - mu[i].z*dely); + tiycoul += pre2 * (mu[i].z*delx - mu[i].x*delz); + tizcoul += pre2 * (mu[i].x*dely - mu[i].y*delx); } - if (mu[j][3] > 0.0 && qtmp != 0.0) { + if (mu[j].w > 0.0 && qtmp != 0.0) { r3inv = r2inv*rinv; r5inv = r3inv*r2inv; - pjdotr = mu[j][0]*delx + mu[j][1]*dely + mu[j][2]*delz; + pjdotr = mu[j].x*delx + mu[j].y*dely + mu[j].z*delz; rcutcoul2inv=1.0/cut_coulsq[itype][jtype]; pre1 = 3.0 * qtmp * r5inv * pjdotr * (1-rsq*rcutcoul2inv); qpfac = 1.0 - 3.0*rsq*rcutcoul2inv + 2.0*rsq*sqrt(rsq)*rcutcoul2inv*sqrt(rcutcoul2inv); pre2 = qtmp * r3inv * qpfac; - forcecoulx += pre1*delx - pre2*mu[j][0]; - forcecouly += pre1*dely - pre2*mu[j][1]; - forcecoulz += pre1*delz - pre2*mu[j][2]; - tjxcoul += -pre2 * (mu[j][1]*delz - mu[j][2]*dely); - tjycoul += -pre2 * (mu[j][2]*delx - mu[j][0]*delz); - tjzcoul += -pre2 * (mu[j][0]*dely - mu[j][1]*delx); + forcecoulx += pre1*delx - pre2*mu[j].x; + forcecouly += pre1*dely - pre2*mu[j].y; + forcecoulz += pre1*delz - pre2*mu[j].z; + tjxcoul += -pre2 * (mu[j].y*delz - mu[j].z*dely); + tjycoul += -pre2 * (mu[j].z*delx - mu[j].x*delz); + tjzcoul += -pre2 * (mu[j].x*dely - mu[j].y*delx); } } @@ -264,9 +264,9 @@ void PairDipoleSFOMP::eval(int iifrom, int iito, ThrData * const thr) t3tmp += fq*tizcoul; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= fx; - f[j][1] -= fy; - f[j][2] -= fz; + f[j].x -= fx; + f[j].y -= fy; + f[j].z -= fz; torque[j][0] += fq*tjxcoul; torque[j][1] += fq*tjycoul; torque[j][2] += fq*tjzcoul; @@ -277,11 +277,11 @@ void PairDipoleSFOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = (1.0-sqrt(rsq)/sqrt(cut_coulsq[itype][jtype])); ecoul *= ecoul; ecoul *= qtmp * q[j] * rinv; - if (mu[i][3] > 0.0 && mu[j][3] > 0.0) + if (mu[i].w > 0.0 && mu[j].w > 0.0) ecoul += bfac * (r3inv*pdotp - 3.0*r5inv*pidotr*pjdotr); - if (mu[i][3] > 0.0 && q[j] != 0.0) + if (mu[i].w > 0.0 && q[j] != 0.0) ecoul += -q[j] * r3inv * pqfac * pidotr; - if (mu[j][3] > 0.0 && qtmp != 0.0) + if (mu[j].w > 0.0 && qtmp != 0.0) ecoul += qtmp * r3inv * qpfac * pjdotr; ecoul *= factor_coul*qqrd2e; } else ecoul = 0.0; @@ -299,9 +299,9 @@ void PairDipoleSFOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,ecoul,fx,fy,fz,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; torque[i][0] += t1tmp; torque[i][1] += t2tmp; torque[i][2] += t3tmp; diff --git a/src/USER-OMP/pair_dpd_omp.cpp b/src/USER-OMP/pair_dpd_omp.cpp index cb7f560e05..d09a2fbdae 100644 --- a/src/USER-OMP/pair_dpd_omp.cpp +++ b/src/USER-OMP/pair_dpd_omp.cpp @@ -113,10 +113,10 @@ void PairDPDOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - const double * const * const v = atom->v; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double *special_lj = force->special_lj; const double dtinvsqrt = 1.0/sqrt(update->dt); @@ -132,12 +132,12 @@ void PairDPDOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - vxtmp = v[i][0]; - vytmp = v[i][1]; - vztmp = v[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; + vxtmp = v[i].x; + vytmp = v[i].y; + vztmp = v[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -148,9 +148,9 @@ void PairDPDOMP::eval(int iifrom, int iito, ThrData * const thr) factor_dpd = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -158,9 +158,9 @@ void PairDPDOMP::eval(int iifrom, int iito, ThrData * const thr) r = sqrt(rsq); if (r < EPSILON) continue; // r can be 0.0 in DPD systems rinv = 1.0/r; - delvx = vxtmp - v[j][0]; - delvy = vytmp - v[j][1]; - delvz = vztmp - v[j][2]; + delvx = vxtmp - v[j].x; + delvy = vytmp - v[j].y; + delvz = vztmp - v[j].z; dot = delx*delvx + dely*delvy + delz*delvz; wd = 1.0 - r/cut[itype][jtype]; randnum = rng.gaussian(); @@ -178,9 +178,9 @@ void PairDPDOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -195,9 +195,9 @@ void PairDPDOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_dpd_tstat_omp.cpp b/src/USER-OMP/pair_dpd_tstat_omp.cpp index 6965e69349..26d14ec8aa 100644 --- a/src/USER-OMP/pair_dpd_tstat_omp.cpp +++ b/src/USER-OMP/pair_dpd_tstat_omp.cpp @@ -111,10 +111,10 @@ void PairDPDTstatOMP::eval(int iifrom, int iito, ThrData * const thr) double rsq,r,rinv,dot,wd,randnum,factor_dpd; int *ilist,*jlist,*numneigh,**firstneigh; - const double * const * const x = atom->x; - const double * const * const v = atom->v; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double *special_lj = force->special_lj; const double dtinvsqrt = 1.0/sqrt(update->dt); @@ -142,12 +142,12 @@ void PairDPDTstatOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - vxtmp = v[i][0]; - vytmp = v[i][1]; - vztmp = v[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; + vxtmp = v[i].x; + vytmp = v[i].y; + vztmp = v[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -158,9 +158,9 @@ void PairDPDTstatOMP::eval(int iifrom, int iito, ThrData * const thr) factor_dpd = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -168,9 +168,9 @@ void PairDPDTstatOMP::eval(int iifrom, int iito, ThrData * const thr) r = sqrt(rsq); if (r < EPSILON) continue; // r can be 0.0 in DPD systems rinv = 1.0/r; - delvx = vxtmp - v[j][0]; - delvy = vytmp - v[j][1]; - delvz = vztmp - v[j][2]; + delvx = vxtmp - v[j].x; + delvy = vytmp - v[j].y; + delvz = vztmp - v[j].z; dot = delx*delvx + dely*delvy + delz*delvz; wd = 1.0 - r/cut[itype][jtype]; randnum = rng.gaussian(); @@ -186,18 +186,18 @@ void PairDPDTstatOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EVFLAG) ev_tally_thr(this, i,j,nlocal,NEWTON_PAIR, 0.0,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_eam_omp.cpp b/src/USER-OMP/pair_eam_omp.cpp index 59e58d1b73..808353b881 100644 --- a/src/USER-OMP/pair_eam_omp.cpp +++ b/src/USER-OMP/pair_eam_omp.cpp @@ -101,13 +101,13 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; double * const rho_t = thr->get_rho(); const int tid = thr->get_tid(); const int nthreads = comm->nthreads; - const int * const type = atom->type; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const int nall = nlocal + atom->nghost; @@ -122,9 +122,9 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ii++) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -133,9 +133,9 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr) j = jlist[jj]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; if (rsq < cutforcesq) { @@ -221,9 +221,9 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ii++) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; fxtmp = fytmp = fztmp = 0.0; @@ -234,9 +234,9 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr) j = jlist[jj]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; if (rsq < cutforcesq) { @@ -276,9 +276,9 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) evdwl = phi; @@ -286,9 +286,9 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_edip_omp.cpp b/src/USER-OMP/pair_edip_omp.cpp index d9d68d7a07..5ed24436b3 100644 --- a/src/USER-OMP/pair_edip_omp.cpp +++ b/src/USER-OMP/pair_edip_omp.cpp @@ -147,9 +147,9 @@ void PairEDIPOMP::eval(int iifrom, int iito, ThrData * const thr) double *pre_thrPow2B_ij = prePow2B_ij + tid * leadDimInteractionList; double *pre_thrForceCoord = preForceCoord + tid * leadDimInteractionList; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; inum = list->inum; @@ -165,9 +165,9 @@ void PairEDIPOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; itype = map[type[i]]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -180,9 +180,9 @@ void PairEDIPOMP::eval(int iifrom, int iito, ThrData * const thr) double dr_ij[3], r_ij; - dr_ij[0] = xtmp - x[j][0]; - dr_ij[1] = ytmp - x[j][1]; - dr_ij[2] = ztmp - x[j][2]; + dr_ij[0] = xtmp - x[j].x; + dr_ij[1] = ytmp - x[j].y; + dr_ij[2] = ztmp - x[j].z; r_ij = dr_ij[0]*dr_ij[0] + dr_ij[1]*dr_ij[1] + dr_ij[2]*dr_ij[2]; jtype = map[type[j]]; @@ -297,9 +297,9 @@ void PairEDIPOMP::eval(int iifrom, int iito, ThrData * const thr) j = jlist[neighbor_j]; j &= NEIGHMASK; - dr_ij[0] = x[j][0] - xtmp; - dr_ij[1] = x[j][1] - ytmp; - dr_ij[2] = x[j][2] - ztmp; + dr_ij[0] = x[j].x - xtmp; + dr_ij[1] = x[j].y - ytmp; + dr_ij[2] = x[j].z - ztmp; r_ij = dr_ij[0]*dr_ij[0] + dr_ij[1]*dr_ij[1] + dr_ij[2]*dr_ij[2]; jtype = map[type[j]]; @@ -334,13 +334,13 @@ void PairEDIPOMP::eval(int iifrom, int iito, ThrData * const thr) f_ij[1] = forceMod2B * directorCos_ij_y; f_ij[2] = forceMod2B * directorCos_ij_z; - f[j][0] -= f_ij[0]; - f[j][1] -= f_ij[1]; - f[j][2] -= f_ij[2]; + f[j].x -= f_ij[0]; + f[j].y -= f_ij[1]; + f[j].z -= f_ij[2]; - f[i][0] += f_ij[0]; - f[i][1] += f_ij[1]; - f[i][2] += f_ij[2]; + f[i].x += f_ij[0]; + f[i].y += f_ij[1]; + f[i].z += f_ij[2]; // potential energy @@ -360,9 +360,9 @@ void PairEDIPOMP::eval(int iifrom, int iito, ThrData * const thr) ikparam = elem2param[itype][ktype][ktype]; ijkparam = elem2param[itype][jtype][ktype]; - dr_ik[0] = x[k][0] - xtmp; - dr_ik[1] = x[k][1] - ytmp; - dr_ik[2] = x[k][2] - ztmp; + dr_ik[0] = x[k].x - xtmp; + dr_ik[1] = x[k].y - ytmp; + dr_ik[2] = x[k].z - ztmp; r_ik = dr_ik[0]*dr_ik[0] + dr_ik[1]*dr_ik[1] + dr_ik[2]*dr_ik[2]; if (r_ik > params[ikparam].cutsq) continue; @@ -426,17 +426,17 @@ void PairEDIPOMP::eval(int iifrom, int iito, ThrData * const thr) forceModCoord += (forceMod3B_factor2 * (tauFunctionDerived - 0.5 * mu * cosTetaDiff)); - f[j][0] += f_ij[0]; - f[j][1] += f_ij[1]; - f[j][2] += f_ij[2]; + f[j].x += f_ij[0]; + f[j].y += f_ij[1]; + f[j].z += f_ij[2]; - f[k][0] += f_ik[0]; - f[k][1] += f_ik[1]; - f[k][2] += f_ik[2]; + f[k].x += f_ik[0]; + f[k].y += f_ik[1]; + f[k].z += f_ik[2]; - f[i][0] -= f_ij[0] + f_ik[0]; - f[i][1] -= f_ij[1] + f_ik[1]; - f[i][2] -= f_ij[2] + f_ik[2]; + f[i].x -= f_ij[0] + f_ik[0]; + f[i].y -= f_ij[1] + f_ik[1]; + f[i].z -= f_ij[2] + f_ik[2]; // potential energy @@ -464,13 +464,13 @@ void PairEDIPOMP::eval(int iifrom, int iito, ThrData * const thr) f_ij[1] = forceModCoord_ij * dr_ij[1]; f_ij[2] = forceModCoord_ij * dr_ij[2]; - f[j][0] -= f_ij[0]; - f[j][1] -= f_ij[1]; - f[j][2] -= f_ij[2]; + f[j].x -= f_ij[0]; + f[j].y -= f_ij[1]; + f[j].z -= f_ij[2]; - f[i][0] += f_ij[0]; - f[i][1] += f_ij[1]; - f[i][2] += f_ij[2]; + f[i].x += f_ij[0]; + f[i].y += f_ij[1]; + f[i].z += f_ij[2]; // potential energy diff --git a/src/USER-OMP/pair_eim_omp.cpp b/src/USER-OMP/pair_eim_omp.cpp index ad0909f242..916bc99380 100644 --- a/src/USER-OMP/pair_eim_omp.cpp +++ b/src/USER-OMP/pair_eim_omp.cpp @@ -102,14 +102,14 @@ void PairEIMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; double * const rho_t = thr->get_rho(); double * const fp_t = thr->get_fp(); const int tid = thr->get_tid(); const int nthreads = comm->nthreads; - const int * const type = atom->type; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const int nall = nlocal + atom->nghost; @@ -124,9 +124,9 @@ void PairEIMOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ii++) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -135,9 +135,9 @@ void PairEIMOMP::eval(int iifrom, int iito, ThrData * const thr) j = jlist[jj]; j &= NEIGHMASK; jtype = type[j]; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; if (rsq < cutforcesq[itype][jtype]) { @@ -195,9 +195,9 @@ void PairEIMOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ii++) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -207,9 +207,9 @@ void PairEIMOMP::eval(int iifrom, int iito, ThrData * const thr) j &= NEIGHMASK; jtype = type[j]; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; if (rsq < cutforcesq[itype][jtype]) { @@ -279,9 +279,9 @@ void PairEIMOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ii++) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; fxtmp = fytmp = fztmp = 0.0; @@ -292,9 +292,9 @@ void PairEIMOMP::eval(int iifrom, int iito, ThrData * const thr) j = jlist[jj]; j &= NEIGHMASK; jtype = type[j]; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; if (rsq < cutforcesq[itype][jtype]) { @@ -328,9 +328,9 @@ void PairEIMOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) evdwl = phi-q0[itype]*q0[jtype]*coul; @@ -338,9 +338,9 @@ void PairEIMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_gauss_cut_omp.cpp b/src/USER-OMP/pair_gauss_cut_omp.cpp index cb54785627..cb0197c965 100644 --- a/src/USER-OMP/pair_gauss_cut_omp.cpp +++ b/src/USER-OMP/pair_gauss_cut_omp.cpp @@ -81,11 +81,11 @@ void PairGaussCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -97,9 +97,9 @@ void PairGaussCutOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -111,9 +111,9 @@ void PairGaussCutOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -127,9 +127,9 @@ void PairGaussCutOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -141,9 +141,9 @@ void PairGaussCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_gauss_omp.cpp b/src/USER-OMP/pair_gauss_omp.cpp index ae8af0d774..5255b6ea3d 100644 --- a/src/USER-OMP/pair_gauss_omp.cpp +++ b/src/USER-OMP/pair_gauss_omp.cpp @@ -86,11 +86,11 @@ double PairGaussOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -102,9 +102,9 @@ double PairGaussOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -115,9 +115,9 @@ double PairGaussOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -137,9 +137,9 @@ double PairGaussOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -152,9 +152,9 @@ double PairGaussOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } return occ; } diff --git a/src/USER-OMP/pair_gayberne_omp.cpp b/src/USER-OMP/pair_gayberne_omp.cpp index 98fa5428a2..11d5d8a233 100644 --- a/src/USER-OMP/pair_gayberne_omp.cpp +++ b/src/USER-OMP/pair_gayberne_omp.cpp @@ -83,13 +83,13 @@ void PairGayBerneOMP::eval(int iifrom, int iito, ThrData * const thr) int *ilist,*jlist,*numneigh,**firstneigh; double *iquat,*jquat; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - double * const * const tor = thr->get_torque(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + dbl3_t * _noalias const tor = (dbl3_t *) thr->get_torque()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; - const int * const ellipsoid = atom->ellipsoid; + const double * _noalias const special_lj = force->special_lj; + const int * _noalias const ellipsoid = atom->ellipsoid; AtomVecEllipsoid::Bonus *bonus = avec->bonus; @@ -126,9 +126,9 @@ void PairGayBerneOMP::eval(int iifrom, int iito, ThrData * const thr) // r12 = center to center vector - r12[0] = x[j][0]-x[i][0]; - r12[1] = x[j][1]-x[i][1]; - r12[2] = x[j][2]-x[i][2]; + r12[0] = x[j].x-x[i].x; + r12[1] = x[j].y-x[i].y; + r12[2] = x[j].z-x[i].z; rsq = MathExtra::dot3(r12,r12); jtype = type[j]; @@ -196,12 +196,12 @@ void PairGayBerneOMP::eval(int iifrom, int iito, ThrData * const thr) rtor[0] *= factor_lj; rtor[1] *= factor_lj; rtor[2] *= factor_lj; - f[j][0] -= fforce[0]; - f[j][1] -= fforce[1]; - f[j][2] -= fforce[2]; - tor[j][0] += rtor[0]; - tor[j][1] += rtor[1]; - tor[j][2] += rtor[2]; + f[j].x -= fforce[0]; + f[j].y -= fforce[1]; + f[j].z -= fforce[2]; + tor[j].x += rtor[0]; + tor[j].y += rtor[1]; + tor[j].z += rtor[2]; } if (EFLAG) evdwl = factor_lj*one_eng; @@ -211,12 +211,12 @@ void PairGayBerneOMP::eval(int iifrom, int iito, ThrData * const thr) -r12[0],-r12[1],-r12[2],thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; - tor[i][0] += t1tmp; - tor[i][1] += t2tmp; - tor[i][2] += t3tmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; + tor[i].x += t1tmp; + tor[i].y += t2tmp; + tor[i].z += t3tmp; } } diff --git a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp index 25e094bc7a..fad2b17386 100644 --- a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp @@ -124,10 +124,10 @@ void PairHbondDreidingLJOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; - const double * const special_lj = force->special_lj; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; + const double * _noalias const special_lj = force->special_lj; const int * const * const nspecial = atom->nspecial; const int * const * const special = atom->special; double fxtmp,fytmp,fztmp; @@ -156,9 +156,9 @@ void PairHbondDreidingLJOMP::eval(int iifrom, int iito, ThrData * const thr) jnum = numneigh[i]; fxtmp=fytmp=fztmp=0.0; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; @@ -168,9 +168,9 @@ void PairHbondDreidingLJOMP::eval(int iifrom, int iito, ThrData * const thr) jtype = type[j]; if (!acceptor[jtype]) continue; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; for (kk = 0; kk < knum; kk++) { @@ -182,16 +182,16 @@ void PairHbondDreidingLJOMP::eval(int iifrom, int iito, ThrData * const thr) const Param &pm = params[m]; if (rsq < pm.cut_outersq) { - delr1[0] = xtmp - x[k][0]; - delr1[1] = ytmp - x[k][1]; - delr1[2] = ztmp - x[k][2]; + delr1[0] = xtmp - x[k].x; + delr1[1] = ytmp - x[k].y; + delr1[2] = ztmp - x[k].z; domain->minimum_image(delr1); rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2]; r1 = sqrt(rsq1); - delr2[0] = x[j][0] - x[k][0]; - delr2[1] = x[j][1] - x[k][1]; - delr2[2] = x[j][2] - x[k][2]; + delr2[0] = x[j].x - x[k].x; + delr2[1] = x[j].y - x[k].y; + delr2[2] = x[j].z - x[k].z; domain->minimum_image(delr2); rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2]; r2 = sqrt(rsq2); @@ -258,13 +258,13 @@ void PairHbondDreidingLJOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += fi[1]; fztmp += fi[2]; - f[j][0] += fj[0]; - f[j][1] += fj[1]; - f[j][2] += fj[2]; + f[j].x += fj[0]; + f[j].y += fj[1]; + f[j].z += fj[2]; - f[k][0] -= vx1 + vx2; - f[k][1] -= vy1 + vy2; - f[k][2] -= vz1 + vz2; + f[k].x -= vx1 + vx2; + f[k].y -= vy1 + vy2; + f[k].z -= vz1 + vz2; // KIJ instead of IJK b/c delr1/delr2 are both with respect to k @@ -277,9 +277,9 @@ void PairHbondDreidingLJOMP::eval(int iifrom, int iito, ThrData * const thr) } } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } const int tid = thr->get_tid(); hbcount_thr[tid] = static_cast(hbcount); diff --git a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp index d96d44b303..fe4a7720b8 100644 --- a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp @@ -123,10 +123,10 @@ void PairHbondDreidingMorseOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; - const double * const special_lj = force->special_lj; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; + const double * _noalias const special_lj = force->special_lj; const int * const * const nspecial = atom->nspecial; const int * const * const special = atom->special; double fxtmp,fytmp,fztmp; @@ -155,9 +155,9 @@ void PairHbondDreidingMorseOMP::eval(int iifrom, int iito, ThrData * const thr) jnum = numneigh[i]; fxtmp=fytmp=fztmp=0.0; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; @@ -167,9 +167,9 @@ void PairHbondDreidingMorseOMP::eval(int iifrom, int iito, ThrData * const thr) jtype = type[j]; if (!acceptor[jtype]) continue; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; for (kk = 0; kk < knum; kk++) { @@ -181,16 +181,16 @@ void PairHbondDreidingMorseOMP::eval(int iifrom, int iito, ThrData * const thr) const Param &pm = params[m]; if (rsq < pm.cut_outersq) { - delr1[0] = xtmp - x[k][0]; - delr1[1] = ytmp - x[k][1]; - delr1[2] = ztmp - x[k][2]; + delr1[0] = xtmp - x[k].x; + delr1[1] = ytmp - x[k].y; + delr1[2] = ztmp - x[k].z; domain->minimum_image(delr1); rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2]; r1 = sqrt(rsq1); - delr2[0] = x[j][0] - x[k][0]; - delr2[1] = x[j][1] - x[k][1]; - delr2[2] = x[j][2] - x[k][2]; + delr2[0] = x[j].x - x[k].x; + delr2[1] = x[j].y - x[k].y; + delr2[2] = x[j].z - x[k].z; domain->minimum_image(delr2); rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2]; r2 = sqrt(rsq2); @@ -256,13 +256,13 @@ void PairHbondDreidingMorseOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += fi[1]; fztmp += fi[2]; - f[j][0] += fj[0]; - f[j][1] += fj[1]; - f[j][2] += fj[2]; + f[j].x += fj[0]; + f[j].y += fj[1]; + f[j].z += fj[2]; - f[k][0] -= vx1 + vx2; - f[k][1] -= vy1 + vy2; - f[k][2] -= vz1 + vz2; + f[k].x -= vx1 + vx2; + f[k].y -= vy1 + vy2; + f[k].z -= vz1 + vz2; // KIJ instead of IJK b/c delr1/delr2 are both with respect to k @@ -275,9 +275,9 @@ void PairHbondDreidingMorseOMP::eval(int iifrom, int iito, ThrData * const thr) } } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } const int tid = thr->get_tid(); hbcount_thr[tid] = static_cast(hbcount); diff --git a/src/USER-OMP/pair_lj96_cut_omp.cpp b/src/USER-OMP/pair_lj96_cut_omp.cpp index 16827c7ee1..13a2252298 100644 --- a/src/USER-OMP/pair_lj96_cut_omp.cpp +++ b/src/USER-OMP/pair_lj96_cut_omp.cpp @@ -82,11 +82,11 @@ void PairLJ96CutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -98,9 +98,9 @@ void PairLJ96CutOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -111,9 +111,9 @@ void PairLJ96CutOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -129,9 +129,9 @@ void PairLJ96CutOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -144,9 +144,9 @@ void PairLJ96CutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp index 739f754a23..e30052ddb2 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp @@ -84,13 +84,13 @@ void PairLJCharmmCoulCharmmImplicitOMP::eval(int iifrom, int iito, ThrData * con evdwl = ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; - const double * const special_lj = force->special_lj; + const double * _noalias const special_coul = force->special_coul; + const double * _noalias const special_lj = force->special_lj; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp; @@ -106,9 +106,9 @@ void PairLJCharmmCoulCharmmImplicitOMP::eval(int iifrom, int iito, ThrData * con i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -120,9 +120,9 @@ void PairLJCharmmCoulCharmmImplicitOMP::eval(int iifrom, int iito, ThrData * con factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -162,9 +162,9 @@ void PairLJCharmmCoulCharmmImplicitOMP::eval(int iifrom, int iito, ThrData * con fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -193,9 +193,9 @@ void PairLJCharmmCoulCharmmImplicitOMP::eval(int iifrom, int iito, ThrData * con evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp index 318cb3aaa8..8aff427b74 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp @@ -84,13 +84,13 @@ void PairLJCharmmCoulCharmmOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; - const double * const special_lj = force->special_lj; + const double * _noalias const special_coul = force->special_coul; + const double * _noalias const special_lj = force->special_lj; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp; @@ -106,9 +106,9 @@ void PairLJCharmmCoulCharmmOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -120,9 +120,9 @@ void PairLJCharmmCoulCharmmOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -162,9 +162,9 @@ void PairLJCharmmCoulCharmmOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -193,9 +193,9 @@ void PairLJCharmmCoulCharmmOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp index afdc527567..1e5cb8161a 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp @@ -78,12 +78,12 @@ template void PairLJCharmmCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) { - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; - const double * const special_coul = force->special_coul; - const double * const special_lj = force->special_lj; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; + const double * _noalias const special_coul = force->special_coul; + const double * _noalias const special_lj = force->special_lj; const double qqrd2e = force->qqrd2e; const double inv_denom_lj = 1.0/denom_lj; @@ -99,9 +99,9 @@ void PairLJCharmmCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) const int i = ilist[ii]; const int itype = type[i]; const double qtmp = q[i]; - const double xtmp = x[i][0]; - const double ytmp = x[i][1]; - const double ztmp = x[i][2]; + const double xtmp = x[i].x; + const double ytmp = x[i].y; + const double ztmp = x[i].z; double fxtmp,fytmp,fztmp; fxtmp=fytmp=fztmp=0.0; @@ -115,9 +115,9 @@ void PairLJCharmmCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) const int sbindex = sbmask(jlist[jj]); const int j = jlist[jj] & NEIGHMASK; - const double delx = xtmp - x[j][0]; - const double dely = ytmp - x[j][1]; - const double delz = ztmp - x[j][2]; + const double delx = xtmp - x[j].x; + const double dely = ytmp - x[j].y; + const double delz = ztmp - x[j].z; const double rsq = delx*delx + dely*dely + delz*delz; const int jtype = type[j]; @@ -197,18 +197,18 @@ void PairLJCharmmCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EVFLAG) ev_tally_thr(this,i,j,nlocal,NEWTON_PAIR, evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp index 7fba033a13..1e23b3a062 100755 --- a/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp @@ -79,12 +79,12 @@ template void PairLJCharmmCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) { - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; - const double * const special_coul = force->special_coul; - const double * const special_lj = force->special_lj; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; + const double * _noalias const special_coul = force->special_coul; + const double * _noalias const special_lj = force->special_lj; const double qqrd2e = force->qqrd2e; const double inv_denom_lj = 1.0/denom_lj; @@ -100,9 +100,9 @@ void PairLJCharmmCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) const int i = ilist[ii]; const int itype = type[i]; const double qtmp = q[i]; - const double xtmp = x[i][0]; - const double ytmp = x[i][1]; - const double ztmp = x[i][2]; + const double xtmp = x[i].x; + const double ytmp = x[i].y; + const double ztmp = x[i].z; double fxtmp,fytmp,fztmp; fxtmp=fytmp=fztmp=0.0; @@ -116,9 +116,9 @@ void PairLJCharmmCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) const int sbindex = sbmask(jlist[jj]); const int j = jlist[jj] & NEIGHMASK; - const double delx = xtmp - x[j][0]; - const double dely = ytmp - x[j][1]; - const double delz = ztmp - x[j][2]; + const double delx = xtmp - x[j].x; + const double dely = ytmp - x[j].y; + const double delz = ztmp - x[j].z; const double rsq = delx*delx + dely*dely + delz*delz; const int jtype = type[j]; @@ -190,18 +190,18 @@ void PairLJCharmmCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EVFLAG) ev_tally_thr(this,i,j,nlocal,NEWTON_PAIR, evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp index 361923cb54..e51026ecb0 100644 --- a/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp @@ -84,13 +84,13 @@ void PairLJClass2CoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; - const double * const special_lj = force->special_lj; + const double * _noalias const special_coul = force->special_coul; + const double * _noalias const special_lj = force->special_lj; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp; @@ -104,9 +104,9 @@ void PairLJClass2CoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -118,9 +118,9 @@ void PairLJClass2CoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -146,9 +146,9 @@ void PairLJClass2CoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -166,9 +166,9 @@ void PairLJClass2CoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp index 6049d7a98c..08efafa324 100644 --- a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp @@ -92,13 +92,13 @@ void PairLJClass2CoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; - const double * const special_lj = force->special_lj; + const double * _noalias const special_coul = force->special_coul; + const double * _noalias const special_lj = force->special_lj; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp; @@ -112,9 +112,9 @@ void PairLJClass2CoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -126,9 +126,9 @@ void PairLJClass2CoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -160,9 +160,9 @@ void PairLJClass2CoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -182,9 +182,9 @@ void PairLJClass2CoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_class2_omp.cpp b/src/USER-OMP/pair_lj_class2_omp.cpp index 978335d21e..a2b88699e8 100644 --- a/src/USER-OMP/pair_lj_class2_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_omp.cpp @@ -81,11 +81,11 @@ void PairLJClass2OMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -97,9 +97,9 @@ void PairLJClass2OMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -110,9 +110,9 @@ void PairLJClass2OMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -128,9 +128,9 @@ void PairLJClass2OMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -143,9 +143,9 @@ void PairLJClass2OMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_cubic_omp.cpp b/src/USER-OMP/pair_lj_cubic_omp.cpp index bf4b2b2bc8..124bc87899 100644 --- a/src/USER-OMP/pair_lj_cubic_omp.cpp +++ b/src/USER-OMP/pair_lj_cubic_omp.cpp @@ -83,11 +83,11 @@ void PairLJCubicOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -99,9 +99,9 @@ void PairLJCubicOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -112,9 +112,9 @@ void PairLJCubicOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -135,9 +135,9 @@ void PairLJCubicOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -154,9 +154,9 @@ void PairLJCubicOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp index 6c1bdedef4..3cbb2977c0 100644 --- a/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp @@ -83,13 +83,13 @@ void PairLJCutCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; - const double * const special_lj = force->special_lj; + const double * _noalias const special_coul = force->special_coul; + const double * _noalias const special_lj = force->special_lj; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp; @@ -103,9 +103,9 @@ void PairLJCutCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -117,9 +117,9 @@ void PairLJCutCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -144,9 +144,9 @@ void PairLJCutCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -164,9 +164,9 @@ void PairLJCutCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp index 81a73d78b1..28745e89c7 100644 --- a/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp @@ -84,13 +84,13 @@ void PairLJCutCoulDebyeOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; - const double * const special_lj = force->special_lj; + const double * _noalias const special_coul = force->special_coul; + const double * _noalias const special_lj = force->special_lj; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp; @@ -104,9 +104,9 @@ void PairLJCutCoulDebyeOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -118,9 +118,9 @@ void PairLJCutCoulDebyeOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -147,9 +147,9 @@ void PairLJCutCoulDebyeOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -167,9 +167,9 @@ void PairLJCutCoulDebyeOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp index 19639ac731..6061374bba 100644 --- a/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp @@ -94,13 +94,13 @@ void PairLJCutCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; - const double * const special_lj = force->special_lj; + const double * _noalias const special_coul = force->special_coul; + const double * _noalias const special_lj = force->special_lj; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp; @@ -114,9 +114,9 @@ void PairLJCutCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -128,9 +128,9 @@ void PairLJCutCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -175,9 +175,9 @@ void PairLJCutCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -202,9 +202,9 @@ void PairLJCutCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp index 790b697fd4..de6bf676fa 100755 --- a/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp @@ -87,13 +87,13 @@ void PairLJCutCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; - const double * const special_lj = force->special_lj; + const double * _noalias const special_coul = force->special_coul; + const double * _noalias const special_lj = force->special_lj; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp; @@ -107,9 +107,9 @@ void PairLJCutCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -121,9 +121,9 @@ void PairLJCutCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -166,9 +166,9 @@ void PairLJCutCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -193,9 +193,9 @@ void PairLJCutCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_omp.cpp index 83e5244add..4d9f6af81f 100644 --- a/src/USER-OMP/pair_lj_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_omp.cpp @@ -75,34 +75,38 @@ void PairLJCutOMP::compute(int eflag, int vflag) template void PairLJCutOMP::eval(int iifrom, int iito, ThrData * const thr) { - int i,j,ii,jj,jnum,itype,jtype; - double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; - double rsq,r2inv,r6inv,forcelj,factor_lj; - int *ilist,*jlist,*numneigh,**firstneigh; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; + const double * _noalias const special_lj = force->special_lj; + const int * _noalias const ilist = list->ilist; + const int * _noalias const numneigh = list->numneigh; + const int * const * const firstneigh = list->firstneigh; + + double xtmp,ytmp,ztmp,delx,dely,delz,fxtmp,fytmp,fztmp; + double rsq,r2inv,r6inv,forcelj,factor_lj,evdwl,fpair; + + const int nlocal = atom->nlocal; + int j,jj,jnum,jtype; evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; - const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; - double fxtmp,fytmp,fztmp; - - ilist = list->ilist; - numneigh = list->numneigh; - firstneigh = list->firstneigh; - // loop over neighbors of my atoms - for (ii = iifrom; ii < iito; ++ii) { + for (int ii = iifrom; ii < iito; ++ii) { + const int i = ilist[ii]; + const int itype = type[i]; + const int * _noalias const jlist = firstneigh[i]; + const double * _noalias const cutsqi = cutsq[itype]; + const double * _noalias const offseti = offset[itype]; + const double * _noalias const lj1i = lj1[itype]; + const double * _noalias const lj2i = lj2[itype]; + const double * _noalias const lj3i = lj3[itype]; + const double * _noalias const lj4i = lj4[itype]; - i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - itype = type[i]; - jlist = firstneigh[i]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; jnum = numneigh[i]; fxtmp=fytmp=fztmp=0.0; @@ -111,30 +115,29 @@ void PairLJCutOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; - if (rsq < cutsq[itype][jtype]) { + if (rsq < cutsqi[jtype]) { r2inv = 1.0/rsq; r6inv = r2inv*r2inv*r2inv; - forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]); + forcelj = r6inv * (lj1i[jtype]*r6inv - lj2i[jtype]); fpair = factor_lj*forcelj*r2inv; fxtmp += delx*fpair; fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { - evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) - - offset[itype][jtype]; + evdwl = r6inv*(lj3i[jtype]*r6inv-lj4i[jtype]) - offseti[jtype]; evdwl *= factor_lj; } @@ -142,9 +145,9 @@ void PairLJCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp index eea9370c49..5dfd75421f 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp @@ -147,7 +147,7 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr) int i,j,ii,jj,jnum,itype,jtype,itable, key; int n,vlist[6]; int iH1,iH2,jH1,jH2; - + evdwl = ecoul = 0.0; const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; @@ -329,8 +329,10 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr) // virial = sum(r x F) where each water's atoms are near xi and xj // vlist stores 2,4,6 atoms whose forces contribute to virial - n = 0; - key = 0; + if (EVFLAG) { + n = 0; + key = 0; + } if (itype != typeO) { fxtmp += delx * cforce; @@ -345,10 +347,10 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr) v[4] = x[i].x * delz * cforce; v[5] = x[i].y * delz * cforce; } - vlist[n++] = i; + if (EVFLAG) vlist[n++] = i; } else { - key++; + if (EVFLAG) key++; fdx = delx*cforce; fdy = dely*cforce; @@ -385,9 +387,11 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr) v[4] = x[i].x*fOz + xH1[0]*fHz + xH2[0]*fHz; v[5] = x[i].y*fOz + xH1[1]*fHz + xH2[1]*fHz; } - vlist[n++] = i; - vlist[n++] = iH1; - vlist[n++] = iH2; + if (EVFLAG) { + vlist[n++] = i; + vlist[n++] = iH1; + vlist[n++] = iH2; + } } if (jtype != typeO) { @@ -403,10 +407,10 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr) v[4] -= x[j].x * delz * cforce; v[5] -= x[j].y * delz * cforce; } - vlist[n++] = j; + if (EVFLAG) vlist[n++] = j; } else { - key += 2; + if (EVFLAG) key += 2; fdx = -delx*cforce; fdy = -dely*cforce; @@ -443,9 +447,11 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr) v[4] += x[j].x*fOz + xH1[0]*fHz + xH2[0]*fHz; v[5] += x[j].y*fOz + xH1[1]*fHz + xH2[1]*fHz; } - vlist[n++] = j; - vlist[n++] = jH1; - vlist[n++] = jH2; + if (EVFLAG) { + vlist[n++] = j; + vlist[n++] = jH1; + vlist[n++] = jH2; + } } if (EFLAG) { @@ -468,7 +474,6 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr) } } -/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- compute position xM of fictitious charge site for O atom and 2 H atoms return it as xM diff --git a/src/USER-OMP/pair_lj_cut_tip4p_long_omp.h b/src/USER-OMP/pair_lj_cut_tip4p_long_omp.h index 19dc5c42b4..deb060ccbe 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_long_omp.h +++ b/src/USER-OMP/pair_lj_cut_tip4p_long_omp.h @@ -41,8 +41,8 @@ class PairLJCutTIP4PLongOMP : public PairLJCutTIP4PLong, public ThrOMP { private: dbl3_t *newsite_thr; int3_t *hneigh_thr; - template - void eval(int ifrom, int ito, ThrData * const thr); + + template < int, int, int, int > void eval(int, int, ThrData *const); void compute_newsite_thr(const dbl3_t &, const dbl3_t &, const dbl3_t &, dbl3_t &) const; }; diff --git a/src/USER-OMP/pair_lj_expand_omp.cpp b/src/USER-OMP/pair_lj_expand_omp.cpp index 936c55c827..8f1f931822 100644 --- a/src/USER-OMP/pair_lj_expand_omp.cpp +++ b/src/USER-OMP/pair_lj_expand_omp.cpp @@ -82,11 +82,11 @@ void PairLJExpandOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -98,9 +98,9 @@ void PairLJExpandOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -111,9 +111,9 @@ void PairLJExpandOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -130,9 +130,9 @@ void PairLJExpandOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -145,9 +145,9 @@ void PairLJExpandOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp b/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp index 4df4d334e7..1be1ba39eb 100644 --- a/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp @@ -84,13 +84,13 @@ void PairLJGromacsCoulGromacsOMP::eval(int iifrom, int iito, ThrData * const thr evdwl = ecoul = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_coul = force->special_coul; - const double * const special_lj = force->special_lj; + const double * _noalias const special_coul = force->special_coul; + const double * _noalias const special_lj = force->special_lj; const double qqrd2e = force->qqrd2e; double fxtmp,fytmp,fztmp; @@ -104,9 +104,9 @@ void PairLJGromacsCoulGromacsOMP::eval(int iifrom, int iito, ThrData * const thr i = ilist[ii]; qtmp = q[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -118,9 +118,9 @@ void PairLJGromacsCoulGromacsOMP::eval(int iifrom, int iito, ThrData * const thr factor_coul = special_coul[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -161,9 +161,9 @@ void PairLJGromacsCoulGromacsOMP::eval(int iifrom, int iito, ThrData * const thr fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -191,9 +191,9 @@ void PairLJGromacsCoulGromacsOMP::eval(int iifrom, int iito, ThrData * const thr evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_gromacs_omp.cpp b/src/USER-OMP/pair_lj_gromacs_omp.cpp index ce97ad2d1d..964a9bda8d 100644 --- a/src/USER-OMP/pair_lj_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_omp.cpp @@ -82,11 +82,11 @@ void PairLJGromacsOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -98,9 +98,9 @@ void PairLJGromacsOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -111,9 +111,9 @@ void PairLJGromacsOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -134,9 +134,9 @@ void PairLJGromacsOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -153,9 +153,9 @@ void PairLJGromacsOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp b/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp index aa4e432a78..2c85f0f2e0 100644 --- a/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp @@ -79,12 +79,12 @@ template void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr) { - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const q = atom->q; - const int * const type = atom->type; - const double * const special_coul = force->special_coul; - const double * const special_lj = force->special_lj; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; + const double * _noalias const special_coul = force->special_coul; + const double * _noalias const special_lj = force->special_lj; const double qqrd2e = force->qqrd2e; const int * const ilist = list->ilist; @@ -99,9 +99,9 @@ void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr) const int i = ilist[ii]; const int itype = type[i]; const double qtmp = q[i]; - const double xtmp = x[i][0]; - const double ytmp = x[i][1]; - const double ztmp = x[i][2]; + const double xtmp = x[i].x; + const double ytmp = x[i].y; + const double ztmp = x[i].z; double fxtmp,fytmp,fztmp; fxtmp=fytmp=fztmp=0.0; @@ -115,9 +115,9 @@ void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr) const int sbindex = sbmask(jlist[jj]); const int j = jlist[jj] & NEIGHMASK; - const double delx = xtmp - x[j][0]; - const double dely = ytmp - x[j][1]; - const double delz = ztmp - x[j][2]; + const double delx = xtmp - x[j].x; + const double dely = ytmp - x[j].y; + const double delz = ztmp - x[j].z; const double rsq = delx*delx + dely*dely + delz*delz; const int jtype = type[j]; @@ -209,18 +209,18 @@ void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EVFLAG) ev_tally_thr(this,i,j,nlocal,NEWTON_PAIR, evdwl,ecoul,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_sdk_omp.cpp b/src/USER-OMP/pair_lj_sdk_omp.cpp index 63b1a8c171..da2eb492ff 100644 --- a/src/USER-OMP/pair_lj_sdk_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_omp.cpp @@ -86,11 +86,11 @@ void PairLJSDKOMP::eval_thr(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; const int * const ilist = list->ilist; @@ -102,9 +102,9 @@ void PairLJSDKOMP::eval_thr(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; fxtmp=fytmp=fztmp=0.0; const int itype = type[i]; @@ -116,9 +116,9 @@ void PairLJSDKOMP::eval_thr(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -159,9 +159,9 @@ void PairLJSDKOMP::eval_thr(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) evdwl *= factor_lj; @@ -169,9 +169,9 @@ void PairLJSDKOMP::eval_thr(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_sf_omp.cpp b/src/USER-OMP/pair_lj_sf_omp.cpp index 5c14e29131..d0127cabb1 100644 --- a/src/USER-OMP/pair_lj_sf_omp.cpp +++ b/src/USER-OMP/pair_lj_sf_omp.cpp @@ -81,11 +81,11 @@ void PairLJShiftedForceOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -97,9 +97,9 @@ void PairLJShiftedForceOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -110,9 +110,9 @@ void PairLJShiftedForceOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -129,9 +129,9 @@ void PairLJShiftedForceOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -144,9 +144,9 @@ void PairLJShiftedForceOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp index a8f3ad8daa..7a8440fa58 100644 --- a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp @@ -82,11 +82,11 @@ void PairLJSmoothLinearOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -98,9 +98,9 @@ void PairLJSmoothLinearOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -111,9 +111,9 @@ void PairLJSmoothLinearOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -130,9 +130,9 @@ void PairLJSmoothLinearOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -146,9 +146,9 @@ void PairLJSmoothLinearOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_lj_smooth_omp.cpp b/src/USER-OMP/pair_lj_smooth_omp.cpp index b1918c3fcd..b38ff2311b 100644 --- a/src/USER-OMP/pair_lj_smooth_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_omp.cpp @@ -82,11 +82,11 @@ void PairLJSmoothOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -98,9 +98,9 @@ void PairLJSmoothOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -111,9 +111,9 @@ void PairLJSmoothOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -137,9 +137,9 @@ void PairLJSmoothOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -157,9 +157,9 @@ void PairLJSmoothOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_morse_omp.cpp b/src/USER-OMP/pair_morse_omp.cpp index d1b0d56cfd..448b265de7 100644 --- a/src/USER-OMP/pair_morse_omp.cpp +++ b/src/USER-OMP/pair_morse_omp.cpp @@ -81,11 +81,11 @@ void PairMorseOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -97,9 +97,9 @@ void PairMorseOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -110,9 +110,9 @@ void PairMorseOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -126,9 +126,9 @@ void PairMorseOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -141,9 +141,9 @@ void PairMorseOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_resquared_omp.cpp b/src/USER-OMP/pair_resquared_omp.cpp index de05202300..b35a2613c9 100644 --- a/src/USER-OMP/pair_resquared_omp.cpp +++ b/src/USER-OMP/pair_resquared_omp.cpp @@ -82,12 +82,12 @@ void PairRESquaredOMP::eval(int iifrom, int iito, ThrData * const thr) int *ilist,*jlist,*numneigh,**firstneigh; RE2Vars wi,wj; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - double * const * const tor = thr->get_torque(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + dbl3_t * _noalias const tor = (dbl3_t *) thr->get_torque()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp,t1tmp,t2tmp,t3tmp; @@ -117,9 +117,9 @@ void PairRESquaredOMP::eval(int iifrom, int iito, ThrData * const thr) // r12 = center to center vector - r12[0] = x[j][0]-x[i][0]; - r12[1] = x[j][1]-x[i][1]; - r12[2] = x[j][2]-x[i][2]; + r12[0] = x[j].x-x[i].x; + r12[1] = x[j].y-x[i].y; + r12[2] = x[j].z-x[i].z; rsq = MathExtra::dot3(r12,r12); jtype = type[j]; @@ -147,9 +147,9 @@ void PairRESquaredOMP::eval(int iifrom, int iito, ThrData * const thr) precompute_i(j,wj); if (NEWTON_PAIR || j < nlocal) { one_eng = resquared_lj(j,i,wj,r12,rsq,fforce,rtor,true); - tor[j][0] += rtor[0]*factor_lj; - tor[j][1] += rtor[1]*factor_lj; - tor[j][2] += rtor[2]*factor_lj; + tor[j].x += rtor[0]*factor_lj; + tor[j].y += rtor[1]*factor_lj; + tor[j].z += rtor[2]*factor_lj; } else one_eng = resquared_lj(j,i,wj,r12,rsq,fforce,rtor,false); break; @@ -168,9 +168,9 @@ void PairRESquaredOMP::eval(int iifrom, int iito, ThrData * const thr) t2tmp += ttor[1]*factor_lj; t3tmp += ttor[2]*factor_lj; if (NEWTON_PAIR || j < nlocal) { - tor[j][0] += rtor[0]*factor_lj; - tor[j][1] += rtor[1]*factor_lj; - tor[j][2] += rtor[2]*factor_lj; + tor[j].x += rtor[0]*factor_lj; + tor[j].y += rtor[1]*factor_lj; + tor[j].z += rtor[2]*factor_lj; } break; } @@ -183,9 +183,9 @@ void PairRESquaredOMP::eval(int iifrom, int iito, ThrData * const thr) fztmp += fforce[2]; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= fforce[0]; - f[j][1] -= fforce[1]; - f[j][2] -= fforce[2]; + f[j].x -= fforce[0]; + f[j].y -= fforce[1]; + f[j].z -= fforce[2]; } if (EFLAG) evdwl = factor_lj*one_eng; @@ -195,12 +195,12 @@ void PairRESquaredOMP::eval(int iifrom, int iito, ThrData * const thr) -r12[0],-r12[1],-r12[2],thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; - tor[i][0] += t1tmp; - tor[i][1] += t2tmp; - tor[i][2] += t3tmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; + tor[i].x += t1tmp; + tor[i].y += t2tmp; + tor[i].z += t3tmp; } } diff --git a/src/USER-OMP/pair_soft_omp.cpp b/src/USER-OMP/pair_soft_omp.cpp index 51a43be28c..f262e1d411 100644 --- a/src/USER-OMP/pair_soft_omp.cpp +++ b/src/USER-OMP/pair_soft_omp.cpp @@ -85,11 +85,11 @@ void PairSoftOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -101,9 +101,9 @@ void PairSoftOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -114,9 +114,9 @@ void PairSoftOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -131,9 +131,9 @@ void PairSoftOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) @@ -143,9 +143,9 @@ void PairSoftOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_sw_omp.cpp b/src/USER-OMP/pair_sw_omp.cpp index 6bac2420e1..76bdc7cf79 100644 --- a/src/USER-OMP/pair_sw_omp.cpp +++ b/src/USER-OMP/pair_sw_omp.cpp @@ -78,10 +78,10 @@ void PairSWOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const tag = atom->tag; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const tag = atom->tag; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; ilist = list->ilist; @@ -97,9 +97,9 @@ void PairSWOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; itag = tag[i]; itype = map[type[i]]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; fxtmp = fytmp = fztmp = 0.0; // two-body interactions, skip half of them @@ -117,16 +117,16 @@ void PairSWOMP::eval(int iifrom, int iito, ThrData * const thr) } 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; + if (x[j].z < ztmp) continue; + if (x[j].z == ztmp && x[j].y < ytmp) continue; + if (x[j].z == ztmp && x[j].y == ytmp && x[j].x < xtmp) continue; } jtype = map[type[j]]; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; ijparam = elem2param[itype][jtype][jtype]; @@ -137,9 +137,9 @@ void PairSWOMP::eval(int iifrom, int iito, ThrData * const thr) fxtmp += delx*fpair; fytmp += dely*fpair; fztmp += delz*fpair; - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; if (EVFLAG) ev_tally_thr(this,i,j,nlocal,/* newton_pair */ 1, evdwl,0.0,fpair,delx,dely,delz,thr); @@ -152,9 +152,9 @@ void PairSWOMP::eval(int iifrom, int iito, ThrData * const thr) j &= NEIGHMASK; jtype = map[type[j]]; ijparam = elem2param[itype][jtype][jtype]; - delr1[0] = x[j][0] - xtmp; - delr1[1] = x[j][1] - ytmp; - delr1[2] = x[j][2] - ztmp; + delr1[0] = x[j].x - xtmp; + delr1[1] = x[j].y - ytmp; + delr1[2] = x[j].z - ztmp; rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2]; if (rsq1 > params[ijparam].cutsq) continue; @@ -168,9 +168,9 @@ void PairSWOMP::eval(int iifrom, int iito, ThrData * const thr) ikparam = elem2param[itype][ktype][ktype]; ijkparam = elem2param[itype][jtype][ktype]; - delr2[0] = x[k][0] - xtmp; - delr2[1] = x[k][1] - ytmp; - delr2[2] = x[k][2] - ztmp; + delr2[0] = x[k].x - xtmp; + delr2[1] = x[k].y - ytmp; + delr2[2] = x[k].z - ztmp; rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2]; if (rsq2 > params[ikparam].cutsq) continue; @@ -183,19 +183,19 @@ void PairSWOMP::eval(int iifrom, int iito, ThrData * const thr) fjxtmp += fj[0]; fjytmp += fj[1]; fjztmp += fj[2]; - f[k][0] += fk[0]; - f[k][1] += fk[1]; - f[k][2] += fk[2]; + f[k].x += fk[0]; + f[k].y += fk[1]; + f[k].z += fk[2]; if (EVFLAG) ev_tally3_thr(this,i,j,k,evdwl,0.0,fj,fk,delr1,delr2,thr); } - f[j][0] += fjxtmp; - f[j][1] += fjytmp; - f[j][2] += fjztmp; + f[j].x += fjxtmp; + f[j].y += fjytmp; + f[j].z += fjztmp; } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_table_omp.cpp b/src/USER-OMP/pair_table_omp.cpp index ee2e447a56..811de8d206 100644 --- a/src/USER-OMP/pair_table_omp.cpp +++ b/src/USER-OMP/pair_table_omp.cpp @@ -86,12 +86,12 @@ void PairTableOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const int tid = thr->get_tid(); - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -103,9 +103,9 @@ void PairTableOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -116,9 +116,9 @@ void PairTableOMP::eval(int iifrom, int iito, ThrData * const thr) factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -173,9 +173,9 @@ void PairTableOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -195,9 +195,9 @@ void PairTableOMP::eval(int iifrom, int iito, ThrData * const thr) } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_tersoff_omp.cpp b/src/USER-OMP/pair_tersoff_omp.cpp index 573ed92ba3..0e27910eb8 100644 --- a/src/USER-OMP/pair_tersoff_omp.cpp +++ b/src/USER-OMP/pair_tersoff_omp.cpp @@ -81,10 +81,10 @@ void PairTersoffOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const tag = atom->tag; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const tag = atom->tag; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; ilist = list->ilist; @@ -100,9 +100,9 @@ void PairTersoffOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; itag = tag[i]; itype = map[type[i]]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; fxtmp = fytmp = fztmp = 0.0; // two-body interactions, skip half of them @@ -120,16 +120,16 @@ void PairTersoffOMP::eval(int iifrom, int iito, ThrData * const thr) } 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; + if (x[j].z < ztmp) continue; + if (x[j].z == ztmp && x[j].y < ytmp) continue; + if (x[j].z == ztmp && x[j].y == ytmp && x[j].x < xtmp) continue; } jtype = map[type[j]]; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; iparam_ij = elem2param[itype][jtype][jtype]; @@ -140,9 +140,9 @@ void PairTersoffOMP::eval(int iifrom, int iito, ThrData * const thr) fxtmp += delx*fpair; fytmp += dely*fpair; fztmp += delz*fpair; - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; if (EVFLAG) ev_tally_thr(this,i,j,nlocal,/* newton_pair */ 1, evdwl,0.0,fpair,delx,dely,delz,thr); @@ -158,9 +158,9 @@ void PairTersoffOMP::eval(int iifrom, int iito, ThrData * const thr) jtype = map[type[j]]; iparam_ij = elem2param[itype][jtype][jtype]; - delr1[0] = x[j][0] - xtmp; - delr1[1] = x[j][1] - ytmp; - delr1[2] = x[j][2] - ztmp; + delr1[0] = x[j].x - xtmp; + delr1[1] = x[j].y - ytmp; + delr1[2] = x[j].z - ztmp; rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2]; if (rsq1 > params[iparam_ij].cutsq) continue; @@ -176,9 +176,9 @@ void PairTersoffOMP::eval(int iifrom, int iito, ThrData * const thr) ktype = map[type[k]]; iparam_ijk = elem2param[itype][jtype][ktype]; - delr2[0] = x[k][0] - xtmp; - delr2[1] = x[k][1] - ytmp; - delr2[2] = x[k][2] - ztmp; + delr2[0] = x[k].x - xtmp; + delr2[1] = x[k].y - ytmp; + delr2[2] = x[k].z - ztmp; rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2]; if (rsq2 > params[iparam_ijk].cutsq) continue; @@ -208,9 +208,9 @@ void PairTersoffOMP::eval(int iifrom, int iito, ThrData * const thr) ktype = map[type[k]]; iparam_ijk = elem2param[itype][jtype][ktype]; - delr2[0] = x[k][0] - xtmp; - delr2[1] = x[k][1] - ytmp; - delr2[2] = x[k][2] - ztmp; + delr2[0] = x[k].x - xtmp; + delr2[1] = x[k].y - ytmp; + delr2[2] = x[k].z - ztmp; rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2]; if (rsq2 > params[iparam_ijk].cutsq) continue; @@ -223,19 +223,19 @@ void PairTersoffOMP::eval(int iifrom, int iito, ThrData * const thr) fjxtmp += fj[0]; fjytmp += fj[1]; fjztmp += fj[2]; - f[k][0] += fk[0]; - f[k][1] += fk[1]; - f[k][2] += fk[2]; + f[k].x += fk[0]; + f[k].y += fk[1]; + f[k].z += fk[2]; if (VFLAG_ATOM) v_tally3_thr(i,j,k,fj,fk,delr1,delr2,thr); } - f[j][0] += fjxtmp; - f[j][1] += fjytmp; - f[j][2] += fjztmp; + f[j].x += fjxtmp; + f[j].y += fjytmp; + f[j].z += fjztmp; } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_tersoff_table_omp.cpp b/src/USER-OMP/pair_tersoff_table_omp.cpp index 4560975b11..a271f18b45 100644 --- a/src/USER-OMP/pair_tersoff_table_omp.cpp +++ b/src/USER-OMP/pair_tersoff_table_omp.cpp @@ -98,9 +98,9 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) double evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const int tid = thr->get_tid(); @@ -114,9 +114,9 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) i = ilist[ii]; itype = map[type[i]]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; fxtmp = fytmp = fztmp = 0.0; jlist = firstneigh[i]; @@ -136,9 +136,9 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) j = jlist[neighbor_j]; j &= NEIGHMASK; - dr_ij[0] = xtmp - x[j][0]; - dr_ij[1] = ytmp - x[j][1]; - dr_ij[2] = ztmp - x[j][2]; + dr_ij[0] = xtmp - x[j].x; + dr_ij[1] = ytmp - x[j].y; + dr_ij[2] = ztmp - x[j].z; r_ij = dr_ij[0]*dr_ij[0] + dr_ij[1]*dr_ij[1] + dr_ij[2]*dr_ij[2]; jtype = map[type[j]]; @@ -176,9 +176,9 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) ikparam = elem2param[itype][ktype][ktype]; ijkparam = elem2param[itype][jtype][ktype]; - dr_ik[0] = xtmp -x[k][0]; - dr_ik[1] = ytmp -x[k][1]; - dr_ik[2] = ztmp -x[k][2]; + dr_ik[0] = xtmp -x[k].x; + dr_ik[1] = ytmp -x[k].y; + dr_ik[2] = ztmp -x[k].z; r_ik = dr_ik[0]*dr_ik[0] + dr_ik[1]*dr_ik[1] + dr_ik[2]*dr_ik[2]; if (r_ik > params[ikparam].cutsq) continue; @@ -223,9 +223,9 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) j = jlist[neighbor_j]; j &= NEIGHMASK; - dr_ij[0] = xtmp - x[j][0]; - dr_ij[1] = ytmp - x[j][1]; - dr_ij[2] = ztmp - x[j][2]; + dr_ij[0] = xtmp - x[j].x; + dr_ij[1] = ytmp - x[j].y; + dr_ij[2] = ztmp - x[j].z; r_ij = dr_ij[0]*dr_ij[0] + dr_ij[1]*dr_ij[1] + dr_ij[2]*dr_ij[2]; jtype = map[type[j]]; @@ -276,9 +276,9 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) ikparam = elem2param[itype][ktype][ktype]; ijkparam = elem2param[itype][jtype][ktype]; - dr_ik[0] = xtmp -x[k][0]; - dr_ik[1] = ytmp -x[k][1]; - dr_ik[2] = ztmp -x[k][2]; + dr_ik[0] = xtmp -x[k].x; + dr_ik[1] = ytmp -x[k].y; + dr_ik[2] = ztmp -x[k].z; r_ik = dr_ik[0]*dr_ik[0] + dr_ik[1]*dr_ik[1] + dr_ik[2]*dr_ik[2]; if (r_ik > params[ikparam].cutsq) continue; @@ -309,9 +309,9 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) ikparam = elem2param[itype][ktype][ktype]; ijkparam = elem2param[itype][jtype][ktype]; - dr_ik[0] = xtmp -x[k][0]; - dr_ik[1] = ytmp -x[k][1]; - dr_ik[2] = ztmp -x[k][2]; + dr_ik[0] = xtmp -x[k].x; + dr_ik[1] = ytmp -x[k].y; + dr_ik[2] = ztmp -x[k].z; r_ik = dr_ik[0]*dr_ik[0] + dr_ik[1]*dr_ik[1] + dr_ik[2]*dr_ik[2]; if (r_ik > params[ikparam].cutsq) continue; @@ -349,9 +349,9 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) f_ij[1] = factor_force_ij * directorCos_ij_y; f_ij[2] = factor_force_ij * directorCos_ij_z; - f[j][0] += f_ij[0]; - f[j][1] += f_ij[1]; - f[j][2] += f_ij[2]; + f[j].x += f_ij[0]; + f[j].y += f_ij[1]; + f[j].z += f_ij[2]; fxtmp -= f_ij[0]; fytmp -= f_ij[1]; @@ -376,9 +376,9 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) ikparam = elem2param[itype][ktype][ktype]; ijkparam = elem2param[itype][jtype][ktype]; - dr_ik[0] = xtmp -x[k][0]; - dr_ik[1] = ytmp -x[k][1]; - dr_ik[2] = ztmp -x[k][2]; + dr_ik[0] = xtmp -x[k].x; + dr_ik[1] = ytmp -x[k].y; + dr_ik[2] = ztmp -x[k].z; r_ik = dr_ik[0]*dr_ik[0] + dr_ik[1]*dr_ik[1] + dr_ik[2]*dr_ik[2]; if (r_ik > params[ikparam].cutsq) continue; @@ -417,13 +417,13 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) f_ik[2] = factor_1_force3_ik * (directorCos_ik_z*cosTeta - directorCos_ij_z) + factor_2_force3_ik * directorCos_ik_z; - f[j][0] -= f_ij[0]; - f[j][1] -= f_ij[1]; - f[j][2] -= f_ij[2]; + f[j].x -= f_ij[0]; + f[j].y -= f_ij[1]; + f[j].z -= f_ij[2]; - f[k][0] -= f_ik[0]; - f[k][1] -= f_ik[1]; - f[k][2] -= f_ik[2]; + f[k].x -= f_ik[0]; + f[k].y -= f_ik[1]; + f[k].z -= f_ik[2]; fxtmp += f_ij[0] + f_ik[0]; fytmp += f_ij[1] + f_ik[1]; @@ -442,9 +442,9 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) ikparam = elem2param[itype][ktype][ktype]; ijkparam = elem2param[itype][jtype][ktype]; - dr_ik[0] = xtmp -x[k][0]; - dr_ik[1] = ytmp -x[k][1]; - dr_ik[2] = ztmp -x[k][2]; + dr_ik[0] = xtmp -x[k].x; + dr_ik[1] = ytmp -x[k].y; + dr_ik[2] = ztmp -x[k].z; r_ik = dr_ik[0]*dr_ik[0] + dr_ik[1]*dr_ik[1] + dr_ik[2]*dr_ik[2]; if (r_ik > params[ikparam].cutsq) continue; @@ -483,13 +483,13 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) f_ik[2] = factor_1_force3_ik * (directorCos_ik_z*cosTeta - directorCos_ij_z) + factor_2_force3_ik * directorCos_ik_z; - f[j][0] -= f_ij[0]; - f[j][1] -= f_ij[1]; - f[j][2] -= f_ij[2]; + f[j].x -= f_ij[0]; + f[j].y -= f_ij[1]; + f[j].z -= f_ij[2]; - f[k][0] -= f_ik[0]; - f[k][1] -= f_ik[1]; - f[k][2] -= f_ik[2]; + f[k].x -= f_ik[0]; + f[k].y -= f_ik[1]; + f[k].z -= f_ik[2]; fxtmp += f_ij[0] + f_ik[0]; fytmp += f_ij[1] + f_ik[1]; @@ -499,9 +499,9 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) } } // loop on J - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } // loop on I } diff --git a/src/USER-OMP/pair_tersoff_zbl_omp.cpp b/src/USER-OMP/pair_tersoff_zbl_omp.cpp index f143312e0a..9c0f397118 100644 --- a/src/USER-OMP/pair_tersoff_zbl_omp.cpp +++ b/src/USER-OMP/pair_tersoff_zbl_omp.cpp @@ -32,8 +32,10 @@ #include "error.h" #include "math_const.h" +#include "math_special.h" using namespace LAMMPS_NS; using namespace MathConst; +using namespace MathSpecial; #define MAXLINE 1024 #define DELTA 4 @@ -53,7 +55,7 @@ static double F_fermi(const double r, const double expsc, const double cut) static double F_fermi_d(const double r, const double expsc, const double cut) { - return expsc*exp(-expsc*(r-cut)) / pow(1.0 + exp(-expsc*(r-cut)),2.0); + return expsc*exp(-expsc*(r-cut)) / square(1.0 + exp(-expsc*(r-cut))); } /* ---------------------------------------------------------------------- */ @@ -268,7 +270,7 @@ void PairTersoffZBLOMP::repulsive(Param *param, double rsq, double &fforce, // ZBL repulsive portion - double esq = pow(global_e,2.0); + double esq = square(global_e); double a_ij = (0.8854*global_a_0) / (pow(param->Z_i,0.23) + pow(param->Z_j,0.23)); double premult = (param->Z_i * param->Z_j * esq)/(4.0*MY_PI*global_epsilon_0); @@ -279,8 +281,8 @@ void PairTersoffZBLOMP::repulsive(Param *param, double rsq, double &fforce, 0.9423*0.5099*exp(-0.9423*r_ov_a) - 0.4029*0.2802*exp(-0.4029*r_ov_a) - 0.2016*0.02817*exp(-0.2016*r_ov_a)); - double fforce_ZBL = premult*-pow(r,-2.0)* phi + premult*pow(r,-1.0)*dphi; - double eng_ZBL = premult*(1.0/r)*phi; + double fforce_ZBL = premult*-rsq* phi + premult/r*dphi; + double eng_ZBL = premult/r*phi; // combine two parts with smoothing by Fermi-like function diff --git a/src/USER-OMP/pair_yukawa_colloid_omp.cpp b/src/USER-OMP/pair_yukawa_colloid_omp.cpp index e66d1bb2bf..36b5d82c0b 100644 --- a/src/USER-OMP/pair_yukawa_colloid_omp.cpp +++ b/src/USER-OMP/pair_yukawa_colloid_omp.cpp @@ -81,12 +81,12 @@ void PairYukawaColloidOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const double * const radius = atom->radius; - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const radius = atom->radius; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -98,9 +98,9 @@ void PairYukawaColloidOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; radi = radius[i]; itype = type[i]; jlist = firstneigh[i]; @@ -112,9 +112,9 @@ void PairYukawaColloidOMP::eval(int iifrom, int iito, ThrData * const thr) factor = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; radj = radius[j]; jtype = type[j]; @@ -131,9 +131,9 @@ void PairYukawaColloidOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -144,9 +144,9 @@ void PairYukawaColloidOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } } diff --git a/src/USER-OMP/pair_yukawa_omp.cpp b/src/USER-OMP/pair_yukawa_omp.cpp index 3028901a9e..ba2345983c 100644 --- a/src/USER-OMP/pair_yukawa_omp.cpp +++ b/src/USER-OMP/pair_yukawa_omp.cpp @@ -81,11 +81,11 @@ void PairYukawaOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const double * const * const x = atom->x; - double * const * const f = thr->get_f(); - const int * const type = atom->type; + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; - const double * const special_lj = force->special_lj; + const double * _noalias const special_lj = force->special_lj; double fxtmp,fytmp,fztmp; ilist = list->ilist; @@ -97,9 +97,9 @@ void PairYukawaOMP::eval(int iifrom, int iito, ThrData * const thr) for (ii = iifrom; ii < iito; ++ii) { i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -110,9 +110,9 @@ void PairYukawaOMP::eval(int iifrom, int iito, ThrData * const thr) factor = special_lj[sbmask(j)]; j &= NEIGHMASK; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; @@ -129,9 +129,9 @@ void PairYukawaOMP::eval(int iifrom, int iito, ThrData * const thr) fytmp += dely*fpair; fztmp += delz*fpair; if (NEWTON_PAIR || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; } if (EFLAG) { @@ -143,9 +143,9 @@ void PairYukawaOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl,0.0,fpair,delx,dely,delz,thr); } } - f[i][0] += fxtmp; - f[i][1] += fytmp; - f[i][2] += fztmp; + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; } }