diff --git a/src/USER-OMP/fix_nh_asphere_omp.cpp b/src/USER-OMP/fix_nh_asphere_omp.cpp index fe74b1e67f..28a4079ead 100644 --- a/src/USER-OMP/fix_nh_asphere_omp.cpp +++ b/src/USER-OMP/fix_nh_asphere_omp.cpp @@ -32,7 +32,7 @@ using namespace FixConst; enum{NOBIAS,BIAS}; -typedef struct { double x,y,z; } vec3_t; +typedef struct { double x,y,z; } dbl3_t; #if defined(__GNUC__) #define _noalias __restrict #else @@ -75,10 +75,10 @@ void FixNHAsphereOMP::init() void FixNHAsphereOMP::nve_v() { - vec3_t * _noalias const v = (vec3_t *) atom->v[0]; - vec3_t * _noalias const angmom = (vec3_t *) atom->angmom[0]; - const vec3_t * _noalias const f = (vec3_t *) atom->f[0]; - const vec3_t * _noalias const torque = (vec3_t *) atom->torque[0]; + dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + dbl3_t * _noalias const angmom = (dbl3_t *) atom->angmom[0]; + const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + const dbl3_t * _noalias const torque = (dbl3_t *) atom->torque[0]; const double * _noalias const rmass = atom->rmass; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; @@ -109,9 +109,9 @@ void FixNHAsphereOMP::nve_v() void FixNHAsphereOMP::nve_x() { - vec3_t * _noalias const x = (vec3_t *) atom->x[0]; - const vec3_t * _noalias const v = (vec3_t *) atom->v[0]; - vec3_t * _noalias const angmom = (vec3_t *) atom->angmom[0]; + 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 angmom = (dbl3_t *) atom->angmom[0]; const double * _noalias const rmass = atom->rmass; const int * _noalias const mask = atom->mask; AtomVecEllipsoid::Bonus * _noalias const bonus = avec->bonus; @@ -163,8 +163,8 @@ void FixNHAsphereOMP::nve_x() void FixNHAsphereOMP::nh_v_temp() { - vec3_t * _noalias const v = (vec3_t *) atom->v[0]; - vec3_t * _noalias const angmom = (vec3_t *) atom->angmom[0]; + dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + dbl3_t * _noalias const angmom = (dbl3_t *) atom->angmom[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; int i; @@ -188,6 +188,7 @@ void FixNHAsphereOMP::nh_v_temp() #pragma omp parallel for default(none) private(i) schedule(static) #endif for (i = 0; i < nlocal; i++) { + double buf[3]; if (mask[i] & groupbit) { temperature->remove_bias(i,&v[i].x); v[i].x *= factor_eta; diff --git a/src/USER-OMP/fix_nh_omp.cpp b/src/USER-OMP/fix_nh_omp.cpp index 41bf746059..4bcde85e03 100644 --- a/src/USER-OMP/fix_nh_omp.cpp +++ b/src/USER-OMP/fix_nh_omp.cpp @@ -33,7 +33,7 @@ enum{ISO,ANISO,TRICLINIC}; #define TILTMAX 1.5 -typedef struct { double x,y,z; } vec3_t; +typedef struct { double x,y,z; } dbl3_t; #if defined(__GNUC__) #define _noalias __restrict #else @@ -48,14 +48,12 @@ typedef struct { double x,y,z; } vec3_t; void FixNHOMP::remap() { - int i; - double oldlo,oldhi; - double expfac; + double oldlo,oldhi,expfac; - double * const * const x = atom->x; - const int * const mask = atom->mask; + double * const * _noalias const x = atom->x; + const int * _noalias const mask = atom->mask; const int nlocal = atom->nlocal; - double * const h = domain->h; + double * _noalias const h = domain->h; // omega is not used, except for book-keeping @@ -65,6 +63,7 @@ void FixNHOMP::remap() if (allremap) domain->x2lamda(nlocal); else { + int i; #if defined (_OPENMP) #pragma omp parallel for private(i) default(none) schedule(static) #endif @@ -74,7 +73,7 @@ void FixNHOMP::remap() } if (nrigid) - for (i = 0; i < nrigid; i++) + for (int i = 0; i < nrigid; i++) modify->fix[rfix[i]]->deform(0); // reset global and local box to new size/shape @@ -92,9 +91,9 @@ void FixNHOMP::remap() // // Ordering of operations preserves time symmetry. - double dto2 = dto/2.0; - double dto4 = dto/4.0; - double dto8 = dto/8.0; + const double dto2 = dto/2.0; + const double dto4 = dto/4.0; + const double dto8 = dto/8.0; // off-diagonal components, first half @@ -215,6 +214,7 @@ void FixNHOMP::remap() if (allremap) domain->lamda2x(nlocal); else { + int i; #if defined (_OPENMP) #pragma omp parallel for private(i) default(none) schedule(static) #endif @@ -224,7 +224,7 @@ void FixNHOMP::remap() } if (nrigid) - for (i = 0; i < nrigid; i++) + for (int i = 0; i < nrigid; i++) modify->fix[rfix[i]]->deform(1); } @@ -238,7 +238,7 @@ void FixNHOMP::nh_v_press() const double factor0 = exp(-dt4*(omega_dot[0]+mtk_term2)); const double factor1 = exp(-dt4*(omega_dot[1]+mtk_term2)); const double factor2 = exp(-dt4*(omega_dot[2]+mtk_term2)); - vec3_t * _noalias const v = (vec3_t *) atom->v[0]; + dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; int i; @@ -266,6 +266,7 @@ void FixNHOMP::nh_v_press() #pragma omp parallel for default(none) private(i) schedule(static) #endif for (i = 0; i < nlocal; i++) { + double buf[3]; if (mask[i] & groupbit) { temperature->remove_bias(i,&v[i].x); v[i].x *= factor0; @@ -290,8 +291,8 @@ void FixNHOMP::nh_v_press() void FixNHOMP::nve_v() { - vec3_t * _noalias const v = (vec3_t *) atom->v[0]; - const vec3_t * _noalias const f = (vec3_t *) atom->f[0]; + dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; int i; @@ -332,8 +333,8 @@ void FixNHOMP::nve_v() void FixNHOMP::nve_x() { - vec3_t * _noalias const x = (vec3_t *) atom->x[0]; - const vec3_t * _noalias const v = (vec3_t *) atom->v[0]; + dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; int i; @@ -357,7 +358,7 @@ void FixNHOMP::nve_x() void FixNHOMP::nh_v_temp() { - vec3_t * _noalias const v = (vec3_t *) atom->v[0]; + dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; int i; @@ -378,6 +379,7 @@ void FixNHOMP::nh_v_temp() #pragma omp parallel for default(none) private(i) schedule(static) #endif for (i = 0; i < nlocal; i++) { + double buf[3]; if (mask[i] & groupbit) { temperature->remove_bias(i,&v[i].x); v[i].x *= factor_eta; diff --git a/src/USER-OMP/fix_nh_sphere_omp.cpp b/src/USER-OMP/fix_nh_sphere_omp.cpp index 2e1b30983a..a180e7270f 100644 --- a/src/USER-OMP/fix_nh_sphere_omp.cpp +++ b/src/USER-OMP/fix_nh_sphere_omp.cpp @@ -30,7 +30,7 @@ enum{NOBIAS,BIAS}; #define INERTIA 0.4 // moment of inertia prefactor for sphere -typedef struct { double x,y,z; } vec3_t; +typedef struct { double x,y,z; } dbl3_t; #if defined(__GNUC__) #define _noalias __restrict #else @@ -71,10 +71,10 @@ void FixNHSphereOMP::init() void FixNHSphereOMP::nve_v() { - vec3_t * _noalias const v = (vec3_t *) atom->v[0]; - vec3_t * _noalias const omega = (vec3_t *) atom->omega[0]; - const vec3_t * _noalias const f = (vec3_t *) atom->f[0]; - const vec3_t * _noalias const torque = (vec3_t *) atom->torque[0]; + dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + dbl3_t * _noalias const omega = (dbl3_t *) atom->omega[0]; + const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + const dbl3_t * _noalias const torque = (dbl3_t *) atom->torque[0]; const double * _noalias const radius = atom->radius; const double * _noalias const rmass = atom->rmass; const int * _noalias const mask = atom->mask; @@ -116,8 +116,8 @@ void FixNHSphereOMP::nve_v() void FixNHSphereOMP::nh_v_temp() { - vec3_t * _noalias const v = (vec3_t *) atom->v[0]; - vec3_t * _noalias const omega = (vec3_t *) atom->omega[0]; + dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + dbl3_t * _noalias const omega = (dbl3_t *) atom->omega[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; int i; @@ -141,6 +141,7 @@ void FixNHSphereOMP::nh_v_temp() #pragma omp parallel for default(none) private(i) schedule(static) #endif for (i = 0; i < nlocal; i++) { + double buf[3]; if (mask[i] & groupbit) { temperature->remove_bias(i,&v[i].x); v[i].x *= factor_eta; diff --git a/src/USER-OMP/fix_nve_omp.cpp b/src/USER-OMP/fix_nve_omp.cpp index 938e0bdec0..dd0ae12a5c 100644 --- a/src/USER-OMP/fix_nve_omp.cpp +++ b/src/USER-OMP/fix_nve_omp.cpp @@ -18,7 +18,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -typedef struct { double x,y,z; } vec3_t; +typedef struct { double x,y,z; } dbl3_t; #if defined(__GNUC__) #define _noalias __restrict #else @@ -38,9 +38,9 @@ void FixNVEOMP::initial_integrate(int vflag) { // update v and x of atoms in group - vec3_t * _noalias const x = (vec3_t *) atom->x[0]; - vec3_t * _noalias const v = (vec3_t *) atom->v[0]; - const vec3_t * _noalias const f = (vec3_t *) atom->f[0]; + dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; const int * const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; int i; @@ -86,8 +86,8 @@ void FixNVEOMP::final_integrate() { // update v of atoms in group - vec3_t * _noalias const v = (vec3_t *) atom->v[0]; - const vec3_t * _noalias const f = (vec3_t *) atom->f[0]; + dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; const int * const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; int i; diff --git a/src/USER-OMP/fix_nvt_sllod_omp.cpp b/src/USER-OMP/fix_nvt_sllod_omp.cpp index c99b33268a..a3d1c5b04d 100644 --- a/src/USER-OMP/fix_nvt_sllod_omp.cpp +++ b/src/USER-OMP/fix_nvt_sllod_omp.cpp @@ -33,7 +33,7 @@ using namespace FixConst; enum{NO_REMAP,X_REMAP,V_REMAP}; // same as fix_deform.cpp -typedef struct { double x,y,z; } vec3_t; +typedef struct { double x,y,z; } dbl3_t; #if defined(__GNUC__) #define _noalias __restrict #else @@ -112,7 +112,7 @@ void FixNVTSllodOMP::nh_v_temp() // calculate temperature since some computes require temp // computed on current nlocal atoms to remove bias - vec3_t * _noalias const v = (vec3_t *) atom->v[0]; + dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; int i; @@ -126,7 +126,7 @@ void FixNVTSllodOMP::nh_v_temp() #pragma omp parallel for default(none) private(i) shared(h_two) schedule(static) #endif for (i = 0; i < nlocal; i++) { - double vdelu0,vdelu1,vdelu2; + double vdelu0,vdelu1,vdelu2,buf[3]; if (mask[i] & groupbit) { vdelu0 = h_two[0]*v[i].x + h_two[5]*v[i].y + h_two[4]*v[i].z; vdelu1 = h_two[1]*v[i].y + h_two[3]*v[i].z;