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;