From 783fa298aa4971269c0d6e877ac82a4c278e0940 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 28 Jul 2015 21:27:28 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13762 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/pair_hybrid.cpp | 58 +++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index dce3d21978..02740d194c 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -460,6 +460,7 @@ void PairHybrid::init_style() } // check if special_lj/special_coul overrides are compatible + for (istyle = 0; istyle < nstyles; istyle++) { if (special_lj[istyle]) { for (i = 1; i < 4; ++i) { @@ -795,10 +796,7 @@ void PairHybrid::modify_params(int narg, char **arg) { if (narg == 0) error->all(FLERR,"Illegal pair_modify command"); - // if 1st keyword is pair, then apply args to one sub-style - // else pass args to every sub-style - // also apply all args (except pair) to pair hybrid itself - // important for some keywords like tail or compute + // if 1st keyword is pair, apply other keywords to one sub-style if (strcmp(arg[0],"pair") == 0) { if (narg < 2) error->all(FLERR,"Illegal pair_modify command"); @@ -806,41 +804,39 @@ void PairHybrid::modify_params(int narg, char **arg) for (m = 0; m < nstyles; m++) if (strcmp(arg[1],keywords[m]) == 0) break; if (m == nstyles) error->all(FLERR,"Unknown pair_modify hybrid sub-style"); - if (multiple[m] == 0) { - // augment special settings for this one pair style - if (strcmp(arg[2],"special") == 0) { - if (narg < 7) error->all(FLERR,"Illegal pair_modify special command"); - modify_special(m,narg-3,&arg[3]); - } else { - Pair::modify_params(narg-2,&arg[2]); - styles[m]->modify_params(narg-2,&arg[2]); - } - } else { + int iarg = 2; + + if (multiple[m]) { if (narg < 3) error->all(FLERR,"Illegal pair_modify command"); int multiflag = force->inumeric(FLERR,arg[2]); for (m = 0; m < nstyles; m++) if (strcmp(arg[1],keywords[m]) == 0 && multiflag == multiple[m]) break; if (m == nstyles) error->all(FLERR,"Unknown pair_modify hybrid sub-style"); - // augment special settings for this one pair style - if (strcmp(arg[3],"special") == 0) { - if (narg < 8) error->all(FLERR,"Illegal pair_modify special command"); - modify_special(m,narg-4,&arg[4]); - } else { - Pair::modify_params(narg-3,&arg[3]); - styles[m]->modify_params(narg-3,&arg[3]); - } + iarg = 3; } - + + // if 2nd keyword (after pair) is special: + // invoke modify_special() for the sub-style + + if (iarg < narg && strcmp(arg[iarg],"special") == 0) { + if (iarg+4 < narg) + error->all(FLERR,"Illegal pair_modify special command"); + modify_special(m,narg-iarg,&arg[iarg]); + iarg += 4; + } + + // apply all keywords (except pair and special) to pair hybrid itself + // important for some keywords like tail or compute + + Pair::modify_params(narg-iarg,&arg[iarg]); + styles[m]->modify_params(narg-iarg,&arg[iarg]); + + // apply all keywords to pair hybrid itself and every sub-style + } else { - // augment special settings for all pair styles - if (strcmp(arg[0],"special") == 0) { - if (narg < 5) error->all(FLERR,"Illegal pair_modify special command"); - for (int m = 0; m < nstyles; m++) modify_special(m,narg-1,&arg[1]); - } else { - Pair::modify_params(narg,arg); - for (int m = 0; m < nstyles; m++) styles[m]->modify_params(narg,arg); - } + Pair::modify_params(narg,arg); + for (int m = 0; m < nstyles; m++) styles[m]->modify_params(narg,arg); } }