diff --git a/src/USER-OMP/angle_charmm_omp.cpp b/src/USER-OMP/angle_charmm_omp.cpp index 6017237782..e346736948 100644 --- a/src/USER-OMP/angle_charmm_omp.cpp +++ b/src/USER-OMP/angle_charmm_omp.cpp @@ -95,6 +95,7 @@ void AngleCharmmOMP::eval(int nfrom, int nto, ThrData * const thr) 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; + eangle = 0.0; for (n = nfrom; n < nto; n++) { i1 = anglelist[n].a; diff --git a/src/USER-OMP/angle_fourier_omp.cpp b/src/USER-OMP/angle_fourier_omp.cpp index e6e23680c8..4d22a70b69 100644 --- a/src/USER-OMP/angle_fourier_omp.cpp +++ b/src/USER-OMP/angle_fourier_omp.cpp @@ -94,6 +94,7 @@ void AngleFourierOMP::eval(int nfrom, int nto, ThrData * const thr) 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; + eangle = 0.0; for (n = nfrom; n < nto; n++) { i1 = anglelist[n].a; diff --git a/src/USER-OMP/angle_harmonic_omp.cpp b/src/USER-OMP/angle_harmonic_omp.cpp index dbadf71823..69b20f2691 100644 --- a/src/USER-OMP/angle_harmonic_omp.cpp +++ b/src/USER-OMP/angle_harmonic_omp.cpp @@ -94,6 +94,7 @@ void AngleHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) 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; + eangle = 0.0; for (n = nfrom; n < nto; n++) { i1 = anglelist[n].a; diff --git a/src/USER-OMP/bond_harmonic_omp.cpp b/src/USER-OMP/bond_harmonic_omp.cpp index 8b554afb57..7be27fbef5 100644 --- a/src/USER-OMP/bond_harmonic_omp.cpp +++ b/src/USER-OMP/bond_harmonic_omp.cpp @@ -87,6 +87,7 @@ void BondHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) 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; + ebond = 0.0; for (n = nfrom; n < nto; n++) { i1 = bondlist[n].a; diff --git a/src/USER-OMP/bond_harmonic_shift_omp.cpp b/src/USER-OMP/bond_harmonic_shift_omp.cpp index b6bd3095eb..43498327c8 100644 --- a/src/USER-OMP/bond_harmonic_shift_omp.cpp +++ b/src/USER-OMP/bond_harmonic_shift_omp.cpp @@ -87,6 +87,7 @@ void BondHarmonicShiftOMP::eval(int nfrom, int nto, ThrData * const thr) 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; + ebond = 0.0; for (n = nfrom; n < nto; n++) { i1 = bondlist[n].a; diff --git a/src/USER-OMP/bond_nonlinear_omp.cpp b/src/USER-OMP/bond_nonlinear_omp.cpp index 5034916175..57d547bb04 100644 --- a/src/USER-OMP/bond_nonlinear_omp.cpp +++ b/src/USER-OMP/bond_nonlinear_omp.cpp @@ -87,6 +87,7 @@ void BondNonlinearOMP::eval(int nfrom, int nto, ThrData * const thr) 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; + ebond = 0.0; for (n = nfrom; n < nto; n++) { i1 = bondlist[n].a; diff --git a/src/USER-OMP/dihedral_charmm_omp.cpp b/src/USER-OMP/dihedral_charmm_omp.cpp index e08b9b4b8d..b9a6df2760 100644 --- a/src/USER-OMP/dihedral_charmm_omp.cpp +++ b/src/USER-OMP/dihedral_charmm_omp.cpp @@ -103,7 +103,7 @@ void DihedralCharmmOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,rsq,r2inv,r6inv; double forcecoul,forcelj,fpair,ecoul,evdwl; - edihedral = 0.0; + ecoul = evdwl = edihedral = 0.0; const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; diff --git a/src/USER-OMP/pair_tip4p_cut_omp.cpp b/src/USER-OMP/pair_tip4p_cut_omp.cpp index 54ba68909b..d9f75cba9a 100644 --- a/src/USER-OMP/pair_tip4p_cut_omp.cpp +++ b/src/USER-OMP/pair_tip4p_cut_omp.cpp @@ -65,8 +65,7 @@ void PairTIP4PCutOMP::compute(int eflag, int vflag) if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - const int nlocal = atom->nlocal; - const int nall = nlocal + atom->nghost; + const int nall = atom->nlocal + atom->nghost; // reallocate hneigh_thr & newsite_thr if necessary // initialize hneigh_thr[0] to -1 on steps when reneighboring occurred @@ -140,9 +139,7 @@ void PairTIP4PCutOMP::eval(int iifrom, int iito, ThrData * const thr) 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 * _noalias const special_coul = force->special_coul; - const double * _noalias const special_lj = force->special_lj; const double qqrd2e = force->qqrd2e; const double cut_coulsqplus = (cut_coul+2.0*qdist) * (cut_coul+2.0*qdist); diff --git a/src/USER-OMP/pppm_disp_omp.cpp b/src/USER-OMP/pppm_disp_omp.cpp index 7871cde401..a2ac4f1278 100644 --- a/src/USER-OMP/pppm_disp_omp.cpp +++ b/src/USER-OMP/pppm_disp_omp.cpp @@ -58,9 +58,8 @@ void PPPMDispOMP::allocate() { PPPMDisp::allocate(); - const int nthreads = comm->nthreads; - #if defined(_OPENMP) + const int nthreads = comm->nthreads; #pragma omp parallel default(none) #endif { @@ -133,12 +132,11 @@ void PPPMDispOMP::compute_gf() double unitky = (2.0*MY_PI/yprd); double unitkz = (2.0*MY_PI/zprd_slab); - int tid,nn,nnfrom,nnto,nx,ny,nz,k,l,m; + int tid,nn,nnfrom,nnto,k,l,m; int kper,lper,mper; double snx,sny,snz,snx2,sny2,snz2; double sqk; double argx,argy,argz,wx,wy,wz,sx,sy,sz,qx,qy,qz; - double sum1,dot1,dot2; double numerator,denominator; const int nnx = nxhi_fft-nxlo_fft+1; @@ -337,7 +335,6 @@ void PPPMDispOMP::particle_map(double dxinv, double dyinv, int nxhi_o, int nyhi_o, int nzhi_o) { - const int * _noalias const type = atom->type; const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; int3_t * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; @@ -693,7 +690,6 @@ void PPPMDispOMP::make_rho_a() void PPPMDispOMP::fieldforce_c_ik() { - const int nthreads = comm->nthreads; const int nlocal = atom->nlocal; // no local atoms => nothing to do @@ -711,6 +707,7 @@ void PPPMDispOMP::fieldforce_c_ik() const double qqrd2e = force->qqrd2e; #if defined(_OPENMP) + const int nthreads = comm->nthreads; #pragma omp parallel default(none) #endif { @@ -781,7 +778,6 @@ void PPPMDispOMP::fieldforce_c_ik() void PPPMDispOMP::fieldforce_c_ad() { - const int nthreads = comm->nthreads; const int nlocal = atom->nlocal; // no local atoms => nothing to do @@ -814,6 +810,7 @@ void PPPMDispOMP::fieldforce_c_ad() const double hz_inv = nz_pppm/zprd_slab; #if defined(_OPENMP) + const int nthreads = comm->nthreads; #pragma omp parallel default(none) #endif { @@ -835,7 +832,7 @@ void PPPMDispOMP::fieldforce_c_ad() FFT_SCALAR * const * const dr1d = static_cast(thr->get_drho1d()); int l,m,n,nx,ny,nz,mx,my,mz; - FFT_SCALAR dx,dy,dz,x0,y0,z0; + FFT_SCALAR dx,dy,dz; FFT_SCALAR ekx,eky,ekz; double sf = 0.0; double s1,s2,s3; @@ -903,7 +900,6 @@ void PPPMDispOMP::fieldforce_c_ad() void PPPMDispOMP::fieldforce_c_peratom() { - const int nthreads = comm->nthreads; const int nlocal = atom->nlocal; // no local atoms => nothing to do @@ -919,6 +915,7 @@ void PPPMDispOMP::fieldforce_c_peratom() const double * const * const x = atom->x; #if defined(_OPENMP) + const int nthreads = comm->nthreads; #pragma omp parallel default(none) #endif { @@ -937,7 +934,7 @@ void PPPMDispOMP::fieldforce_c_peratom() ThrData *thr = fix->get_thr(tid); FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); - int i,l,m,n,nx,ny,nz,mx,my,mz; + int l,m,n,nx,ny,nz,mx,my,mz; FFT_SCALAR dx,dy,dz,x0,y0,z0; FFT_SCALAR u,v0,v1,v2,v3,v4,v5; @@ -1000,7 +997,6 @@ void PPPMDispOMP::fieldforce_c_peratom() void PPPMDispOMP::fieldforce_g_ik() { - const int nthreads = comm->nthreads; const int nlocal = atom->nlocal; // no local atoms => nothing to do @@ -1014,9 +1010,9 @@ void PPPMDispOMP::fieldforce_g_ik() // ek = 3 components of E-field on particle const double * const * const x = atom->x; - const double qqrd2e = force->qqrd2e; #if defined(_OPENMP) + const int nthreads = comm->nthreads; #pragma omp parallel default(none) #endif { @@ -1090,7 +1086,6 @@ void PPPMDispOMP::fieldforce_g_ik() void PPPMDispOMP::fieldforce_g_ad() { - const int nthreads = comm->nthreads; const int nlocal = atom->nlocal; // no local atoms => nothing to do @@ -1119,6 +1114,7 @@ void PPPMDispOMP::fieldforce_g_ad() const double hz_inv = nz_pppm_6/zprd_slab; #if defined(_OPENMP) + const int nthreads = comm->nthreads; #pragma omp parallel default(none) #endif { @@ -1140,7 +1136,7 @@ void PPPMDispOMP::fieldforce_g_ad() FFT_SCALAR * const * const dr1d = static_cast(thr->get_drho1d_6()); int l,m,n,nx,ny,nz,mx,my,mz; - FFT_SCALAR dx,dy,dz,x0,y0,z0; + FFT_SCALAR dx,dy,dz; FFT_SCALAR ekx,eky,ekz; int type; double lj; @@ -1212,7 +1208,6 @@ void PPPMDispOMP::fieldforce_g_ad() void PPPMDispOMP::fieldforce_g_peratom() { - const int nthreads = comm->nthreads; const int nlocal = atom->nlocal; // no local atoms => nothing to do @@ -1227,6 +1222,7 @@ void PPPMDispOMP::fieldforce_g_peratom() const double * const * const x = atom->x; #if defined(_OPENMP) + const int nthreads = comm->nthreads; #pragma omp parallel default(none) #endif { @@ -1245,7 +1241,7 @@ void PPPMDispOMP::fieldforce_g_peratom() ThrData *thr = fix->get_thr(tid); FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d_6()); - int i,l,m,n,nx,ny,nz,mx,my,mz; + int l,m,n,nx,ny,nz,mx,my,mz; FFT_SCALAR dx,dy,dz,x0,y0,z0; FFT_SCALAR u,v0,v1,v2,v3,v4,v5; int type; @@ -1311,7 +1307,6 @@ void PPPMDispOMP::fieldforce_g_peratom() void PPPMDispOMP::fieldforce_a_ik() { - const int nthreads = comm->nthreads; const int nlocal = atom->nlocal; // no local atoms => nothing to do @@ -1325,9 +1320,9 @@ void PPPMDispOMP::fieldforce_a_ik() // ek = 3 components of E-field on particle const double * const * const x = atom->x; - const double qqrd2e = force->qqrd2e; #if defined(_OPENMP) + const int nthreads = comm->nthreads; #pragma omp parallel default(none) #endif { @@ -1433,7 +1428,6 @@ void PPPMDispOMP::fieldforce_a_ik() void PPPMDispOMP::fieldforce_a_ad() { - const int nthreads = comm->nthreads; const int nlocal = atom->nlocal; // no local atoms => nothing to do @@ -1462,6 +1456,7 @@ void PPPMDispOMP::fieldforce_a_ad() const double hz_inv = nz_pppm_6/zprd_slab; #if defined(_OPENMP) + const int nthreads = comm->nthreads; #pragma omp parallel default(none) #endif { @@ -1622,7 +1617,6 @@ void PPPMDispOMP::fieldforce_a_ad() void PPPMDispOMP::fieldforce_a_peratom() { - const int nthreads = comm->nthreads; const int nlocal = atom->nlocal; // no local atoms => nothing to do @@ -1637,6 +1631,7 @@ void PPPMDispOMP::fieldforce_a_peratom() const double * const * const x = atom->x; #if defined(_OPENMP) + const int nthreads = comm->nthreads; #pragma omp parallel default(none) #endif { @@ -1655,7 +1650,7 @@ void PPPMDispOMP::fieldforce_a_peratom() ThrData *thr = fix->get_thr(tid); FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d_6()); - int i,l,m,n,nx,ny,nz,mx,my,mz; + int l,m,n,nx,ny,nz,mx,my,mz; FFT_SCALAR dx,dy,dz,x0,y0,z0; FFT_SCALAR u0,v00,v10,v20,v30,v40,v50; FFT_SCALAR u1,v01,v11,v21,v31,v41,v51;