From 92f078cfffffc15734e86b519fb46ba7aa2dba22 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 4 Jun 2019 22:29:25 -0400 Subject: [PATCH 1/9] nicer typesetting of "none, zero, hybrid" potential styles in commands lists --- doc/src/Commands_bond.txt | 32 ++++++++++++++++++++++++-------- doc/src/Commands_pair.txt | 7 +++++-- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/doc/src/Commands_bond.txt b/doc/src/Commands_bond.txt index 3d889ac08e..40c2d0283a 100644 --- a/doc/src/Commands_bond.txt +++ b/doc/src/Commands_bond.txt @@ -28,8 +28,12 @@ OPT. "none"_bond_none.html, "zero"_bond_zero.html, -"hybrid"_bond_hybrid.html :tb(c=3,ea=c) - +"hybrid"_bond_hybrid.html, +, +, +, +, +, "class2 (ko)"_bond_class2.html, "fene (iko)"_bond_fene.html, "fene/expand (o)"_bond_fene_expand.html, @@ -56,8 +60,12 @@ OPT. "none"_angle_none.html, "zero"_angle_zero.html, -"hybrid"_angle_hybrid.html :tb(c=3,ea=c) - +"hybrid"_angle_hybrid.html, +, +, +, +, +, "charmm (iko)"_angle_charmm.html, "class2 (ko)"_angle_class2.html, "class2/p6"_angle_class2.html, @@ -89,8 +97,12 @@ OPT. "none"_dihedral_none.html, "zero"_dihedral_zero.html, -"hybrid"_dihedral_hybrid.html :tb(c=3,ea=c) - +"hybrid"_dihedral_hybrid.html, +, +, +, +, +, "charmm (iko)"_dihedral_charmm.html, "charmmfsw"_dihedral_charmm.html, "class2 (ko)"_dihedral_class2.html, @@ -117,8 +129,12 @@ OPT. "none"_improper_none.html, "zero"_improper_zero.html, -"hybrid"_improper_hybrid.html :tb(c=3,ea=c) - +"hybrid"_improper_hybrid.html, +, +, +, +, +, "class2 (ko)"_improper_class2.html, "cossq (o)"_improper_cossq.html, "cvff (io)"_improper_cvff.html, diff --git a/doc/src/Commands_pair.txt b/doc/src/Commands_pair.txt index e9925b0e0b..fea085b4ed 100644 --- a/doc/src/Commands_pair.txt +++ b/doc/src/Commands_pair.txt @@ -27,8 +27,11 @@ OPT. "none"_pair_none.html, "zero"_pair_zero.html, "hybrid (k)"_pair_hybrid.html, -"hybrid/overlay (k)"_pair_hybrid.html :tb(c=4,ea=c) - +"hybrid/overlay (k)"_pair_hybrid.html, +, +, +, +, "adp (o)"_pair_adp.html, "agni (o)"_pair_agni.html, "airebo (io)"_pair_airebo.html, From 8e43a459255acd619da4ef92d5a40a0db5c92f61 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 5 Jun 2019 01:10:44 -0400 Subject: [PATCH 2/9] Detect and error out on invalid kspace mesh settings. make coulomb and dispersion settings consistent --- doc/src/Errors_messages.txt | 12 ++++++++++++ src/kspace.cpp | 12 ++++++++++-- src/kspace.h | 12 ++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/doc/src/Errors_messages.txt b/doc/src/Errors_messages.txt index 34a458232b..7249bfddfd 100644 --- a/doc/src/Errors_messages.txt +++ b/doc/src/Errors_messages.txt @@ -7097,6 +7097,18 @@ Self-explanatory. :dd One or more GPUs must be used when Kokkos is compiled for CUDA. :dd +{Kspace_modify mesh parameter must be all zero or all positive} :dt + +Valid kspace mesh parameters are >0. The code will try to auto-detect +suitable values when all three mesh sizes are set to zero (the default). :dd + +{Kspace_modify mesh/disp parameter must be all zero or all positive} :dt + +Valid kspace mesh/disp parameters are >0. The code will try to auto-detect +suitable values when all three mesh sizes are set to zero [and] +the required accuracy via {force/disp/real} as well as +{force/disp/kspace} is set. :dd + {Kspace style does not support compute group/group} :dt Self-explanatory. :dd diff --git a/src/kspace.cpp b/src/kspace.cpp index 0144ea59a3..64a769fa51 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -443,7 +443,11 @@ void KSpace::modify_params(int narg, char **arg) nx_pppm = nx_msm_max = force->inumeric(FLERR,arg[iarg+1]); ny_pppm = ny_msm_max = force->inumeric(FLERR,arg[iarg+2]); nz_pppm = nz_msm_max = force->inumeric(FLERR,arg[iarg+3]); - if (nx_pppm == 0 && ny_pppm == 0 && nz_pppm == 0) gridflag = 0; + if (nx_pppm == 0 && ny_pppm == 0 && nz_pppm == 0) + gridflag = 0; + else if (nx_pppm <= 0 || ny_pppm <= 0 || nz_pppm <= 0) + error->all(FLERR,"Kspace_modify mesh parameters must be all " + "zero or all positive"); else gridflag = 1; iarg += 4; } else if (strcmp(arg[iarg],"mesh/disp") == 0) { @@ -451,7 +455,11 @@ void KSpace::modify_params(int narg, char **arg) nx_pppm_6 = force->inumeric(FLERR,arg[iarg+1]); ny_pppm_6 = force->inumeric(FLERR,arg[iarg+2]); nz_pppm_6 = force->inumeric(FLERR,arg[iarg+3]); - if (nx_pppm_6 == 0 || ny_pppm_6 == 0 || nz_pppm_6 == 0) gridflag_6 = 0; + if (nx_pppm_6 == 0 && ny_pppm_6 == 0 && nz_pppm_6 == 0) + gridflag_6 = 0; + else if (nx_pppm_6 <= 0 || ny_pppm_6 <= 0 || nz_pppm_6 == 0) + error->all(FLERR,"Kspace_modify mesh/disp parameters must be all " + "zero or all positive"); else gridflag_6 = 1; iarg += 4; } else if (strcmp(arg[iarg],"order") == 0) { diff --git a/src/kspace.h b/src/kspace.h index 2345cebf24..4fd260e186 100644 --- a/src/kspace.h +++ b/src/kspace.h @@ -251,6 +251,18 @@ E: Bad kspace_modify slab parameter Kspace_modify value for the slab/volume keyword must be >= 2.0. +E: Kspace_modify mesh parameter must be all zero or all positive + +Valid kspace mesh parameters are >0. The code will try to auto-detect +suitable values when all three mesh sizes are set to zero (the default). + +E: Kspace_modify mesh/disp parameter must be all zero or all positive + +Valid kspace mesh/disp parameters are >0. The code will try to auto-detect +suitable values when all three mesh sizes are set to zero [and] +the required accuracy via {force/disp/real} as well as +{force/disp/kspace} is set. + W: Kspace_modify slab param < 2.0 may cause unphysical behavior The kspace_modify slab parameter should be larger to insure periodic From 34dca6dc7949750692b67b85b2728c9eeaad0eb9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 5 Jun 2019 14:32:02 -0400 Subject: [PATCH 3/9] advance warning message about collecting styles and packages info to an earlier slot in the process --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 2e6ad9a89f..d611adc404 100644 --- a/src/Makefile +++ b/src/Makefile @@ -154,7 +154,6 @@ help: lmpinstalledpkgs.h: $(SRC) $(INC) - @echo 'Gathering installed package information (may take a little while)' @echo '#ifndef LMP_INSTALLED_PKGS_H' > ${TMPNAME}.lmpinstalled @echo '#define LMP_INSTALLED_PKGS_H' >> ${TMPNAME}.lmpinstalled @echo 'const char * LAMMPS_NS::LAMMPS::installed_packages[] = {' >> ${TMPNAME}.lmpinstalled @@ -204,6 +203,7 @@ gitversion: @test -f MAKE/Makefile.$@ -o -f MAKE/OPTIONS/Makefile.$@ -o \ -f MAKE/MACHINES/Makefile.$@ -o -f MAKE/MINE/Makefile.$@ @if [ ! -d $(objdir) ]; then mkdir $(objdir); fi + @echo 'Gathering installed package information (may take a little while)' @$(SHELL) Make.sh style @$(SHELL) Make.sh packages @$(MAKE) $(MFLAGS) lmpinstalledpkgs.h gitversion From e549f911f7b0aab04c8fb97199dd2890148e68bb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 5 Jun 2019 14:36:08 -0400 Subject: [PATCH 4/9] turn off variable tracking through turning off optimization for GCC 4.4 and later This will avoid a difficult to interpret warning and in addition speed up compilation of this one file by avoiding to try to optimize something, that needs no optimization. --- src/lammps.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lammps.cpp b/src/lammps.cpp index 24012c0f18..0234e7faef 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -53,6 +53,12 @@ #include "memory.h" #include "error.h" +#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) +#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) +#pragma GCC optimize ("O0") +#endif +#endif + #include "lmpinstalledpkgs.h" #include "lmpgitversion.h" From e2391edce6fb2e6f79eef4466b2511bf3e9f2bab Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 6 Jun 2019 14:44:28 -0400 Subject: [PATCH 5/9] turn off only variable tracking and make people wait again --- src/lammps.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lammps.cpp b/src/lammps.cpp index 0234e7faef..c119e429e0 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -55,7 +55,7 @@ #if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) -#pragma GCC optimize ("O0") +#pragma GCC optimize ("no-var-tracking") #endif #endif @@ -114,7 +114,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : initclock = MPI_Wtime(); init_pkg_lists(); - + // check if -mpi is first arg // if so, then 2 apps were launched with one mpirun command // this means passed communicator (e.g. MPI_COMM_WORLD) is bigger than LAMMPS From fde7e2de3cf4399de5189f7ca45b2ec8d6da55d6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 6 Jun 2019 15:08:26 -0400 Subject: [PATCH 6/9] switch to use alternate flag --- src/lammps.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lammps.cpp b/src/lammps.cpp index c119e429e0..780327c0d9 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -55,7 +55,7 @@ #if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) -#pragma GCC optimize ("no-var-tracking") +#pragma GCC optimize ("no-var-tracking-assignments") #endif #endif From 56e3b1d1f4db4512f2edd8a3f971b5dc53b14bad Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 6 Jun 2019 20:22:08 -0400 Subject: [PATCH 7/9] remove dead code --- src/USER-FEP/pair_lj_class2_coul_long_soft.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp index 6410f83fa1..275486d1e2 100644 --- a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp @@ -74,7 +74,6 @@ void PairLJClass2CoulLongSoft::compute(int eflag, int vflag) { int i,j,ii,jj,inum,jnum,itype,jtype; double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair; - double fraction; double rsq,r,forcecoul,forcelj; double grij,expm2,prefactor,t,erfc; double factor_coul,factor_lj; @@ -490,7 +489,7 @@ double PairLJClass2CoulLongSoft::single(int i, int j, int itype, int jtype, double &fforce) { double denc,r,denlj,r4sig6,grij,expm2,t,erfc,prefactor; - double fraction,forcecoul,forcelj,phicoul,philj; + double forcecoul,forcelj,phicoul,philj; if (rsq < cut_coulsq) { r = sqrt(rsq); From b53df3dd63bf98e7e0022d9bdfac82c14fbc8306 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 6 Jun 2019 20:37:17 -0400 Subject: [PATCH 8/9] disable optimization on functions building factories for many entries this will speed up compilation and also avoid spurious warnings with gcc 4.4 and later --- src/force.cpp | 4 ++++ src/force.h | 1 + src/lammps.cpp | 12 +++--------- src/lmptype.h | 20 ++++++++++++++++++++ src/modify.cpp | 5 +++++ src/modify.h | 1 + 6 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/force.cpp b/src/force.cpp index 2691cb3fd8..ed27df1215 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -80,7 +80,11 @@ Force::Force(LAMMPS *lmp) : Pointers(lmp) strcpy(kspace_style,str); pair_restart = NULL; + create_factories(); +} +void _noopt Force::create_factories() +{ // fill pair map with pair styles listed in style_pair.h pair_map = new PairCreatorMap(); diff --git a/src/force.h b/src/force.h index 2b4298d049..227b9427c0 100644 --- a/src/force.h +++ b/src/force.h @@ -143,6 +143,7 @@ class Force : protected Pointers { bigint memory_usage(); private: + void create_factories(); template static Pair *pair_creator(LAMMPS *); template static Bond *bond_creator(LAMMPS *); template static Angle *angle_creator(LAMMPS *); diff --git a/src/lammps.cpp b/src/lammps.cpp index 780327c0d9..f8d04c9323 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -53,12 +53,6 @@ #include "memory.h" #include "error.h" -#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) -#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) -#pragma GCC optimize ("no-var-tracking-assignments") -#endif -#endif - #include "lmpinstalledpkgs.h" #include "lmpgitversion.h" @@ -902,7 +896,7 @@ void LAMMPS::destroy() initialize lists of styles in packages ------------------------------------------------------------------------- */ -void LAMMPS::init_pkg_lists() +void _noopt LAMMPS::init_pkg_lists() { pkg_lists = new package_styles_lists; #define PACKAGE "UNKNOWN" @@ -1002,7 +996,7 @@ void LAMMPS::init_pkg_lists() #include "packages_region.h" #undef RegionStyle #undef REGION_CLASS -} +} bool LAMMPS::is_installed_pkg(const char *pkg) { @@ -1045,7 +1039,7 @@ const char *LAMMPS::match_style(const char *style, const char *name) help message for command line options and styles present in executable ------------------------------------------------------------------------- */ -void LAMMPS::help() +void _noopt LAMMPS::help() { FILE *fp = screen; const char *pager = NULL; diff --git a/src/lmptype.h b/src/lmptype.h index 4743a38837..20d29880ed 100644 --- a/src/lmptype.h +++ b/src/lmptype.h @@ -179,6 +179,9 @@ typedef int bigint; #ifdef _noalias #undef _noalias #endif +#ifdef _noopt +#undef _noopt +#endif // define stack variable alignment @@ -200,6 +203,23 @@ typedef int bigint; #define _noalias #endif +// declaration to turn off optimization for specific functions +// and avoid compiler warnings about variable tracking + +#if defined(__clang__) +# define _noopt __attribute__((optnone)) +#elif defined(__INTEL_COMPILER) +# define _noopt +#elif defined(__GNUC__) +# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) +# define _noopt __attribute__((optimize("O0","no-var-tracking-assignments"))) +# else +# define _noopt __attribute__((optimize("O0"))) +# endif +#else +# define _noopt +#endif + // settings to enable LAMMPS to build under Windows #ifdef _WIN32 diff --git a/src/modify.cpp b/src/modify.cpp index 69cdb424b2..3f034bf034 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -81,6 +81,11 @@ Modify::Modify(LAMMPS *lmp) : Pointers(lmp) ncompute = maxcompute = 0; compute = NULL; + create_factories(); +} + +void _noopt Modify::create_factories() +{ // fill map with fixes listed in style_fix.h fix_map = new FixCreatorMap(); diff --git a/src/modify.h b/src/modify.h index 537ff81543..5ff81855fe 100644 --- a/src/modify.h +++ b/src/modify.h @@ -172,6 +172,7 @@ class Modify : protected Pointers { FixCreatorMap *fix_map; protected: + void create_factories(); template static Compute *compute_creator(LAMMPS *, int, char **); template static Fix *fix_creator(LAMMPS *, int, char **); }; From 61e9dc4c8d7c590c0498d49c2736ed1a845bb647 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 7 Jun 2019 07:14:57 -0400 Subject: [PATCH 9/9] more accurate checking for styles using utils::strmatch() instead of strcmp() or strncmp() --- src/USER-PLUMED/fix_plumed.cpp | 27 ++++++++++++++------------- src/USER-QTB/fix_qbmsst.cpp | 11 ++++++----- src/fix_adapt.cpp | 7 +++---- src/fix_nve_limit.cpp | 5 +++-- src/neighbor.cpp | 5 +++-- src/pair_coul_streitz.cpp | 6 ------ src/velocity.cpp | 2 +- 7 files changed, 30 insertions(+), 33 deletions(-) diff --git a/src/USER-PLUMED/fix_plumed.cpp b/src/USER-PLUMED/fix_plumed.cpp index 635d08c573..9921747b22 100644 --- a/src/USER-PLUMED/fix_plumed.cpp +++ b/src/USER-PLUMED/fix_plumed.cpp @@ -33,6 +33,7 @@ #include "compute.h" #include "modify.h" #include "pair.h" +#include "utils.h" #include "plumed/wrapper/Plumed.h" @@ -250,15 +251,15 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) : // Avoid conflict with fixes that define internal pressure computes. // See comment in the setup method - if ((strncmp(check_style,"nph",3) == 0) || - (strncmp(check_style,"npt",3) == 0) || - (strncmp(check_style,"rigid/nph",9) == 0) || - (strncmp(check_style,"rigid/npt",9) == 0) || - (strncmp(check_style,"msst",4) == 0) || - (strncmp(check_style,"nphug",5) == 0) || - (strncmp(check_style,"ipi",3) == 0) || - (strncmp(check_style,"press/berendsen",15) == 0) || - (strncmp(check_style,"qbmsst",6) == 0)) + if (utils::strmatch(check_style,"^nph") || + utils::strmatch(check_style,"^npt") || + utils::strmatch(check_style,"^rigid/nph") || + utils::strmatch(check_style,"^rigid/npt") || + utils::strmatch(check_style,"^msst") || + utils::strmatch(check_style,"^nphug") || + utils::strmatch(check_style,"^ipi") || + utils::strmatch(check_style,"^press/berendsen") || + utils::strmatch(check_style,"^qbmsst")) error->all(FLERR,"Fix plumed must be defined before any other fixes, " "that compute pressure internally"); } @@ -289,7 +290,7 @@ int FixPlumed::setmask() void FixPlumed::init() { - if (strcmp(update->integrate_style,"respa") == 0) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; // This avoids nan pressure if compute_pressure is called @@ -309,12 +310,12 @@ void FixPlumed::setup(int vflag) // has to be executed first. This creates a race condition with the // setup method of fix_nh. This is why in the constructor I check if // nh fixes have already been called. - if (strcmp(update->integrate_style,"verlet") == 0) - post_force(vflag); - else { + if (utils::strmatch(update->integrate_style,"^respa")) { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); post_force_respa(vflag,nlevels_respa-1,0); ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); + } else { + post_force(vflag); } } diff --git a/src/USER-QTB/fix_qbmsst.cpp b/src/USER-QTB/fix_qbmsst.cpp index e8a4f85eaa..b9b07664d2 100644 --- a/src/USER-QTB/fix_qbmsst.cpp +++ b/src/USER-QTB/fix_qbmsst.cpp @@ -41,6 +41,7 @@ #include "group.h" #include "kspace.h" #include "thermo.h" +#include "utils.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -410,14 +411,14 @@ void FixQBMSST::init() // rfix[] = indices to each fix rigid nrigid = 0; for (int i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style,"rigid") == 0 || - strcmp(modify->fix[i]->style,"poems") == 0) nrigid++; - if (nrigid) { + if (utils::strmatch(modify->fix[i]->style,"^rigid") || + (strcmp(modify->fix[i]->style,"poems") == 0)) nrigid++; + if (nrigid > 0) { rfix = new int[nrigid]; nrigid = 0; for (int i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style,"rigid") == 0 || - strcmp(modify->fix[i]->style,"poems") == 0) rfix[nrigid++] = i; + if (utils::strmatch(modify->fix[i]->style,"^rigid") || + (strcmp(modify->fix[i]->style,"poems") == 0)) rfix[nrigid++] = i; } } diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index 950bc24253..9a5b528747 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -31,6 +31,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -375,8 +376,7 @@ void FixAdapt::init() // if pair hybrid, test that ilo,ihi,jlo,jhi are valid for sub-style - if (strcmp(force->pair_style,"hybrid") == 0 || - strcmp(force->pair_style,"hybrid/overlay") == 0) { + if (utils::strmatch(force->pair_style,"^hybrid")) { PairHybrid *pair = (PairHybrid *) force->pair; for (i = ad->ilo; i <= ad->ihi; i++) for (j = MAX(ad->jlo,i); j <= ad->jhi; j++) @@ -416,8 +416,7 @@ void FixAdapt::init() if (ad->bdim == 1) ad->vector = (double *) ptr; - if (strcmp(force->bond_style,"hybrid") == 0 || - strcmp(force->bond_style,"hybrid_overlay") == 0) + if (utils::strmatch(force->bond_style,"^hybrid")) error->all(FLERR,"Fix adapt does not support bond_style hybrid"); delete [] bstyle; diff --git a/src/fix_nve_limit.cpp b/src/fix_nve_limit.cpp index b4fb43e56f..68ff0665a1 100644 --- a/src/fix_nve_limit.cpp +++ b/src/fix_nve_limit.cpp @@ -23,6 +23,7 @@ #include "modify.h" #include "comm.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -72,8 +73,8 @@ void FixNVELimit::init() // warn if using fix shake, which will lead to invalid constraint forces for (int i = 0; i < modify->nfix; i++) - if ((strcmp(modify->fix[i]->style,"shake") == 0) - || (strcmp(modify->fix[i]->style,"rattle") == 0)) { + if (utils::strmatch(modify->fix[i]->style,"^shake") + || utils::strmatch(modify->fix[i]->style,"^rattle")) { if (comm->me == 0) error->warning(FLERR,"Should not use fix nve/limit with fix shake or fix rattle"); } diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 2dc65541e4..0382624198 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -46,6 +46,7 @@ #include "citeme.h" #include "memory.h" #include "error.h" +#include "utils.h" #include @@ -1282,8 +1283,8 @@ void Neighbor::init_topology() int bond_off = 0; int angle_off = 0; for (i = 0; i < modify->nfix; i++) - if ((strcmp(modify->fix[i]->style,"shake") == 0) - || (strcmp(modify->fix[i]->style,"rattle") == 0)) + if (utils::strmatch(modify->fix[i]->style,"^shake") + || utils::strmatch(modify->fix[i]->style,"^rattle")) bond_off = angle_off = 1; if (force->bond && force->bond_match("quartic")) bond_off = 1; diff --git a/src/pair_coul_streitz.cpp b/src/pair_coul_streitz.cpp index 244dccda12..282c855249 100644 --- a/src/pair_coul_streitz.cpp +++ b/src/pair_coul_streitz.cpp @@ -219,12 +219,6 @@ void PairCoulStreitz::init_style() error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; } - - // ptr to QEQ fix - //for (i = 0; i < modify->nfix; i++) - // if (strcmp(modify->fix[i]->style,"qeq") == 0) break; - //if (i < modify->nfix) fixqeq = (FixQEQ *) modify->fix[i]; - //else fixqeq = NULL; } /* ---------------------------------------------------------------------- diff --git a/src/velocity.cpp b/src/velocity.cpp index 32b08708cf..95d820cc22 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -112,7 +112,7 @@ void Velocity::command(int narg, char **arg) int initcomm = 0; if (style == ZERO && rfix >= 0 && - strcmp(modify->fix[rfix]->style,"rigid/small") == 0) initcomm = 1; + utils::strmatch(modify->fix[rfix]->style,"^rigid/small")) initcomm = 1; if ((style == CREATE || style == SET) && temperature && strcmp(temperature->style,"temp/cs") == 0) initcomm = 1;