From 4fb55e497252ba58fbdb1c01bdf6dd153c61c21b Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 30 Sep 2011 16:58:05 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@7019 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/GPU/pair_cg_cmm_gpu.cpp | 2 +- src/KSPACE/pair_born_coul_long.cpp | 3 +-- src/KSPACE/pair_buck_coul_long.cpp | 3 +-- src/KSPACE/pair_lj_cut_coul_long_tip4p.h | 4 ++-- src/OPT/Install.sh | 8 ++++++++ src/OPT/Package.sh | 12 ++++++++++++ src/USER-MISC/fix_imd.cpp | 2 +- src/pair_buck_coul_cut.cpp | 6 +++--- 8 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/GPU/pair_cg_cmm_gpu.cpp b/src/GPU/pair_cg_cmm_gpu.cpp index b7f7ccd330..c26cd37f5f 100644 --- a/src/GPU/pair_cg_cmm_gpu.cpp +++ b/src/GPU/pair_cg_cmm_gpu.cpp @@ -126,7 +126,7 @@ void PairCGCMMGPU::init_style() cut_respa = NULL; if (force->newton_pair) - error->all(FLERR,"Cannot use newton pair with GPU CGCMM pair style"); + error->all(FLERR,"Cannot use newton pair with cg/cmm/gpu pair style"); // Repeat cutsq calculation because done after call to init_style double maxcut = -1.0; diff --git a/src/KSPACE/pair_born_coul_long.cpp b/src/KSPACE/pair_born_coul_long.cpp index 44f3d73bf9..dca8532d35 100644 --- a/src/KSPACE/pair_born_coul_long.cpp +++ b/src/KSPACE/pair_born_coul_long.cpp @@ -122,9 +122,9 @@ void PairBornCoulLong::compute(int eflag, int vflag) if (rsq < cutsq[itype][jtype]) { r2inv = 1.0/rsq; + r = sqrt(rsq); if (rsq < cut_coulsq) { - r = sqrt(rsq); grij = g_ewald * r; expm2 = exp(-grij*grij); t = 1.0 / (1.0 + EWALD_P*grij); @@ -136,7 +136,6 @@ void PairBornCoulLong::compute(int eflag, int vflag) if (rsq < cut_ljsq[itype][jtype]) { r6inv = r2inv*r2inv*r2inv; - r = sqrt(rsq); rexp = exp((sigma[itype][jtype]-r)*rhoinv[itype][jtype]); forceborn = born1[itype][jtype]*r*rexp - born2[itype][jtype]*r6inv + born3[itype][jtype]*r2inv*r6inv; diff --git a/src/KSPACE/pair_buck_coul_long.cpp b/src/KSPACE/pair_buck_coul_long.cpp index 6b3e92b50d..813b3b025a 100644 --- a/src/KSPACE/pair_buck_coul_long.cpp +++ b/src/KSPACE/pair_buck_coul_long.cpp @@ -115,9 +115,9 @@ void PairBuckCoulLong::compute(int eflag, int vflag) if (rsq < cutsq[itype][jtype]) { r2inv = 1.0/rsq; + r = sqrt(rsq); if (rsq < cut_coulsq) { - r = sqrt(rsq); grij = g_ewald * r; expm2 = exp(-grij*grij); t = 1.0 / (1.0 + EWALD_P*grij); @@ -129,7 +129,6 @@ void PairBuckCoulLong::compute(int eflag, int vflag) if (rsq < cut_ljsq[itype][jtype]) { r6inv = r2inv*r2inv*r2inv; - r = sqrt(rsq); rexp = exp(-r*rhoinv[itype][jtype]); forcebuck = buck1[itype][jtype]*r*rexp - buck2[itype][jtype]*r6inv; } else forcebuck = 0.0; diff --git a/src/KSPACE/pair_lj_cut_coul_long_tip4p.h b/src/KSPACE/pair_lj_cut_coul_long_tip4p.h index fb660b7176..2206e0c93b 100644 --- a/src/KSPACE/pair_lj_cut_coul_long_tip4p.h +++ b/src/KSPACE/pair_lj_cut_coul_long_tip4p.h @@ -27,14 +27,14 @@ namespace LAMMPS_NS { class PairLJCutCoulLongTIP4P : public PairLJCutCoulLong { public: PairLJCutCoulLongTIP4P(class LAMMPS *); - void compute(int, int); + virtual void compute(int, int); void settings(int, char **); void init_style(); void write_restart_settings(FILE *fp); void read_restart_settings(FILE *fp); void *extract(char *, int &); - private: + protected: int typeH,typeO; // atom types of TIP4P water H and O atoms int typeA,typeB; // angle and bond types of TIP4P water double qdist; // distance from O site to negative charge diff --git a/src/OPT/Install.sh b/src/OPT/Install.sh index c3a413fa8c..a4005e74ea 100644 --- a/src/OPT/Install.sh +++ b/src/OPT/Install.sh @@ -15,6 +15,10 @@ if (test $1 = 1) then if (test -e ../pair_lj_charmm_coul_long.cpp) then cp pair_lj_charmm_coul_long_opt.cpp .. cp pair_lj_charmm_coul_long_opt.h .. + cp pair_lj_cut_coul_long_opt.cpp .. + cp pair_lj_cut_coul_long_opt.h .. + cp pair_lj_cut_coul_long_tip4p_opt.cpp .. + cp pair_lj_cut_coul_long_tip4p_opt.h .. fi cp pair_lj_cut_opt.cpp .. @@ -29,6 +33,8 @@ elif (test $1 = 0) then rm -f ../pair_eam_alloy_opt.cpp rm -f ../pair_eam_fs_opt.cpp rm -f ../pair_lj_charmm_coul_long_opt.cpp + rm -f ../pair_lj_cut_coul_long_opt.cpp + rm -f ../pair_lj_cut_coul_long_tip4p_opt.cpp rm -f ../pair_lj_cut_opt.cpp rm -f ../pair_morse_opt.cpp @@ -36,6 +42,8 @@ elif (test $1 = 0) then rm -f ../pair_eam_alloy_opt.h rm -f ../pair_eam_fs_opt.h rm -f ../pair_lj_charmm_coul_long_opt.h + rm -f ../pair_lj_cut_coul_long_opt.h + rm -f ../pair_lj_cut_coul_long_tip4p_opt.h rm -f ../pair_lj_cut_opt.h rm -f ../pair_morse_opt.h diff --git a/src/OPT/Package.sh b/src/OPT/Package.sh index a822239950..a1714684fc 100644 --- a/src/OPT/Package.sh +++ b/src/OPT/Package.sh @@ -27,6 +27,18 @@ for file in *.cpp *.h; do if (test $file = pair_lj_charmm_coul_long_opt.h -a ! -e ../pair_lj_charmm_coul_long.cpp) then continue fi + if (test $file = pair_lj_cut_coul_long_opt.cpp -a ! -e ../pair_lj_cut_coul_long.cpp) then + continue + fi + if (test $file = pair_lj_cut_coul_long_opt.h -a ! -e ../pair_lj_cut_coul_long.cpp) then + continue + fi + if (test $file = pair_lj_cut_coul_long_tip4p_opt.cpp -a ! -e ../pair_lj_cut_coul_long_tip4p.cpp) then + continue + fi + if (test $file = pair_lj_cut_coul_long_tip4p_opt.h -a ! -e ../pair_lj_cut_coul_long_tip4p.cpp) then + continue + fi if (test ! -e ../$file) then echo " creating src/$file" diff --git a/src/USER-MISC/fix_imd.cpp b/src/USER-MISC/fix_imd.cpp index 25b140318d..462883a207 100644 --- a/src/USER-MISC/fix_imd.cpp +++ b/src/USER-MISC/fix_imd.cpp @@ -1234,7 +1234,7 @@ void *imdsock_accept(void * v) { #elif defined(SOCKLEN_T) SOCKLEN_T len; #define _SOCKLEN_TYPE SOCKLEN_T -#elif defined(_POSIX_SOURCE) +#elif defined(_POSIX_SOURCE) || (defined(__APPLE__) && defined(__MACH__)) || defined(__linux) socklen_t len; #define _SOCKLEN_TYPE socklen_t #else diff --git a/src/pair_buck_coul_cut.cpp b/src/pair_buck_coul_cut.cpp index 66a187ae1a..51c179b889 100644 --- a/src/pair_buck_coul_cut.cpp +++ b/src/pair_buck_coul_cut.cpp @@ -110,14 +110,14 @@ void PairBuckCoulCut::compute(int eflag, int vflag) if (rsq < cutsq[itype][jtype]) { r2inv = 1.0/rsq; + r = sqrt(rsq); if (rsq < cut_coulsq[itype][jtype]) - forcecoul = qqrd2e * qtmp*q[j]*sqrt(r2inv); + forcecoul = qqrd2e * qtmp*q[j]/r; else forcecoul = 0.0; if (rsq < cut_ljsq[itype][jtype]) { r6inv = r2inv*r2inv*r2inv; - r = sqrt(rsq); rexp = exp(-r*rhoinv[itype][jtype]); forcebuck = buck1[itype][jtype]*r*rexp - buck2[itype][jtype]*r6inv; } else forcebuck = 0.0; @@ -135,7 +135,7 @@ void PairBuckCoulCut::compute(int eflag, int vflag) if (eflag) { if (rsq < cut_coulsq[itype][jtype]) - ecoul = factor_coul * qqrd2e * qtmp*q[j]*sqrt(r2inv); + ecoul = factor_coul * qqrd2e * qtmp*q[j]/r; else ecoul = 0.0; if (rsq < cut_ljsq[itype][jtype]) { evdwl = a[itype][jtype]*rexp - c[itype][jtype]*r6inv -