diff --git a/src/force.cpp b/src/force.cpp index 91fccd7197..2bfd809451 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -665,14 +665,14 @@ Improper *Force::improper_match(const char *style) new kspace style ------------------------------------------------------------------------- */ -void Force::create_kspace(int narg, char **arg, int trysuffix) +void Force::create_kspace(const char *style, int trysuffix) { delete [] kspace_style; if (kspace) delete kspace; int sflag; - kspace = new_kspace(narg,arg,trysuffix,sflag); - store_style(kspace_style,arg[0],sflag); + kspace = new_kspace(style,trysuffix,sflag); + store_style(kspace_style,style,sflag); if (comm->style == 1 && !kspace_match("ewald",0)) error->all(FLERR, @@ -683,39 +683,39 @@ void Force::create_kspace(int narg, char **arg, int trysuffix) generate a kspace class ------------------------------------------------------------------------- */ -KSpace *Force::new_kspace(int narg, char **arg, int trysuffix, int &sflag) +KSpace *Force::new_kspace(const char *style, int trysuffix, int &sflag) { if (trysuffix && lmp->suffix_enable) { if (lmp->suffix) { sflag = 1; char estyle[256]; - sprintf(estyle,"%s/%s",arg[0],lmp->suffix); + sprintf(estyle,"%s/%s",style,lmp->suffix); if (kspace_map->find(estyle) != kspace_map->end()) { KSpaceCreator kspace_creator = (*kspace_map)[estyle]; - return kspace_creator(lmp, narg-1, &arg[1]); + return kspace_creator(lmp); } } if (lmp->suffix2) { sflag = 1; char estyle[256]; - sprintf(estyle,"%s/%s",arg[0],lmp->suffix2); + sprintf(estyle,"%s/%s",style,lmp->suffix2); if (kspace_map->find(estyle) != kspace_map->end()) { KSpaceCreator kspace_creator = (*kspace_map)[estyle]; - return kspace_creator(lmp, narg-1, &arg[1]); + return kspace_creator(lmp); } } } sflag = 0; - if (strcmp(arg[0],"none") == 0) return NULL; - if (kspace_map->find(arg[0]) != kspace_map->end()) { - KSpaceCreator kspace_creator = (*kspace_map)[arg[0]]; - return kspace_creator(lmp, narg-1, &arg[1]); + if (strcmp(style,"none") == 0) return NULL; + if (kspace_map->find(style) != kspace_map->end()) { + KSpaceCreator kspace_creator = (*kspace_map)[style]; + return kspace_creator(lmp); } char str[128]; - sprintf(str,"Unknown kspace style %s",arg[0]); + sprintf(str,"Unknown kspace style %s",style); error->all(FLERR,str); return NULL; @@ -726,9 +726,9 @@ KSpace *Force::new_kspace(int narg, char **arg, int trysuffix, int &sflag) ------------------------------------------------------------------------- */ template -KSpace *Force::kspace_creator(LAMMPS *lmp, int narg, char ** arg) +KSpace *Force::kspace_creator(LAMMPS *lmp) { - return new T(lmp, narg, arg); + return new T(lmp); } /* ---------------------------------------------------------------------- diff --git a/src/force.h b/src/force.h index ce593fa518..e4bb0f990e 100644 --- a/src/force.h +++ b/src/force.h @@ -72,7 +72,7 @@ class Force : protected Pointers { typedef Angle *(*AngleCreator)(LAMMPS *); typedef Dihedral *(*DihedralCreator)(LAMMPS *); typedef Improper *(*ImproperCreator)(LAMMPS *); - typedef KSpace *(*KSpaceCreator)(LAMMPS *,int,char**); + typedef KSpace *(*KSpaceCreator)(LAMMPS *); typedef std::map PairCreatorMap; typedef std::map BondCreatorMap; @@ -123,8 +123,8 @@ class Force : protected Pointers { class Improper *new_improper(const char *, int, int &); class Improper *improper_match(const char *); - void create_kspace(int, char **, int); - class KSpace *new_kspace(int, char **, int, int &); + void create_kspace(const char *, int); + class KSpace *new_kspace(const char *, int, int &); class KSpace *kspace_match(const char *, int); void store_style(char *&, const char *, int); @@ -148,7 +148,7 @@ class Force : protected Pointers { template static Angle *angle_creator(LAMMPS *); template static Dihedral *dihedral_creator(LAMMPS *); template static Improper *improper_creator(LAMMPS *); - template static KSpace *kspace_creator(LAMMPS *, int, char **); + template static KSpace *kspace_creator(LAMMPS *); }; } diff --git a/src/input.cpp b/src/input.cpp index 2834e36913..f9dd1ec314 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1633,7 +1633,8 @@ void Input::kspace_modify() void Input::kspace_style() { - force->create_kspace(narg,arg,1); + force->create_kspace(arg[0],1); + if (force->kspace) force->kspace->settings(narg-1,&arg[1]); } /* ---------------------------------------------------------------------- */ diff --git a/src/kspace.cpp b/src/kspace.cpp index b92cd1e9dc..25491cd964 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -KSpace::KSpace(LAMMPS *lmp, int /*narg*/, char **/*arg*/) : Pointers(lmp) +KSpace::KSpace(LAMMPS *lmp) : Pointers(lmp) { order_allocated = 0; energy = 0.0; diff --git a/src/kspace.h b/src/kspace.h index c25dc93f45..3917a0a72f 100644 --- a/src/kspace.h +++ b/src/kspace.h @@ -92,7 +92,7 @@ class KSpace : protected Pointers { double splittol; // tolerance for when to truncate splitting - KSpace(class LAMMPS *, int, char **); + KSpace(class LAMMPS *); virtual ~KSpace(); void triclinic_check(); void modify_params(int, char **); @@ -112,6 +112,7 @@ class KSpace : protected Pointers { // general child-class methods + virtual void settings(int, char **) {}; virtual void init() = 0; virtual void setup() = 0; virtual void setup_grid() {};