From 84495f6ae09c9d1b8fc864cc377147bbc07ffc4d Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 16 Apr 2010 14:28:37 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@4010 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/USER-EWALDN/pair_buck_coul.cpp | 7 ++++--- src/USER-EWALDN/pair_lj_coul.cpp | 7 ++++--- src/pair_hybrid.cpp | 7 ++++++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/USER-EWALDN/pair_buck_coul.cpp b/src/USER-EWALDN/pair_buck_coul.cpp index 577ac2da7c..08f24f6cef 100644 --- a/src/USER-EWALDN/pair_buck_coul.cpp +++ b/src/USER-EWALDN/pair_buck_coul.cpp @@ -64,7 +64,6 @@ PairBuckCoul::PairBuckCoul(LAMMPS *lmp) : Pair(lmp) #define PAIR_MISSING "Cut-offs missing in pair_style buck/coul" #define PAIR_LJ_OFF "LJ6 off not supported in pair_style buck/coul" #define PAIR_COUL_CUT "Coulombic cut not supported in pair_style buck/coul" -#define PAIR_MANY "Too many pair_style buck/coul commands" #define PAIR_LARGEST "Using largest cut-off for buck/coul long long" #define PAIR_MIX "Geometric mixing assumed for 1/r^6 coefficients" @@ -86,6 +85,8 @@ void PairBuckCoul::options(char **arg, int order) void PairBuckCoul::settings(int narg, char **arg) { + if (narg != 3 && narg != 4) error->all("Illegal pair_style command"); + ewald_order = 0; ewald_off = 0; options(arg, 6); @@ -97,8 +98,8 @@ void PairBuckCoul::settings(int narg, char **arg) if (!((ewald_order^ewald_off)&(1<<1))) error->all(PAIR_COUL_CUT); cut_buck_global = force->numeric(*(arg++)); if (*arg&&(ewald_order&0x42==0x42)) error->all(PAIR_CUTOFF); - cut_coul = *arg ? force->numeric(*(arg++)) : cut_buck_global; - if (*arg) error->all(PAIR_MANY); + if (narg == 4) cut_coul = force->numeric(*arg); + else cut_coul = cut_buck_global; if (allocated) { // reset explicit cuts int i,j; diff --git a/src/USER-EWALDN/pair_lj_coul.cpp b/src/USER-EWALDN/pair_lj_coul.cpp index e9350f63f0..83956756d5 100644 --- a/src/USER-EWALDN/pair_lj_coul.cpp +++ b/src/USER-EWALDN/pair_lj_coul.cpp @@ -63,7 +63,6 @@ PairLJCoul::PairLJCoul(LAMMPS *lmp) : Pair(lmp) #define PAIR_CUTOFF "Only one cut-off allowed when requesting all long" #define PAIR_MISSING "Cut-offs missing in pair_style lj/coul" #define PAIR_COUL_CUT "Coulombic cut not supported in pair_style lj/coul" -#define PAIR_MANY "Too many pair_style lj/coul commands" #define PAIR_LARGEST "Using largest cut-off for lj/coul long long" #define PAIR_MIX "Mixing forced for lj coefficients" @@ -85,6 +84,8 @@ void PairLJCoul::options(char **arg, int order) void PairLJCoul::settings(int narg, char **arg) { + if (narg != 3 && narg != 4) error->all("Illegal pair_style command"); + ewald_off = 0; ewald_order = 0; options(arg, 6); @@ -95,8 +96,8 @@ void PairLJCoul::settings(int narg, char **arg) if (!((ewald_order^ewald_off)&(1<<1))) error->all(PAIR_COUL_CUT); cut_lj_global = force->numeric(*(arg++)); if (*arg&&(ewald_order&0x42==0x42)) error->all(PAIR_CUTOFF); - cut_coul = *arg ? force->numeric(*(arg++)) : cut_lj_global; - if (*arg) error->all(PAIR_MANY); + if (narg == 4) cut_coul = force->numeric(*arg); + else cut_coul = cut_lj_global; if (allocated) { // reset explicit cuts int i,j; diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index f2a48a2986..b71af67dad 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -194,7 +194,8 @@ void PairHybrid::settings(int narg, char **arg) // count sub-styles by skipping numeric args // one exception is 1st arg of style "table", which is non-numeric word // one exception is 1st two args of style "lj/coul", which are non-numeric - // one exception is 1st two args of style "lj/coul", which are non-numeric + // one exception is 1st two args of style "buck/coul", which are non-numeric + // one exception is 1st arg of any "gpu" style, which is non-numeric // need a better way to skip these exceptions nstyles = 0; @@ -202,6 +203,8 @@ void PairHybrid::settings(int narg, char **arg) while (i < narg) { if (strcmp(arg[i],"table") == 0) i++; if (strcmp(arg[i],"lj/coul") == 0) i += 2; + if (strcmp(arg[i],"buck/coul") == 0) i += 2; + if (strstr(arg[i],"gpu")) i++; i++; while (i < narg && !isalpha(arg[i][0])) i++; nstyles++; @@ -216,6 +219,7 @@ void PairHybrid::settings(int narg, char **arg) // define subset of args for a sub-style by skipping numeric args // one exception is 1st arg of style "table", which is non-numeric // one exception is 1st two args of style "lj/coul", which are non-numeric + // one exception is 1st two args of style "buck/coul", which are non-numeric // one exception is 1st arg of any "gpu" style, which is non-numeric // need a better way to skip these exceptions @@ -235,6 +239,7 @@ void PairHybrid::settings(int narg, char **arg) istyle = i; if (strcmp(arg[i],"table") == 0) i++; if (strcmp(arg[i],"lj/coul") == 0) i += 2; + if (strcmp(arg[i],"buck/coul") == 0) i += 2; if (strstr(arg[i],"gpu")) i++; i++; while (i < narg && !isalpha(arg[i][0])) i++;