From f55b74a85f706b901230ce457c8514c556313be2 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 16 Feb 2012 16:13:15 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@7804 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/USER-CG-CMM/pair_lj_sdk_coul_long.cpp | 82 ++++++++----------- src/USER-CUDA/fix_npt_cuda.cpp | 4 - src/USER-CUDA/fix_nvt_cuda.cpp | 4 - src/USER-CUDA/fix_shake_cuda.cpp | 3 +- src/USER-CUDA/pair_born_coul_long_cuda.cpp | 2 +- src/USER-CUDA/pair_buck_coul_cut_cuda.cpp | 2 +- src/USER-CUDA/pair_buck_coul_long_cuda.cpp | 2 +- src/USER-CUDA/pair_buck_cuda.cpp | 2 +- .../pair_lj_charmm_coul_long_cuda.cpp | 2 +- .../pair_lj_class2_coul_long_cuda.cpp | 2 +- src/USER-CUDA/pair_lj_cut_coul_long_cuda.cpp | 2 +- src/USER-MISC/pair_meam_spline.h | 8 +- src/USER-OMP/Install.sh | 5 +- src/USER-OMP/fix_omp.cpp | 20 ++++- src/USER-OMP/fix_omp.h | 6 +- src/USER-OMP/neigh_derive_omp.cpp | 12 +-- src/USER-OMP/pair_adp_omp.cpp | 2 + src/USER-OMP/pair_airebo_omp.cpp | 2 + src/USER-OMP/pair_born_coul_long_omp.cpp | 2 + src/USER-OMP/pair_born_coul_wolf_omp.cpp | 2 + src/USER-OMP/pair_born_omp.cpp | 2 + src/USER-OMP/pair_brownian_omp.cpp | 2 + src/USER-OMP/pair_brownian_poly_omp.cpp | 2 + src/USER-OMP/pair_buck_coul_cut_omp.cpp | 2 + src/USER-OMP/pair_buck_coul_long_omp.cpp | 2 + src/USER-OMP/pair_buck_coul_omp.cpp | 2 + src/USER-OMP/pair_buck_omp.cpp | 2 + src/USER-OMP/pair_cdeam_omp.cpp | 2 + src/USER-OMP/pair_colloid_omp.cpp | 2 + src/USER-OMP/pair_comb_omp.cpp | 2 + src/USER-OMP/pair_coul_cut_omp.cpp | 2 + src/USER-OMP/pair_coul_debye_omp.cpp | 2 + src/USER-OMP/pair_coul_diel_omp.cpp | 2 + src/USER-OMP/pair_coul_long_omp.cpp | 2 + src/USER-OMP/pair_coul_wolf_omp.cpp | 2 + src/USER-OMP/pair_dipole_cut_omp.cpp | 2 + src/USER-OMP/pair_dipole_sf_omp.cpp | 2 + src/USER-OMP/pair_dpd_omp.cpp | 2 + src/USER-OMP/pair_dpd_tstat_omp.cpp | 2 + src/USER-OMP/pair_eam_omp.cpp | 2 + src/USER-OMP/pair_edip_omp.cpp | 2 + src/USER-OMP/pair_eim_omp.cpp | 2 + src/USER-OMP/pair_gauss_cut_omp.cpp | 2 + src/USER-OMP/pair_gauss_omp.cpp | 2 + src/USER-OMP/pair_gayberne_omp.cpp | 2 + src/USER-OMP/pair_gran_hertz_history_omp.cpp | 2 + src/USER-OMP/pair_gran_hooke_history_omp.cpp | 2 + src/USER-OMP/pair_gran_hooke_omp.cpp | 2 + src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp | 3 +- .../pair_hbond_dreiding_morse_omp.cpp | 3 +- src/USER-OMP/pair_line_lj_omp.cpp | 2 + src/USER-OMP/pair_lj96_cut_omp.cpp | 2 + ...air_lj_charmm_coul_charmm_implicit_omp.cpp | 2 + .../pair_lj_charmm_coul_charmm_omp.cpp | 2 + src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp | 2 + src/USER-OMP/pair_lj_charmm_coul_pppm_omp.cpp | 4 +- src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp | 2 + src/USER-OMP/pair_lj_class2_coul_long_omp.cpp | 2 + src/USER-OMP/pair_lj_class2_coul_pppm_omp.cpp | 4 +- src/USER-OMP/pair_lj_class2_omp.cpp | 2 + src/USER-OMP/pair_lj_coul_omp.cpp | 2 + src/USER-OMP/pair_lj_cubic_omp.cpp | 2 + src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp | 2 + src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp | 2 + src/USER-OMP/pair_lj_cut_coul_long_omp.cpp | 2 + .../pair_lj_cut_coul_long_tip4p_omp.cpp | 2 + src/USER-OMP/pair_lj_cut_coul_pppm_omp.cpp | 4 +- .../pair_lj_cut_coul_pppm_tip4p_omp.cpp | 2 + src/USER-OMP/pair_lj_cut_omp.cpp | 2 + src/USER-OMP/pair_lj_expand_omp.cpp | 2 + .../pair_lj_gromacs_coul_gromacs_omp.cpp | 2 + src/USER-OMP/pair_lj_gromacs_omp.cpp | 2 + src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp | 50 +++++------ src/USER-OMP/pair_lj_sdk_omp.cpp | 2 + src/USER-OMP/pair_lj_sf_omp.cpp | 2 + src/USER-OMP/pair_lj_smooth_linear_omp.cpp | 2 + src/USER-OMP/pair_lj_smooth_omp.cpp | 2 + src/USER-OMP/pair_lubricate_omp.cpp | 2 + src/USER-OMP/pair_lubricate_poly_omp.cpp | 2 + src/USER-OMP/pair_morse_omp.cpp | 2 + src/USER-OMP/pair_peri_lps_omp.cpp | 2 + src/USER-OMP/pair_peri_pmb_omp.cpp | 2 + src/USER-OMP/pair_resquared_omp.cpp | 2 + src/USER-OMP/pair_soft_omp.cpp | 2 + src/USER-OMP/pair_sw_omp.cpp | 2 + src/USER-OMP/pair_table_omp.cpp | 2 + src/USER-OMP/pair_tersoff_omp.cpp | 2 + src/USER-OMP/pair_tersoff_table_omp.cpp | 2 + src/USER-OMP/pair_tri_lj_omp.cpp | 2 + src/USER-OMP/pair_yukawa_colloid_omp.cpp | 2 + src/USER-OMP/pair_yukawa_omp.cpp | 2 + src/USER-OMP/thr_omp.cpp | 50 ++++++++--- src/pair.cpp | 2 + src/pair.h | 6 +- src/pair_beck.h | 11 +-- src/suffix.h | 29 +++++++ 96 files changed, 326 insertions(+), 136 deletions(-) create mode 100644 src/suffix.h diff --git a/src/USER-CG-CMM/pair_lj_sdk_coul_long.cpp b/src/USER-CG-CMM/pair_lj_sdk_coul_long.cpp index 90e102e993..11d4aec318 100644 --- a/src/USER-CG-CMM/pair_lj_sdk_coul_long.cpp +++ b/src/USER-CG-CMM/pair_lj_sdk_coul_long.cpp @@ -118,8 +118,6 @@ void PairLJSDKCoulLong::eval() double r,rsq,r2inv,forcecoul,forcelj,factor_coul,factor_lj; double grij,expm2,prefactor,t,erfc; - evdwl = ecoul = 0.0; - const double * const * const x = atom->x; double * const * const f = atom->f; const double * const q = atom->q; @@ -151,6 +149,8 @@ void PairLJSDKCoulLong::eval() const int jnum = numneigh[i]; for (jj = 0; jj < jnum; jj++) { + forcecoul = forcelj = evdwl = ecoul = 0.0; + j = jlist[jj]; factor_lj = special_lj[sbmask(j)]; factor_coul = special_coul[sbmask(j)]; @@ -175,7 +175,13 @@ void PairLJSDKCoulLong::eval() erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2; prefactor = qqrd2e * qtmp*q[j]/r; forcecoul = prefactor * (erfc + EWALD_F*grij*expm2); - if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; + if (EFLAG) + ecoul = prefactor*erfc; + if (factor_coul < 1.0) { + forcecoul -= (1.0-factor_coul)*prefactor; + if (EFLAG) + ecoul -= (1.0-factor_coul)*prefactor; + } } else { union_int_float_t rsq_lookup; rsq_lookup.f = rsq; @@ -184,15 +190,16 @@ void PairLJSDKCoulLong::eval() fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable]; table = ftable[itable] + fraction*dftable[itable]; forcecoul = qtmp*q[j] * table; + if (EFLAG) + ecoul = qtmp*q[j] * table; if (factor_coul < 1.0) { table = ctable[itable] + fraction*dctable[itable]; prefactor = qtmp*q[j] * table; forcecoul -= (1.0-factor_coul)*prefactor; + if (EFLAG) + ecoul -= (1.0-factor_coul)*prefactor; } } - } else { - forcecoul = 0.0; - ecoul = 0.0; } if (rsq < cut_ljsq[itype][jtype]) { @@ -205,7 +212,7 @@ void PairLJSDKCoulLong::eval() if (EFLAG) evdwl = r4inv*(lj3[itype][jtype]*r4inv*r4inv - lj4[itype][jtype]) - offset[itype][jtype]; - + } else if (ljt == LJ9_6) { const double r3inv = r2inv*sqrt(r2inv); const double r6inv = r3inv*r3inv; @@ -223,12 +230,12 @@ void PairLJSDKCoulLong::eval() evdwl = r6inv*(lj3[itype][jtype]*r6inv - lj4[itype][jtype]) - offset[itype][jtype]; } - } else { - forcelj=0.0; - evdwl = 0.0; + forcelj *= factor_lj; + if (EFLAG) + evdwl *= factor_lj; } - fpair = (forcecoul + factor_lj*forcelj) * r2inv; + fpair = (forcecoul + forcelj) * r2inv; fxtmp += delx*fpair; fytmp += dely*fpair; @@ -239,24 +246,9 @@ void PairLJSDKCoulLong::eval() f[j][2] -= delz*fpair; } - if (EFLAG) { - if (rsq < cut_coulsq) { - if (!ncoultablebits || rsq <= tabinnersq) - ecoul = prefactor*erfc; - else { - table = etable[itable] + fraction*detable[itable]; - ecoul = qtmp*q[j] * table; - } - if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor; - } else ecoul = 0.0; - - if (rsq < cut_ljsq[itype][jtype]) { - evdwl *= factor_lj; - } else evdwl = 0.0; - } - if (EVFLAG) ev_tally(i,j,nlocal,NEWTON_PAIR, - evdwl,ecoul,fpair,delx,dely,delz); + evdwl,ecoul,fpair,delx,dely,delz); + } } f[i][0] += fxtmp; @@ -662,6 +654,8 @@ double PairLJSDKCoulLong::single(int i, int j, int itype, int jtype, double fraction,table,forcecoul,forcelj,phicoul,philj; int itable; + forcecoul = forcelj = phicoul = philj = 0.0; + r2inv = 1.0/rsq; if (rsq < cut_coulsq) { if (!ncoultablebits || rsq <= tabinnersq) { @@ -672,7 +666,11 @@ double PairLJSDKCoulLong::single(int i, int j, int itype, int jtype, erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2; prefactor = force->qqrd2e * atom->q[i]*atom->q[j]/r; forcecoul = prefactor * (erfc + EWALD_F*grij*expm2); - if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; + phicoul = prefactor*erfc; + if (factor_coul < 1.0) { + forcecoul -= (1.0-factor_coul)*prefactor; + phicoul -= (1.0-factor_coul)*prefactor; + } } else { union_int_float_t rsq_lookup_single; rsq_lookup_single.f = rsq; @@ -681,13 +679,16 @@ double PairLJSDKCoulLong::single(int i, int j, int itype, int jtype, fraction = (rsq_lookup_single.f - rtable[itable]) * drtable[itable]; table = ftable[itable] + fraction*dftable[itable]; forcecoul = atom->q[i]*atom->q[j] * table; + table = etable[itable] + fraction*detable[itable]; + phicoul = atom->q[i]*atom->q[j] * table; if (factor_coul < 1.0) { table = ctable[itable] + fraction*dctable[itable]; prefactor = atom->q[i]*atom->q[j] * table; forcecoul -= (1.0-factor_coul)*prefactor; + phicoul -= (1.0-factor_coul)*prefactor; } } - } else forcecoul = 0.0; + } if (rsq < cut_ljsq[itype][jtype]) { const int ljt = lj_type[itype][jtype]; @@ -698,30 +699,15 @@ double PairLJSDKCoulLong::single(int i, int j, int itype, int jtype, const double ratio = sigma[itype][jtype]/sqrt(rsq); const double eps = epsilon[itype][jtype]; - fforce = factor_lj * ljpref*eps * (ljpow1*pow(ratio,ljpow1) + forcelj = factor_lj * ljpref*eps * (ljpow1*pow(ratio,ljpow1) - ljpow2*pow(ratio,ljpow2))/rsq; philj = factor_lj * (ljpref*eps * (pow(ratio,ljpow1) - pow(ratio,ljpow2)) - offset[itype][jtype]); - } else fforce=0.0; - - fforce = (forcecoul + factor_lj*forcelj) * r2inv; - - double eng = 0.0; - if (rsq < cut_coulsq) { - if (!ncoultablebits || rsq <= tabinnersq) - phicoul = prefactor*erfc; - else { - table = etable[itable] + fraction*detable[itable]; - phicoul = atom->q[i]*atom->q[j] * table; - } - if (factor_coul < 1.0) phicoul -= (1.0-factor_coul)*prefactor; - eng += phicoul; } - if (rsq < cut_ljsq[itype][jtype]) - eng += philj; + fforce = (forcecoul + forcelj) * r2inv; - return eng; + return phicoul + philj; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-CUDA/fix_npt_cuda.cpp b/src/USER-CUDA/fix_npt_cuda.cpp index 96e3ceda44..db77ec0072 100644 --- a/src/USER-CUDA/fix_npt_cuda.cpp +++ b/src/USER-CUDA/fix_npt_cuda.cpp @@ -21,10 +21,6 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace FixConstCuda; -using namespace FixConst; -using namespace FixConstCuda; -using namespace FixConstCuda; -using namespace FixConstCuda; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-CUDA/fix_nvt_cuda.cpp b/src/USER-CUDA/fix_nvt_cuda.cpp index 6a2f3aa3be..8438f2d3f6 100644 --- a/src/USER-CUDA/fix_nvt_cuda.cpp +++ b/src/USER-CUDA/fix_nvt_cuda.cpp @@ -22,10 +22,6 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace FixConstCuda; -using namespace FixConst; -using namespace FixConstCuda; -using namespace FixConstCuda; -using namespace FixConstCuda; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-CUDA/fix_shake_cuda.cpp b/src/USER-CUDA/fix_shake_cuda.cpp index a1e5728157..0fb8eaf6f6 100644 --- a/src/USER-CUDA/fix_shake_cuda.cpp +++ b/src/USER-CUDA/fix_shake_cuda.cpp @@ -2450,7 +2450,7 @@ int FixShakeCuda::unpack_exchange(int nlocal, double *buf) prediction portion is different than Verlet rRESPA updating of atom coords is done with full v, but only portions of f ------------------------------------------------------------------------- */ -/* +#if 0 void FixShakeCuda::post_force_respa(int vflag, int ilevel, int iloop) { // call stats only on outermost level @@ -2529,6 +2529,7 @@ void FixShakeCuda::post_force_respa(int vflag, int ilevel, int iloop) else shake3angle(m); } } +#endif /* ---------------------------------------------------------------------- */ diff --git a/src/USER-CUDA/pair_born_coul_long_cuda.cpp b/src/USER-CUDA/pair_born_coul_long_cuda.cpp index f5aaff51f0..0918be7ce8 100644 --- a/src/USER-CUDA/pair_born_coul_long_cuda.cpp +++ b/src/USER-CUDA/pair_born_coul_long_cuda.cpp @@ -154,7 +154,7 @@ void PairBornCoulLongCuda::init_style() cuda->shared_data.pppm.qqrd2e=force->qqrd2e; - if(ncoultablebits) error->warning(FLERR,"# CUDA: You asked for the useage of Coulomb Tables. This is not supported in CUDA Pair forces. Setting is ignored.\n"); + if(ncoultablebits) error->warning(FLERR,"# CUDA: You asked for the usage of Coulomb Tables. This is not supported in CUDA Pair forces. Setting is ignored.\n"); } void PairBornCoulLongCuda::init_list(int id, NeighList *ptr) diff --git a/src/USER-CUDA/pair_buck_coul_cut_cuda.cpp b/src/USER-CUDA/pair_buck_coul_cut_cuda.cpp index bc08546184..cc927fa5b0 100644 --- a/src/USER-CUDA/pair_buck_coul_cut_cuda.cpp +++ b/src/USER-CUDA/pair_buck_coul_cut_cuda.cpp @@ -141,7 +141,7 @@ void PairBuckCoulCutCuda::init_style() cuda->shared_data.pair.cut_coulsq_global=cut_coul_global * cut_coul_global; - if(ncoultablebits) error->warning(FLERR,"# CUDA: You asked for the useage of Coulomb Tables. This is not supported in CUDA Pair forces. Setting is ignored.\n"); + if(ncoultablebits) error->warning(FLERR,"# CUDA: You asked for the usage of Coulomb Tables. This is not supported in CUDA Pair forces. Setting is ignored.\n"); } void PairBuckCoulCutCuda::init_list(int id, NeighList *ptr) diff --git a/src/USER-CUDA/pair_buck_coul_long_cuda.cpp b/src/USER-CUDA/pair_buck_coul_long_cuda.cpp index 4cbd304e07..01cc624377 100644 --- a/src/USER-CUDA/pair_buck_coul_long_cuda.cpp +++ b/src/USER-CUDA/pair_buck_coul_long_cuda.cpp @@ -152,7 +152,7 @@ void PairBuckCoulLongCuda::init_style() cuda->shared_data.pppm.qqrd2e=force->qqrd2e; - if(ncoultablebits) error->warning(FLERR,"# CUDA: You asked for the useage of Coulomb Tables. This is not supported in CUDA Pair forces. Setting is ignored.\n"); + if(ncoultablebits) error->warning(FLERR,"# CUDA: You asked for the usage of Coulomb Tables. This is not supported in CUDA Pair forces. Setting is ignored.\n"); } void PairBuckCoulLongCuda::init_list(int id, NeighList *ptr) diff --git a/src/USER-CUDA/pair_buck_cuda.cpp b/src/USER-CUDA/pair_buck_cuda.cpp index a537e600ed..40dd8bd13b 100644 --- a/src/USER-CUDA/pair_buck_cuda.cpp +++ b/src/USER-CUDA/pair_buck_cuda.cpp @@ -137,7 +137,7 @@ void PairBuckCuda::init_style() cuda->shared_data.pppm.qqrd2e=force->qqrd2e; - if(ncoultablebits) error->warning(FLERR,"# CUDA: You asked for the useage of Coulomb Tables. This is not supported in CUDA Pair forces. Setting is ignored.\n"); + if(ncoultablebits) error->warning(FLERR,"# CUDA: You asked for the usage of Coulomb Tables. This is not supported in CUDA Pair forces. Setting is ignored.\n"); } void PairBuckCuda::init_list(int id, NeighList *ptr) diff --git a/src/USER-CUDA/pair_lj_charmm_coul_long_cuda.cpp b/src/USER-CUDA/pair_lj_charmm_coul_long_cuda.cpp index 29629f1ed5..833b16f592 100644 --- a/src/USER-CUDA/pair_lj_charmm_coul_long_cuda.cpp +++ b/src/USER-CUDA/pair_lj_charmm_coul_long_cuda.cpp @@ -168,7 +168,7 @@ void PairLJCharmmCoulLongCuda::init_style() cuda->shared_data.pppm.qqrd2e=force->qqrd2e; - if(ncoultablebits) error->warning(FLERR,"# CUDA: You asked for the useage of Coulomb Tables. This is not supported in CUDA Pair forces. Setting is ignored.\n"); + if(ncoultablebits) error->warning(FLERR,"# CUDA: You asked for the usage of Coulomb Tables. This is not supported in CUDA Pair forces. Setting is ignored.\n"); } void PairLJCharmmCoulLongCuda::init_list(int id, NeighList *ptr) diff --git a/src/USER-CUDA/pair_lj_class2_coul_long_cuda.cpp b/src/USER-CUDA/pair_lj_class2_coul_long_cuda.cpp index 44f0fb3f2f..b0afe85554 100644 --- a/src/USER-CUDA/pair_lj_class2_coul_long_cuda.cpp +++ b/src/USER-CUDA/pair_lj_class2_coul_long_cuda.cpp @@ -149,7 +149,7 @@ void PairLJClass2CoulLongCuda::init_style() cuda->shared_data.pppm.qqrd2e=force->qqrd2e; - if(ncoultablebits) error->warning(FLERR,"# CUDA: You asked for the useage of Coulomb Tables. This is not supported in CUDA Pair forces. Setting is ignored.\n"); + if(ncoultablebits) error->warning(FLERR,"# CUDA: You asked for the usage of Coulomb Tables. This is not supported in CUDA Pair forces. Setting is ignored.\n"); } void PairLJClass2CoulLongCuda::init_list(int id, NeighList *ptr) diff --git a/src/USER-CUDA/pair_lj_cut_coul_long_cuda.cpp b/src/USER-CUDA/pair_lj_cut_coul_long_cuda.cpp index 12ea4b6d1f..cf60812217 100644 --- a/src/USER-CUDA/pair_lj_cut_coul_long_cuda.cpp +++ b/src/USER-CUDA/pair_lj_cut_coul_long_cuda.cpp @@ -187,7 +187,7 @@ void PairLJCutCoulLongCuda::init_style() cuda->shared_data.pppm.qqrd2e=force->qqrd2e; - if(ncoultablebits) error->warning(FLERR,"# CUDA: You asked for the useage of Coulomb Tables. This is not supported in CUDA Pair forces. Setting is ignored.\n"); + if(ncoultablebits) error->warning(FLERR,"# CUDA: You asked for the usage of Coulomb Tables. This is not supported in CUDA Pair forces. Setting is ignored.\n"); } void PairLJCutCoulLongCuda::init_list(int id, NeighList *ptr) diff --git a/src/USER-MISC/pair_meam_spline.h b/src/USER-MISC/pair_meam_spline.h index cb15a6f8d3..733a05cf93 100644 --- a/src/USER-MISC/pair_meam_spline.h +++ b/src/USER-MISC/pair_meam_spline.h @@ -77,8 +77,8 @@ class PairMEAMSpline : public Pair { public: PairMEAMSpline(class LAMMPS *); - ~PairMEAMSpline(); - void compute(int, int); + virtual ~PairMEAMSpline(); + virtual void compute(int, int); void settings(int, char **); void coeff(int, char **); void init_style(); @@ -91,7 +91,7 @@ public: void unpack_reverse_comm(int, int *, double *); double memory_usage(); -private: +protected: char **elements; // names of unique elements int *map; // mapping from atom types to elements int nelements; // # of unique elements @@ -100,7 +100,7 @@ private: public: /// Default constructor. - SplineFunction() : N(0), X(NULL), Xs(NULL), Y(NULL), Y2(NULL), Ydelta(NULL) {} + SplineFunction() : X(NULL), Xs(NULL), Y(NULL), Y2(NULL), Ydelta(NULL), N(0) {} /// Destructor. ~SplineFunction() { diff --git a/src/USER-OMP/Install.sh b/src/USER-OMP/Install.sh index b96a243aa8..ef744f4dcc 100644 --- a/src/USER-OMP/Install.sh +++ b/src/USER-OMP/Install.sh @@ -24,7 +24,8 @@ done if (test $1 = 1) then if (test -e ../Makefile.package) then - sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_USER_OMP |' ../Makefile.package + sed -i -e 's/[ \t]*[^ \t=]*OMP[^ \t]*[ \t]*//g' \ + -e 's|^PKG_INC =[ \t]*|&-DLMP_USER_OMP |' ../Makefile.package fi # force rebuild of files with LMP_USER_OMP switch @@ -37,7 +38,7 @@ if (test $1 = 1) then elif (test $1 = 0) then if (test -e ../Makefile.package) then - sed -i -e 's/[^ \t]*OMP[^ \t]* //g' ../Makefile.package + sed -i -e 's/[ \t=]*[^ \t]*OMP[^ \t]*[ \t]*//g' ../Makefile.package fi # force rebuild of files with LMP_USER_OMP switch diff --git a/src/USER-OMP/fix_omp.cpp b/src/USER-OMP/fix_omp.cpp index 58c931798c..760e8e6490 100644 --- a/src/USER-OMP/fix_omp.cpp +++ b/src/USER-OMP/fix_omp.cpp @@ -40,13 +40,14 @@ #include #include +#include "suffix.h" + #if defined(LMP_USER_CUDA) #include "cuda_modify_flags.h" #endif using namespace LAMMPS_NS; using namespace FixConst; -using namespace FixConst; #if defined(LMP_USER_CUDA) using namespace FixConstCuda; #endif @@ -63,7 +64,8 @@ static int get_tid() /* ---------------------------------------------------------------------- */ FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - thr(NULL), last_omp_style(NULL), _nthr(-1), _neighbor(true), _newton(false) + thr(NULL), last_omp_style(NULL), last_pair_hybrid(NULL), + _nthr(-1), _neighbor(true), _newton(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"); @@ -192,8 +194,10 @@ void FixOMP::init() error->all(FLERR,"Cannot use r-RESPA with /omp styles"); int check_hybrid; + last_pair_hybrid = NULL; last_omp_style = NULL; char *last_omp_name = NULL; + char *last_hybrid_name = NULL; // determine which is the last force style with OpenMP // support as this is the one that has to reduce the forces @@ -220,13 +224,21 @@ void FixOMP::init() char *suffix = style->keywords[i] + len - 4; \ if (strcmp(suffix,"/omp") == 0) { \ last_omp_name = force->name ## _style; \ - last_omp_style = (void *) force->name; \ + last_omp_style = style->styles[i]; \ } \ } \ } CheckStyleForOMP(pair); - CheckHybridForOMP(pair,Pair); + if (check_hybrid) { + PairHybrid *style = (PairHybrid *) force->pair; + for (int i=0; i < style->nstyles; i++) { + if (style->styles[i]->suffix_flag & Suffix::OMP) { + last_pair_hybrid = style->styles[i]; + last_omp_name = style->keywords[i]; + } + } + } CheckStyleForOMP(bond); CheckHybridForOMP(bond,Bond); diff --git a/src/USER-OMP/fix_omp.h b/src/USER-OMP/fix_omp.h index 2167c281ec..6fa2c11cd5 100644 --- a/src/USER-OMP/fix_omp.h +++ b/src/USER-OMP/fix_omp.h @@ -50,8 +50,10 @@ class FixOMP : public Fix { protected: ThrData **thr; - void *last_omp_style; // pointer to the style that needs - // to do the force reduction + void *last_omp_style; // pointer to the style that needs + // to do the general force reduction + void *last_pair_hybrid; // pointer to the pair style that needs + // to call virial_fdot_compute() public: bool get_neighbor() const {return _neighbor;}; diff --git a/src/USER-OMP/neigh_derive_omp.cpp b/src/USER-OMP/neigh_derive_omp.cpp index 5f42dd2b50..187a6c8753 100644 --- a/src/USER-OMP/neigh_derive_omp.cpp +++ b/src/USER-OMP/neigh_derive_omp.cpp @@ -56,14 +56,14 @@ void Neighbor::half_from_full_no_newton_omp(NeighList *list) for (ii = ifrom; ii < ito; ii++) { +#if defined(_OPENMP) +#pragma omp critical +#endif if (pgsize - npnt < oneatom) { npnt = 0; npage += nthreads; // only one thread at a time may check whether we // need new neighbor list pages and then add to them. -#if defined(_OPENMP) -#pragma omp critical -#endif if (npage >= list->maxpage) list->add_pages(nthreads); } @@ -132,14 +132,14 @@ void Neighbor::half_from_full_newton_omp(NeighList *list) for (ii = ifrom; ii < ito; ii++) { +#if defined(_OPENMP) +#pragma omp critical +#endif if (pgsize - npnt < oneatom) { npnt = 0; npage += nthreads; // only one thread at a time may check whether we // need new neighbor list pages and then add to them. -#if defined(_OPENMP) -#pragma omp critical -#endif if (npage >= list->maxpage) list->add_pages(nthreads); } diff --git a/src/USER-OMP/pair_adp_omp.cpp b/src/USER-OMP/pair_adp_omp.cpp index 3af4a2f7cd..389144e1d1 100644 --- a/src/USER-OMP/pair_adp_omp.cpp +++ b/src/USER-OMP/pair_adp_omp.cpp @@ -23,6 +23,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -30,6 +31,7 @@ using namespace LAMMPS_NS; PairADPOMP::PairADPOMP(LAMMPS *lmp) : PairADP(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_airebo_omp.cpp b/src/USER-OMP/pair_airebo_omp.cpp index 0ff25d16bd..5321f25a42 100644 --- a/src/USER-OMP/pair_airebo_omp.cpp +++ b/src/USER-OMP/pair_airebo_omp.cpp @@ -26,6 +26,7 @@ #include #endif +#include "suffix.h" using namespace LAMMPS_NS; #define TOL 1.0e-9 @@ -35,6 +36,7 @@ using namespace LAMMPS_NS; PairAIREBOOMP::PairAIREBOOMP(LAMMPS *lmp) : PairAIREBO(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_born_coul_long_omp.cpp b/src/USER-OMP/pair_born_coul_long_omp.cpp index 5a51bdd878..73bf7e066b 100644 --- a/src/USER-OMP/pair_born_coul_long_omp.cpp +++ b/src/USER-OMP/pair_born_coul_long_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 @@ -35,6 +36,7 @@ using namespace LAMMPS_NS; PairBornCoulLongOMP::PairBornCoulLongOMP(LAMMPS *lmp) : PairBornCoulLong(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_born_coul_wolf_omp.cpp b/src/USER-OMP/pair_born_coul_wolf_omp.cpp index fe7e7ae49f..c1ec917a2b 100644 --- a/src/USER-OMP/pair_born_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_born_coul_wolf_omp.cpp @@ -21,6 +21,7 @@ #include "neigh_list.h" #include "math_const.h" +#include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -29,6 +30,7 @@ using namespace MathConst; PairBornCoulWolfOMP::PairBornCoulWolfOMP(LAMMPS *lmp) : PairBornCoulWolf(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_born_omp.cpp b/src/USER-OMP/pair_born_omp.cpp index d9dbf0d29e..ebcdbf72bc 100644 --- a/src/USER-OMP/pair_born_omp.cpp +++ b/src/USER-OMP/pair_born_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairBornOMP::PairBornOMP(LAMMPS *lmp) : PairBorn(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_brownian_omp.cpp b/src/USER-OMP/pair_brownian_omp.cpp index 42594ae1f8..cce3333387 100644 --- a/src/USER-OMP/pair_brownian_omp.cpp +++ b/src/USER-OMP/pair_brownian_omp.cpp @@ -23,6 +23,7 @@ #include "random_mars.h" #include "math_const.h" +#include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -33,6 +34,7 @@ using namespace MathConst; PairBrownianOMP::PairBrownianOMP(LAMMPS *lmp) : PairBrownian(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; random_thr = NULL; } diff --git a/src/USER-OMP/pair_brownian_poly_omp.cpp b/src/USER-OMP/pair_brownian_poly_omp.cpp index 9d1dbb22e6..62f13e83dc 100644 --- a/src/USER-OMP/pair_brownian_poly_omp.cpp +++ b/src/USER-OMP/pair_brownian_poly_omp.cpp @@ -23,6 +23,7 @@ #include "random_mars.h" #include "math_const.h" +#include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -33,6 +34,7 @@ using namespace MathConst; PairBrownianPolyOMP::PairBrownianPolyOMP(LAMMPS *lmp) : PairBrownianPoly(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; random_thr = NULL; } diff --git a/src/USER-OMP/pair_buck_coul_cut_omp.cpp b/src/USER-OMP/pair_buck_coul_cut_omp.cpp index 0369852f47..a3152ee15a 100644 --- a/src/USER-OMP/pair_buck_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_cut_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairBuckCoulCutOMP::PairBuckCoulCutOMP(LAMMPS *lmp) : PairBuckCoulCut(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_buck_coul_long_omp.cpp b/src/USER-OMP/pair_buck_coul_long_omp.cpp index 54a6f32803..3347e728ea 100644 --- a/src/USER-OMP/pair_buck_coul_long_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_long_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 @@ -35,6 +36,7 @@ using namespace LAMMPS_NS; PairBuckCoulLongOMP::PairBuckCoulLongOMP(LAMMPS *lmp) : PairBuckCoulLong(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_buck_coul_omp.cpp b/src/USER-OMP/pair_buck_coul_omp.cpp index 97299feeeb..7a66fa2fb0 100644 --- a/src/USER-OMP/pair_buck_coul_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_omp.cpp @@ -21,6 +21,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 @@ -36,6 +37,7 @@ using namespace LAMMPS_NS; PairBuckCoulOMP::PairBuckCoulOMP(LAMMPS *lmp) : PairBuckCoul(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_buck_omp.cpp b/src/USER-OMP/pair_buck_omp.cpp index 5806a3e796..ae6cbcf4b7 100644 --- a/src/USER-OMP/pair_buck_omp.cpp +++ b/src/USER-OMP/pair_buck_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairBuckOMP::PairBuckOMP(LAMMPS *lmp) : PairBuck(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_cdeam_omp.cpp b/src/USER-OMP/pair_cdeam_omp.cpp index 287b39ceb1..4963528b7c 100644 --- a/src/USER-OMP/pair_cdeam_omp.cpp +++ b/src/USER-OMP/pair_cdeam_omp.cpp @@ -24,6 +24,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; // This is for debugging purposes. The ASSERT() macro is used in the code to check @@ -46,6 +47,7 @@ using namespace LAMMPS_NS; PairCDEAMOMP::PairCDEAMOMP(LAMMPS *lmp, int _cdeamVersion) : PairEAM(lmp), PairCDEAM(lmp,_cdeamVersion), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_colloid_omp.cpp b/src/USER-OMP/pair_colloid_omp.cpp index 5cb47c664c..8032984365 100644 --- a/src/USER-OMP/pair_colloid_omp.cpp +++ b/src/USER-OMP/pair_colloid_omp.cpp @@ -21,6 +21,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -28,6 +29,7 @@ using namespace LAMMPS_NS; PairColloidOMP::PairColloidOMP(LAMMPS *lmp) : PairColloid(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_comb_omp.cpp b/src/USER-OMP/pair_comb_omp.cpp index 797b9cc8fd..3fda14c95c 100644 --- a/src/USER-OMP/pair_comb_omp.cpp +++ b/src/USER-OMP/pair_comb_omp.cpp @@ -22,6 +22,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; #define MAXNEIGH 24 @@ -31,6 +32,7 @@ using namespace LAMMPS_NS; PairCombOMP::PairCombOMP(LAMMPS *lmp) : PairComb(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_coul_cut_omp.cpp b/src/USER-OMP/pair_coul_cut_omp.cpp index a8473eec38..e485efdb3c 100644 --- a/src/USER-OMP/pair_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_coul_cut_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairCoulCutOMP::PairCoulCutOMP(LAMMPS *lmp) : PairCoulCut(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_coul_debye_omp.cpp b/src/USER-OMP/pair_coul_debye_omp.cpp index 73e579262e..580b85087e 100644 --- a/src/USER-OMP/pair_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_coul_debye_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairCoulDebyeOMP::PairCoulDebyeOMP(LAMMPS *lmp) : PairCoulDebye(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_coul_diel_omp.cpp b/src/USER-OMP/pair_coul_diel_omp.cpp index e1e8690245..29d83b3876 100644 --- a/src/USER-OMP/pair_coul_diel_omp.cpp +++ b/src/USER-OMP/pair_coul_diel_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairCoulDielOMP::PairCoulDielOMP(LAMMPS *lmp) : PairCoulDiel(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_coul_long_omp.cpp b/src/USER-OMP/pair_coul_long_omp.cpp index 82f070d37d..62a76783a7 100644 --- a/src/USER-OMP/pair_coul_long_omp.cpp +++ b/src/USER-OMP/pair_coul_long_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 @@ -35,6 +36,7 @@ using namespace LAMMPS_NS; PairCoulLongOMP::PairCoulLongOMP(LAMMPS *lmp) : PairCoulLong(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_coul_wolf_omp.cpp b/src/USER-OMP/pair_coul_wolf_omp.cpp index 6bf9a616cf..0c99802432 100644 --- a/src/USER-OMP/pair_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_coul_wolf_omp.cpp @@ -21,6 +21,7 @@ #include "neigh_list.h" #include "math_const.h" +#include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -29,6 +30,7 @@ using namespace MathConst; PairCoulWolfOMP::PairCoulWolfOMP(LAMMPS *lmp) : PairCoulWolf(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_dipole_cut_omp.cpp b/src/USER-OMP/pair_dipole_cut_omp.cpp index 3ec3445396..9e278b9a21 100644 --- a/src/USER-OMP/pair_dipole_cut_omp.cpp +++ b/src/USER-OMP/pair_dipole_cut_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairDipoleCutOMP::PairDipoleCutOMP(LAMMPS *lmp) : PairDipoleCut(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_dipole_sf_omp.cpp b/src/USER-OMP/pair_dipole_sf_omp.cpp index 316a4e75ac..8ea425fc8a 100644 --- a/src/USER-OMP/pair_dipole_sf_omp.cpp +++ b/src/USER-OMP/pair_dipole_sf_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairDipoleSFOMP::PairDipoleSFOMP(LAMMPS *lmp) : PairDipoleSF(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_dpd_omp.cpp b/src/USER-OMP/pair_dpd_omp.cpp index 0d24ce401d..f8d472f041 100644 --- a/src/USER-OMP/pair_dpd_omp.cpp +++ b/src/USER-OMP/pair_dpd_omp.cpp @@ -22,6 +22,7 @@ #include "update.h" #include "random_mars.h" +#include "suffix.h" using namespace LAMMPS_NS; #define EPSILON 1.0e-10 @@ -31,6 +32,7 @@ using namespace LAMMPS_NS; PairDPDOMP::PairDPDOMP(LAMMPS *lmp) : PairDPD(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; random_thr = NULL; } diff --git a/src/USER-OMP/pair_dpd_tstat_omp.cpp b/src/USER-OMP/pair_dpd_tstat_omp.cpp index 50a1bf439e..d78462a05f 100644 --- a/src/USER-OMP/pair_dpd_tstat_omp.cpp +++ b/src/USER-OMP/pair_dpd_tstat_omp.cpp @@ -22,6 +22,7 @@ #include "update.h" #include "random_mars.h" +#include "suffix.h" using namespace LAMMPS_NS; #define EPSILON 1.0e-10 @@ -31,6 +32,7 @@ using namespace LAMMPS_NS; PairDPDTstatOMP::PairDPDTstatOMP(LAMMPS *lmp) : PairDPDTstat(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; random_thr = NULL; } diff --git a/src/USER-OMP/pair_eam_omp.cpp b/src/USER-OMP/pair_eam_omp.cpp index c014eb75e2..17efa59a52 100644 --- a/src/USER-OMP/pair_eam_omp.cpp +++ b/src/USER-OMP/pair_eam_omp.cpp @@ -23,6 +23,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -30,6 +31,7 @@ using namespace LAMMPS_NS; PairEAMOMP::PairEAMOMP(LAMMPS *lmp) : PairEAM(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_edip_omp.cpp b/src/USER-OMP/pair_edip_omp.cpp index f0d6d47cec..ac211fc528 100644 --- a/src/USER-OMP/pair_edip_omp.cpp +++ b/src/USER-OMP/pair_edip_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairEDIPOMP::PairEDIPOMP(LAMMPS *lmp) : PairEDIP(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_eim_omp.cpp b/src/USER-OMP/pair_eim_omp.cpp index 7184adb781..cf1fcf5e35 100644 --- a/src/USER-OMP/pair_eim_omp.cpp +++ b/src/USER-OMP/pair_eim_omp.cpp @@ -23,6 +23,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -30,6 +31,7 @@ using namespace LAMMPS_NS; PairEIMOMP::PairEIMOMP(LAMMPS *lmp) : PairEIM(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_gauss_cut_omp.cpp b/src/USER-OMP/pair_gauss_cut_omp.cpp index 5499fab3bc..09e27c18f2 100644 --- a/src/USER-OMP/pair_gauss_cut_omp.cpp +++ b/src/USER-OMP/pair_gauss_cut_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairGaussCutOMP::PairGaussCutOMP(LAMMPS *lmp) : PairGaussCut(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_gauss_omp.cpp b/src/USER-OMP/pair_gauss_omp.cpp index 4f26670715..03211f6985 100644 --- a/src/USER-OMP/pair_gauss_omp.cpp +++ b/src/USER-OMP/pair_gauss_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; #define EPSILON 1.0e-10 @@ -28,6 +29,7 @@ using namespace LAMMPS_NS; PairGaussOMP::PairGaussOMP(LAMMPS *lmp) : PairGauss(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_gayberne_omp.cpp b/src/USER-OMP/pair_gayberne_omp.cpp index d8ec6c9b32..f12b84f3f5 100644 --- a/src/USER-OMP/pair_gayberne_omp.cpp +++ b/src/USER-OMP/pair_gayberne_omp.cpp @@ -22,6 +22,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -29,6 +30,7 @@ using namespace LAMMPS_NS; PairGayBerneOMP::PairGayBerneOMP(LAMMPS *lmp) : PairGayBerne(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_gran_hertz_history_omp.cpp b/src/USER-OMP/pair_gran_hertz_history_omp.cpp index 23b8b8f5c2..283b3532e3 100644 --- a/src/USER-OMP/pair_gran_hertz_history_omp.cpp +++ b/src/USER-OMP/pair_gran_hertz_history_omp.cpp @@ -21,6 +21,7 @@ #include "neigh_list.h" #include "update.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -28,6 +29,7 @@ using namespace LAMMPS_NS; PairGranHertzHistoryOMP::PairGranHertzHistoryOMP(LAMMPS *lmp) : PairGranHertzHistory(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_gran_hooke_history_omp.cpp b/src/USER-OMP/pair_gran_hooke_history_omp.cpp index 5212b30ce2..42ba42a1bc 100644 --- a/src/USER-OMP/pair_gran_hooke_history_omp.cpp +++ b/src/USER-OMP/pair_gran_hooke_history_omp.cpp @@ -23,6 +23,7 @@ #include "string.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -30,6 +31,7 @@ using namespace LAMMPS_NS; PairGranHookeHistoryOMP::PairGranHookeHistoryOMP(LAMMPS *lmp) : PairGranHookeHistory(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; // trigger use of OpenMP version of FixShearHistory suffix = new char[4]; diff --git a/src/USER-OMP/pair_gran_hooke_omp.cpp b/src/USER-OMP/pair_gran_hooke_omp.cpp index fda9295b70..223acdbd4a 100644 --- a/src/USER-OMP/pair_gran_hooke_omp.cpp +++ b/src/USER-OMP/pair_gran_hooke_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairGranHookeOMP::PairGranHookeOMP(LAMMPS *lmp) : PairGranHooke(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp index 5da3f2bdfa..fc4f7eba0e 100644 --- a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp @@ -23,6 +23,7 @@ #include "math_const.h" +#include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -33,6 +34,7 @@ using namespace MathConst; PairHbondDreidingLJOMP::PairHbondDreidingLJOMP(LAMMPS *lmp) : PairHbondDreidingLJ(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; hbcount_thr = hbeng_thr = NULL; } @@ -41,7 +43,6 @@ PairHbondDreidingLJOMP::PairHbondDreidingLJOMP(LAMMPS *lmp) : PairHbondDreidingLJOMP::~PairHbondDreidingLJOMP() { - respa_enable = 0; if (hbcount_thr) { delete[] hbcount_thr; delete[] hbeng_thr; diff --git a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp index bce4efdd3a..291825ea78 100644 --- a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp @@ -23,6 +23,7 @@ #include "math_const.h" +#include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -33,6 +34,7 @@ using namespace MathConst; PairHbondDreidingMorseOMP::PairHbondDreidingMorseOMP(LAMMPS *lmp) : PairHbondDreidingMorse(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; hbcount_thr = hbeng_thr = NULL; } @@ -41,7 +43,6 @@ PairHbondDreidingMorseOMP::PairHbondDreidingMorseOMP(LAMMPS *lmp) : PairHbondDreidingMorseOMP::~PairHbondDreidingMorseOMP() { - respa_enable = 0; if (hbcount_thr) { delete[] hbcount_thr; delete[] hbeng_thr; diff --git a/src/USER-OMP/pair_line_lj_omp.cpp b/src/USER-OMP/pair_line_lj_omp.cpp index 59982735d8..b4b1ea3a06 100644 --- a/src/USER-OMP/pair_line_lj_omp.cpp +++ b/src/USER-OMP/pair_line_lj_omp.cpp @@ -26,6 +26,7 @@ #include +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -33,6 +34,7 @@ using namespace LAMMPS_NS; PairLineLJOMP::PairLineLJOMP(LAMMPS *lmp) : PairLineLJ(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_lj96_cut_omp.cpp b/src/USER-OMP/pair_lj96_cut_omp.cpp index 68733c1093..69d9539acf 100644 --- a/src/USER-OMP/pair_lj96_cut_omp.cpp +++ b/src/USER-OMP/pair_lj96_cut_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairLJ96CutOMP::PairLJ96CutOMP(LAMMPS *lmp) : PairLJ96Cut(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } 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 edfbe1f527..811fdbcdac 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 @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairLJCharmmCoulCharmmImplicitOMP::PairLJCharmmCoulCharmmImplicitOMP(LAMMPS *lmp) : PairLJCharmmCoulCharmmImplicit(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } 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 efdcc995da..7c1b104182 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairLJCharmmCoulCharmmOMP::PairLJCharmmCoulCharmmOMP(LAMMPS *lmp) : PairLJCharmmCoulCharmm(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } 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 f9f32ea119..680626daa5 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 @@ -35,6 +36,7 @@ using namespace LAMMPS_NS; PairLJCharmmCoulLongOMP::PairLJCharmmCoulLongOMP(LAMMPS *lmp) : PairLJCharmmCoulLong(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_lj_charmm_coul_pppm_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_pppm_omp.cpp index ecad175c18..e19152ad6e 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_pppm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_pppm_omp.cpp @@ -25,6 +25,7 @@ #include +#include "suffix.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 @@ -40,9 +41,10 @@ using namespace LAMMPS_NS; PairLJCharmmCoulPPPMOMP::PairLJCharmmCoulPPPMOMP(LAMMPS *lmp) : PairLJCharmmCoulLong(lmp), ThrOMP(lmp, THR_PAIR|THR_PROXY) { + suffix_flag |= Suffix::OMP; respa_enable = 0; nproxy=1; - + kspace = NULL; } 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 e54c348e64..a6a7f30449 100644 --- a/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairLJClass2CoulCutOMP::PairLJClass2CoulCutOMP(LAMMPS *lmp) : PairLJClass2CoulCut(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } 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 20ad947d23..6412beb247 100644 --- a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 @@ -35,6 +36,7 @@ using namespace LAMMPS_NS; PairLJClass2CoulLongOMP::PairLJClass2CoulLongOMP(LAMMPS *lmp) : PairLJClass2CoulLong(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_lj_class2_coul_pppm_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_pppm_omp.cpp index 56011e17b1..a32005ff9b 100644 --- a/src/USER-OMP/pair_lj_class2_coul_pppm_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_pppm_omp.cpp @@ -25,6 +25,7 @@ #include +#include "suffix.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 @@ -40,9 +41,10 @@ using namespace LAMMPS_NS; PairLJClass2CoulPPPMOMP::PairLJClass2CoulPPPMOMP(LAMMPS *lmp) : PairLJClass2CoulLong(lmp), ThrOMP(lmp, THR_PAIR|THR_PROXY) { + suffix_flag |= Suffix::OMP; respa_enable = 0; nproxy=1; - + kspace = NULL; } diff --git a/src/USER-OMP/pair_lj_class2_omp.cpp b/src/USER-OMP/pair_lj_class2_omp.cpp index cff80d3f1d..018c3320c1 100644 --- a/src/USER-OMP/pair_lj_class2_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairLJClass2OMP::PairLJClass2OMP(LAMMPS *lmp) : PairLJClass2(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_lj_coul_omp.cpp b/src/USER-OMP/pair_lj_coul_omp.cpp index ae15087ba9..6f12ab2d84 100644 --- a/src/USER-OMP/pair_lj_coul_omp.cpp +++ b/src/USER-OMP/pair_lj_coul_omp.cpp @@ -21,6 +21,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 @@ -36,6 +37,7 @@ using namespace LAMMPS_NS; PairLJCoulOMP::PairLJCoulOMP(LAMMPS *lmp) : PairLJCoul(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_lj_cubic_omp.cpp b/src/USER-OMP/pair_lj_cubic_omp.cpp index 09e44a9107..97cfdc68a3 100644 --- a/src/USER-OMP/pair_lj_cubic_omp.cpp +++ b/src/USER-OMP/pair_lj_cubic_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; using namespace PairLJCubicConstants; @@ -28,6 +29,7 @@ using namespace PairLJCubicConstants; PairLJCubicOMP::PairLJCubicOMP(LAMMPS *lmp) : PairLJCubic(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } 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 46114ce613..b681ec5f03 100644 --- a/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairLJCutCoulCutOMP::PairLJCutCoulCutOMP(LAMMPS *lmp) : PairLJCutCoulCut(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } 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 9d96f31dba..102259dd11 100644 --- a/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairLJCutCoulDebyeOMP::PairLJCutCoulDebyeOMP(LAMMPS *lmp) : PairLJCutCoulDebye(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } 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 79976bf8a8..238dc6f386 100644 --- a/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 @@ -35,6 +36,7 @@ using namespace LAMMPS_NS; PairLJCutCoulLongOMP::PairLJCutCoulLongOMP(LAMMPS *lmp) : PairLJCutCoulLong(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_lj_cut_coul_long_tip4p_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_long_tip4p_omp.cpp index c647fbb067..04c225db44 100644 --- a/src/USER-OMP/pair_lj_cut_coul_long_tip4p_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_long_tip4p_omp.cpp @@ -23,6 +23,7 @@ #include "memory.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 @@ -38,6 +39,7 @@ using namespace LAMMPS_NS; PairLJCutCoulLongTIP4POMP::PairLJCutCoulLongTIP4POMP(LAMMPS *lmp) : PairLJCutCoulLongTIP4P(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; // for caching m-shift corrected positions diff --git a/src/USER-OMP/pair_lj_cut_coul_pppm_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_pppm_omp.cpp index d72b9c0b0a..bc767958bb 100644 --- a/src/USER-OMP/pair_lj_cut_coul_pppm_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_pppm_omp.cpp @@ -25,6 +25,7 @@ #include +#include "suffix.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 @@ -40,9 +41,10 @@ using namespace LAMMPS_NS; PairLJCutCoulPPPMOMP::PairLJCutCoulPPPMOMP(LAMMPS *lmp) : PairLJCutCoulLong(lmp), ThrOMP(lmp, THR_PAIR|THR_PROXY) { + suffix_flag |= Suffix::OMP; respa_enable = 0; nproxy=1; - + kspace = NULL; } diff --git a/src/USER-OMP/pair_lj_cut_coul_pppm_tip4p_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_pppm_tip4p_omp.cpp index ec58456887..11ad798052 100644 --- a/src/USER-OMP/pair_lj_cut_coul_pppm_tip4p_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_pppm_tip4p_omp.cpp @@ -27,6 +27,7 @@ #include +#include "suffix.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 @@ -42,6 +43,7 @@ using namespace LAMMPS_NS; PairLJCutCoulPPPMTIP4POMP::PairLJCutCoulPPPMTIP4POMP(LAMMPS *lmp) : PairLJCutCoulLongTIP4P(lmp), ThrOMP(lmp, THR_PAIR|THR_PROXY) { + suffix_flag |= Suffix::OMP; respa_enable = 0; nproxy=1; diff --git a/src/USER-OMP/pair_lj_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_omp.cpp index 4932a784bb..0c86e1be9b 100644 --- a/src/USER-OMP/pair_lj_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairLJCutOMP::PairLJCutOMP(LAMMPS *lmp) : PairLJCut(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_lj_expand_omp.cpp b/src/USER-OMP/pair_lj_expand_omp.cpp index 4f93d3bd42..5d64d0d0e6 100644 --- a/src/USER-OMP/pair_lj_expand_omp.cpp +++ b/src/USER-OMP/pair_lj_expand_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairLJExpandOMP::PairLJExpandOMP(LAMMPS *lmp) : PairLJExpand(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } 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 ca8875c7f8..bf3e2046d7 100644 --- a/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairLJGromacsCoulGromacsOMP::PairLJGromacsCoulGromacsOMP(LAMMPS *lmp) : PairLJGromacsCoulGromacs(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_lj_gromacs_omp.cpp b/src/USER-OMP/pair_lj_gromacs_omp.cpp index abdc4c5ccf..457dc233ce 100644 --- a/src/USER-OMP/pair_lj_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairLJGromacsOMP::PairLJGromacsOMP(LAMMPS *lmp) : PairLJGromacs(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } 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 0e120a8639..580c57d96c 100644 --- a/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp @@ -22,6 +22,7 @@ #include "lj_sdk_common.h" +#include "suffix.h" using namespace LAMMPS_NS; using namespace LJSDKParms; @@ -38,6 +39,7 @@ using namespace LJSDKParms; PairLJSDKCoulLongOMP::PairLJSDKCoulLongOMP(LAMMPS *lmp) : PairLJSDKCoulLong(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } @@ -91,8 +93,6 @@ void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr) double r,rsq,r2inv,forcecoul,forcelj,factor_coul,factor_lj; double grij,expm2,prefactor,t,erfc; - evdwl = ecoul = 0.0; - const double * const * const x = atom->x; double * const * const f = thr->get_f(); const double * const q = atom->q; @@ -123,6 +123,8 @@ void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr) const int jnum = numneigh[i]; for (jj = 0; jj < jnum; jj++) { + forcecoul = forcelj = evdwl = ecoul = 0.0; + j = jlist[jj]; factor_lj = special_lj[sbmask(j)]; factor_coul = special_coul[sbmask(j)]; @@ -147,7 +149,13 @@ void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr) erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2; prefactor = qqrd2e * qtmp*q[j]/r; forcecoul = prefactor * (erfc + EWALD_F*grij*expm2); - if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; + if (EFLAG) + ecoul = prefactor*erfc; + if (factor_coul < 1.0) { + forcecoul -= (1.0-factor_coul)*prefactor; + if (EFLAG) + ecoul -= (1.0-factor_coul)*prefactor; + } } else { union_int_float_t rsq_lookup; rsq_lookup.f = rsq; @@ -156,15 +164,16 @@ void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr) fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable]; table = ftable[itable] + fraction*dftable[itable]; forcecoul = qtmp*q[j] * table; + if (EFLAG) + ecoul = qtmp*q[j] * table; if (factor_coul < 1.0) { table = ctable[itable] + fraction*dctable[itable]; prefactor = qtmp*q[j] * table; forcecoul -= (1.0-factor_coul)*prefactor; + if (EFLAG) + ecoul -= (1.0-factor_coul)*prefactor; } } - } else { - forcecoul = 0.0; - ecoul = 0.0; } if (rsq < cut_ljsq[itype][jtype]) { @@ -177,7 +186,7 @@ void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr) if (EFLAG) evdwl = r4inv*(lj3[itype][jtype]*r4inv*r4inv - lj4[itype][jtype]) - offset[itype][jtype]; - + } else if (ljt == LJ9_6) { const double r3inv = r2inv*sqrt(r2inv); const double r6inv = r3inv*r3inv; @@ -195,12 +204,12 @@ void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr) evdwl = r6inv*(lj3[itype][jtype]*r6inv - lj4[itype][jtype]) - offset[itype][jtype]; } - } else { - forcelj=0.0; - evdwl = 0.0; + forcelj *= factor_lj; + if (EFLAG) + evdwl *= factor_lj; } - fpair = (forcecoul + factor_lj*forcelj) * r2inv; + fpair = (forcecoul + forcelj) * r2inv; fxtmp += delx*fpair; fytmp += dely*fpair; @@ -211,24 +220,9 @@ void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr) f[j][2] -= delz*fpair; } - if (EFLAG) { - if (rsq < cut_coulsq) { - if (!ncoultablebits || rsq <= tabinnersq) - ecoul = prefactor*erfc; - else { - table = etable[itable] + fraction*detable[itable]; - ecoul = qtmp*q[j] * table; - } - if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor; - } else ecoul = 0.0; - - if (rsq < cut_ljsq[itype][jtype]) { - evdwl *= factor_lj; - } else evdwl = 0.0; - } - - if (EVFLAG) ev_tally_thr(this, i,j,nlocal,NEWTON_PAIR, + if (EVFLAG) ev_tally_thr(this,i,j,nlocal,NEWTON_PAIR, evdwl,ecoul,fpair,delx,dely,delz,thr); + } } f[i][0] += fxtmp; diff --git a/src/USER-OMP/pair_lj_sdk_omp.cpp b/src/USER-OMP/pair_lj_sdk_omp.cpp index bc5faafad5..127ff41c86 100644 --- a/src/USER-OMP/pair_lj_sdk_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_omp.cpp @@ -23,6 +23,7 @@ #include "lj_sdk_common.h" +#include "suffix.h" using namespace LAMMPS_NS; using namespace LJSDKParms; @@ -31,6 +32,7 @@ using namespace LJSDKParms; PairLJSDKOMP::PairLJSDKOMP(LAMMPS *lmp) : PairLJSDK(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_lj_sf_omp.cpp b/src/USER-OMP/pair_lj_sf_omp.cpp index 47cc23bf91..b2314e13be 100644 --- a/src/USER-OMP/pair_lj_sf_omp.cpp +++ b/src/USER-OMP/pair_lj_sf_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairLJShiftedForceOMP::PairLJShiftedForceOMP(LAMMPS *lmp) : PairLJShiftedForce(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp index 922274f49e..8fd4a259ed 100644 --- a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairLJSmoothLinearOMP::PairLJSmoothLinearOMP(LAMMPS *lmp) : PairLJSmoothLinear(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_lj_smooth_omp.cpp b/src/USER-OMP/pair_lj_smooth_omp.cpp index 4bf9ceb41c..1595d07712 100644 --- a/src/USER-OMP/pair_lj_smooth_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairLJSmoothOMP::PairLJSmoothOMP(LAMMPS *lmp) : PairLJSmooth(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_lubricate_omp.cpp b/src/USER-OMP/pair_lubricate_omp.cpp index 89762acdc5..41db49c8e1 100644 --- a/src/USER-OMP/pair_lubricate_omp.cpp +++ b/src/USER-OMP/pair_lubricate_omp.cpp @@ -24,6 +24,7 @@ #include "random_mars.h" #include "math_const.h" +#include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -32,6 +33,7 @@ using namespace MathConst; PairLubricateOMP::PairLubricateOMP(LAMMPS *lmp) : PairLubricate(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_lubricate_poly_omp.cpp b/src/USER-OMP/pair_lubricate_poly_omp.cpp index 888b01f679..3262fd9e46 100644 --- a/src/USER-OMP/pair_lubricate_poly_omp.cpp +++ b/src/USER-OMP/pair_lubricate_poly_omp.cpp @@ -24,6 +24,7 @@ #include "random_mars.h" #include "math_const.h" +#include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -32,6 +33,7 @@ using namespace MathConst; PairLubricatePolyOMP::PairLubricatePolyOMP(LAMMPS *lmp) : PairLubricatePoly(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_morse_omp.cpp b/src/USER-OMP/pair_morse_omp.cpp index f61fd4e383..18a3fe4950 100644 --- a/src/USER-OMP/pair_morse_omp.cpp +++ b/src/USER-OMP/pair_morse_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairMorseOMP::PairMorseOMP(LAMMPS *lmp) : PairMorse(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_peri_lps_omp.cpp b/src/USER-OMP/pair_peri_lps_omp.cpp index a23f202455..ef6de8777f 100644 --- a/src/USER-OMP/pair_peri_lps_omp.cpp +++ b/src/USER-OMP/pair_peri_lps_omp.cpp @@ -28,6 +28,7 @@ #include "neigh_list.h" #include "math_const.h" +#include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -36,6 +37,7 @@ using namespace MathConst; PairPeriLPSOMP::PairPeriLPSOMP(LAMMPS *lmp) : PairPeriLPS(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_peri_pmb_omp.cpp b/src/USER-OMP/pair_peri_pmb_omp.cpp index 2173bf9e8f..36e4d1a16e 100644 --- a/src/USER-OMP/pair_peri_pmb_omp.cpp +++ b/src/USER-OMP/pair_peri_pmb_omp.cpp @@ -27,6 +27,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -34,6 +35,7 @@ using namespace LAMMPS_NS; PairPeriPMBOMP::PairPeriPMBOMP(LAMMPS *lmp) : PairPeriPMB(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_resquared_omp.cpp b/src/USER-OMP/pair_resquared_omp.cpp index cef5aaefc5..8decc2d6c5 100644 --- a/src/USER-OMP/pair_resquared_omp.cpp +++ b/src/USER-OMP/pair_resquared_omp.cpp @@ -22,6 +22,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -29,6 +30,7 @@ using namespace LAMMPS_NS; PairRESquaredOMP::PairRESquaredOMP(LAMMPS *lmp) : PairRESquared(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_soft_omp.cpp b/src/USER-OMP/pair_soft_omp.cpp index cbc1c9f7fd..f0c9e60df2 100644 --- a/src/USER-OMP/pair_soft_omp.cpp +++ b/src/USER-OMP/pair_soft_omp.cpp @@ -21,6 +21,7 @@ #include "neigh_list.h" #include "math_const.h" +#include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -31,6 +32,7 @@ using namespace MathConst; PairSoftOMP::PairSoftOMP(LAMMPS *lmp) : PairSoft(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_sw_omp.cpp b/src/USER-OMP/pair_sw_omp.cpp index 12aceed1d4..1da1450ad0 100644 --- a/src/USER-OMP/pair_sw_omp.cpp +++ b/src/USER-OMP/pair_sw_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairSWOMP::PairSWOMP(LAMMPS *lmp) : PairSW(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_table_omp.cpp b/src/USER-OMP/pair_table_omp.cpp index a20538f2c0..5c6b7717f7 100644 --- a/src/USER-OMP/pair_table_omp.cpp +++ b/src/USER-OMP/pair_table_omp.cpp @@ -21,6 +21,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -28,6 +29,7 @@ using namespace LAMMPS_NS; PairTableOMP::PairTableOMP(LAMMPS *lmp) : PairTable(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_tersoff_omp.cpp b/src/USER-OMP/pair_tersoff_omp.cpp index fdbcd48292..c725d64253 100644 --- a/src/USER-OMP/pair_tersoff_omp.cpp +++ b/src/USER-OMP/pair_tersoff_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairTersoffOMP::PairTersoffOMP(LAMMPS *lmp) : PairTersoff(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_tersoff_table_omp.cpp b/src/USER-OMP/pair_tersoff_table_omp.cpp index 20c47ed598..6dc3340a89 100644 --- a/src/USER-OMP/pair_tersoff_table_omp.cpp +++ b/src/USER-OMP/pair_tersoff_table_omp.cpp @@ -21,6 +21,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -28,6 +29,7 @@ using namespace LAMMPS_NS; PairTersoffTableOMP::PairTersoffTableOMP(LAMMPS *lmp) : PairTersoffTable(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_tri_lj_omp.cpp b/src/USER-OMP/pair_tri_lj_omp.cpp index 97f58a62d5..eedbc570af 100644 --- a/src/USER-OMP/pair_tri_lj_omp.cpp +++ b/src/USER-OMP/pair_tri_lj_omp.cpp @@ -28,6 +28,7 @@ #include +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -35,6 +36,7 @@ using namespace LAMMPS_NS; PairTriLJOMP::PairTriLJOMP(LAMMPS *lmp) : PairTriLJ(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_yukawa_colloid_omp.cpp b/src/USER-OMP/pair_yukawa_colloid_omp.cpp index 6caa13ee90..9990b713e2 100644 --- a/src/USER-OMP/pair_yukawa_colloid_omp.cpp +++ b/src/USER-OMP/pair_yukawa_colloid_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairYukawaColloidOMP::PairYukawaColloidOMP(LAMMPS *lmp) : PairYukawaColloid(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/pair_yukawa_omp.cpp b/src/USER-OMP/pair_yukawa_omp.cpp index 210c7fcc1e..c7fa20e814 100644 --- a/src/USER-OMP/pair_yukawa_omp.cpp +++ b/src/USER-OMP/pair_yukawa_omp.cpp @@ -20,6 +20,7 @@ #include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -27,6 +28,7 @@ using namespace LAMMPS_NS; PairYukawaOMP::PairYukawaOMP(LAMMPS *lmp) : PairYukawa(lmp), ThrOMP(lmp, THR_PAIR) { + suffix_flag |= Suffix::OMP; respa_enable = 0; } diff --git a/src/USER-OMP/thr_omp.cpp b/src/USER-OMP/thr_omp.cpp index 8ff0c9b6cf..f296ac0fb6 100644 --- a/src/USER-OMP/thr_omp.cpp +++ b/src/USER-OMP/thr_omp.cpp @@ -173,6 +173,8 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag, double **f = lmp->atom->f; double **x = lmp->atom->x; + int need_force_reduce = 1; + if (evflag) sync_threads(); @@ -180,12 +182,23 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag, case THR_PAIR: { Pair * const pair = lmp->force->pair; - + if (pair->vflag_fdotr) { - if (lmp->neighbor->includegroup == 0) - thr->virial_fdotr_compute(x, nlocal, nghost, -1); - else - thr->virial_fdotr_compute(x, nlocal, nghost, nfirst); + + if (style == fix->last_pair_hybrid) { + // pair_style hybrid will compute fdotr for us + // but we first need to reduce the forces + data_reduce_thr(&(f[0][0]), nall, nthreads, 3, tid); + need_force_reduce = 0; + } + + // this is a non-hybrid pair style. compute per thread fdotr + if (fix->last_pair_hybrid == NULL) { + if (lmp->neighbor->includegroup == 0) + thr->virial_fdotr_compute(x, nlocal, nghost, -1); + else + thr->virial_fdotr_compute(x, nlocal, nghost, nfirst); + } } if (evflag) { @@ -217,12 +230,23 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag, case THR_PAIR|THR_PROXY: { Pair * const pair = lmp->force->pair; - + if (tid >= nproxy && pair->vflag_fdotr) { - if (lmp->neighbor->includegroup == 0) - thr->virial_fdotr_compute(x, nlocal, nghost, -1); - else - thr->virial_fdotr_compute(x, nlocal, nghost, nfirst); + + if (fix->last_pair_hybrid) { + if (tid == nproxy) + lmp->error->all(FLERR, + "Cannot use hybrid pair style with kspace proxy"); + else return; + } + + // this is a non-hybrid pair style. compute per thread fdotr + if (fix->last_pair_hybrid == NULL) { + if (lmp->neighbor->includegroup == 0) + thr->virial_fdotr_compute(x, nlocal, nghost, -1); + else + thr->virial_fdotr_compute(x, nlocal, nghost, nfirst); + } } if (evflag) { @@ -406,8 +430,10 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag, break; } - if (style == fix->last_omp_style) { - data_reduce_thr(&(f[0][0]), nall, nthreads, 3, tid); + if (style == fix->last_omp_style) { + if (need_force_reduce) + data_reduce_thr(&(f[0][0]), nall, nthreads, 3, tid); + if (lmp->atom->torque) data_reduce_thr(&(lmp->atom->torque[0][0]), nall, nthreads, 3, tid); } diff --git a/src/pair.cpp b/src/pair.cpp index 8e49cd99a4..8a8b29274a 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -33,6 +33,7 @@ #include "accelerator_cuda.h" #include "memory.h" #include "error.h" +#include "suffix.h" using namespace LAMMPS_NS; @@ -71,6 +72,7 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp) tabinner = sqrt(2.0); allocated = 0; + suffix_flag = Suffix::NONE; maxeatom = maxvatom = 0; eatom = NULL; diff --git a/src/pair.h b/src/pair.h index 93231ccc39..9f531958a9 100644 --- a/src/pair.h +++ b/src/pair.h @@ -1,4 +1,4 @@ -/* ---------------------------------------------------------------------- +/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov @@ -26,6 +26,7 @@ class Pair : protected Pointers { friend class DihedralCharmm; friend class DihedralCharmmOMP; friend class FixGPU; + friend class FixOMP; friend class ThrOMP; public: @@ -133,7 +134,8 @@ class Pair : protected Pointers { virtual void min_x_set(int) {} protected: - int allocated; // 0/1 = whether arrays are allocated + int allocated; // 0/1 = whether arrays are allocated + int suffix_flag; // suffix compatibility flag // pair_modify settings int offset_flag,mix_flag; // flags for offset and mixing diff --git a/src/pair_beck.h b/src/pair_beck.h index 4fcc99501a..83c2a812f3 100644 --- a/src/pair_beck.h +++ b/src/pair_beck.h @@ -28,7 +28,7 @@ class PairBeck : public Pair { public: PairBeck(class LAMMPS *); virtual ~PairBeck(); - void compute(int, int); + virtual void compute(int, int); void settings(int, char **); void coeff(int, char **); double init_one(int, int); @@ -56,17 +56,14 @@ class PairBeck : public Pair { E: Illegal ... command -Self-explanatory. Check the input script syntax and compare to the -documentation for the command. You can use -echo screen as a -command-line option when running LAMMPS to see the offending line. +UNDOCUMENTED E: Incorrect args for pair coefficients -Self-explanatory. Check the input script or data file. +UNDOCUMENTED E: All pair coeffs are not set -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. +UNDOCUMENTED */ diff --git a/src/suffix.h b/src/suffix.h new file mode 100644 index 0000000000..9dd105ed53 --- /dev/null +++ b/src/suffix.h @@ -0,0 +1,29 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_SUFFIX_H +#define LMP_SUFFIX_H + +namespace LAMMPS_NS { + +namespace Suffix { + static const int NONE = 0; + static const int OPT = 1<<0; + static const int GPU = 1<<1; + static const int CUDA = 1<<2; + static const int OMP = 1<<3; +} + +} + +#endif