more accurate checking for styles using utils::strmatch() instead of strcmp() or strncmp()

This commit is contained in:
Axel Kohlmeyer
2019-06-07 07:14:57 -04:00
parent b53df3dd63
commit 61e9dc4c8d
7 changed files with 30 additions and 33 deletions

View File

@ -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;