split kspace style constructor into plain constructor and settings() method

This commit is contained in:
Axel Kohlmeyer
2018-10-18 16:30:45 -04:00
parent 4015b36a1a
commit 7deb1df2b6
5 changed files with 24 additions and 22 deletions

View File

@ -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 <typename T>
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);
}
/* ----------------------------------------------------------------------