From 549ffda4d850c067bf1f6bfdd63e8d358180b1bb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 29 May 2020 20:38:59 -0400 Subject: [PATCH] implement better pair style name detection in pair style hybrid arguments --- src/pair_hybrid.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index bbaa311819..6e2cbf75d7 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -313,7 +313,7 @@ void PairHybrid::settings(int narg, char **arg) iarg = 0; nstyles = 0; while (iarg < narg) { - if (strncmp(arg[iarg],"hybrid",6) == 0) + if (utils::strmatch(arg[iarg],"^hybrid")) error->all(FLERR,"Pair style hybrid cannot have hybrid as an argument"); if (strcmp(arg[iarg],"none") == 0) error->all(FLERR,"Pair style hybrid cannot have none as an argument"); @@ -323,8 +323,14 @@ void PairHybrid::settings(int narg, char **arg) special_lj[nstyles] = special_coul[nstyles] = NULL; compute_tally[nstyles] = 1; + // determine list of arguments for pair style settings + // by looking for the next known pair style name. + jarg = iarg + 1; - while (jarg < narg && !force->pair_map->count(arg[jarg])) jarg++; + while ((jarg < narg) + && !force->pair_map->count(arg[jarg]) + && !lmp->match_style("pair",arg[jarg])) jarg++; + styles[nstyles]->settings(jarg-iarg-1,&arg[iarg+1]); iarg = jarg; nstyles++;