simplify API of Force::store_style()
This commit is contained in:
@ -240,7 +240,7 @@ void AngleHybrid::settings(int narg, char **arg)
|
||||
error->all(FLERR, "Angle style hybrid cannot have none as an argument");
|
||||
|
||||
styles[nstyles] = force->new_angle(arg[i], 1, dummy);
|
||||
force->store_style(keywords[nstyles], arg[i], 0);
|
||||
keywords[nstyles] = force->store_style(arg[i], 0);
|
||||
|
||||
istyle = i;
|
||||
if (strcmp(arg[i], "table") == 0) i++;
|
||||
|
||||
@ -242,7 +242,7 @@ void BondHybrid::settings(int narg, char **arg)
|
||||
if (strncmp(arg[i], "quartic", 7) == 0) has_quartic = m;
|
||||
|
||||
styles[nstyles] = force->new_bond(arg[i], 1, dummy);
|
||||
force->store_style(keywords[nstyles], arg[i], 0);
|
||||
keywords[nstyles] = force->store_style(arg[i], 0);
|
||||
|
||||
istyle = i;
|
||||
if (strcmp(arg[i], "table") == 0) i++;
|
||||
|
||||
@ -241,7 +241,7 @@ void DihedralHybrid::settings(int narg, char **arg)
|
||||
error->all(FLERR, "Dihedral style hybrid cannot have none as an argument");
|
||||
|
||||
styles[nstyles] = force->new_dihedral(arg[i], 1, dummy);
|
||||
force->store_style(keywords[nstyles], arg[i], 0);
|
||||
keywords[nstyles] = force->store_style(arg[i], 0);
|
||||
|
||||
istyle = i;
|
||||
if (strcmp(arg[i], "table") == 0) i++;
|
||||
|
||||
@ -229,7 +229,7 @@ void Force::create_pair(const std::string &style, int trysuffix)
|
||||
|
||||
int sflag;
|
||||
pair = new_pair(style,trysuffix,sflag);
|
||||
store_style(pair_style,style,sflag);
|
||||
pair_style = store_style(style,sflag);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -350,7 +350,7 @@ void Force::create_bond(const std::string &style, int trysuffix)
|
||||
|
||||
int sflag;
|
||||
bond = new_bond(style,trysuffix,sflag);
|
||||
store_style(bond_style,style,sflag);
|
||||
bond_style = store_style(style,sflag);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -427,7 +427,7 @@ void Force::create_angle(const std::string &style, int trysuffix)
|
||||
|
||||
int sflag;
|
||||
angle = new_angle(style,trysuffix,sflag);
|
||||
store_style(angle_style,style,sflag);
|
||||
angle_style = store_style(style,sflag);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -504,7 +504,7 @@ void Force::create_dihedral(const std::string &style, int trysuffix)
|
||||
|
||||
int sflag;
|
||||
dihedral = new_dihedral(style,trysuffix,sflag);
|
||||
store_style(dihedral_style,style,sflag);
|
||||
dihedral_style = store_style(style,sflag);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -581,7 +581,7 @@ void Force::create_improper(const std::string &style, int trysuffix)
|
||||
|
||||
int sflag;
|
||||
improper = new_improper(style,trysuffix,sflag);
|
||||
store_style(improper_style,style,sflag);
|
||||
improper_style = store_style(style,sflag);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -658,7 +658,7 @@ void Force::create_kspace(const std::string &style, int trysuffix)
|
||||
|
||||
int sflag;
|
||||
kspace = new_kspace(style,trysuffix,sflag);
|
||||
store_style(kspace_style,style,sflag);
|
||||
kspace_style = store_style(style,sflag);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -729,14 +729,14 @@ KSpace *Force::kspace_match(const std::string &word, int exact)
|
||||
if sflag = 1/2/3, append suffix or suffix2 or suffixp to style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Force::store_style(char *&str, const std::string &style, int sflag)
|
||||
char *Force::store_style(const std::string &style, int sflag)
|
||||
{
|
||||
std::string estyle = style;
|
||||
|
||||
if (sflag == 1) estyle += std::string("/") + lmp->suffix;
|
||||
else if (sflag == 2) estyle += std::string("/") + lmp->suffix2;
|
||||
else if (sflag == 3) estyle += std::string("/") + lmp->suffixp;
|
||||
str = utils::strdup(estyle);
|
||||
return utils::strdup(estyle);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -146,7 +146,7 @@ class Force : protected Pointers {
|
||||
KSpace *new_kspace(const std::string &, int, int &);
|
||||
KSpace *kspace_match(const std::string &, int);
|
||||
|
||||
void store_style(char *&, const std::string &, int);
|
||||
char *store_style(const std::string &, int);
|
||||
void set_special(int, char **);
|
||||
|
||||
double memory_usage();
|
||||
|
||||
@ -241,7 +241,7 @@ void ImproperHybrid::settings(int narg, char **arg)
|
||||
error->all(FLERR, "Improper style hybrid cannot have none as an argument");
|
||||
|
||||
styles[nstyles] = force->new_improper(arg[i], 1, dummy);
|
||||
force->store_style(keywords[nstyles], arg[i], 0);
|
||||
keywords[nstyles] = force->store_style(arg[i], 0);
|
||||
|
||||
istyle = i;
|
||||
if (strcmp(arg[i], "table") == 0) i++;
|
||||
|
||||
@ -322,7 +322,7 @@ void PairHybrid::settings(int narg, char **arg)
|
||||
error->all(FLERR,"Pair style hybrid cannot have none as an argument");
|
||||
|
||||
styles[nstyles] = force->new_pair(arg[iarg],1,dummy);
|
||||
force->store_style(keywords[nstyles],arg[iarg],0);
|
||||
keywords[nstyles] = force->store_style(arg[iarg],0);
|
||||
special_lj[nstyles] = special_coul[nstyles] = nullptr;
|
||||
compute_tally[nstyles] = 1;
|
||||
|
||||
|
||||
@ -328,7 +328,7 @@ void PairHybridScaled::settings(int narg, char **arg)
|
||||
error->all(FLERR, "Pair style hybrid/scaled cannot have none as an argument");
|
||||
|
||||
styles[nstyles] = force->new_pair(arg[iarg], 1, dummy);
|
||||
force->store_style(keywords[nstyles], arg[iarg], 0);
|
||||
keywords[nstyles] = force->store_style(arg[iarg], 0);
|
||||
special_lj[nstyles] = special_coul[nstyles] = nullptr;
|
||||
compute_tally[nstyles] = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user