add and use Neighbor::modify_params() convenience function
This commit is contained in:
@ -187,14 +187,7 @@ void FixChargeRegulation::init() {
|
|||||||
// neighbor list exclusion setup
|
// neighbor list exclusion setup
|
||||||
// turn off interactions between group all and the exclusion group
|
// turn off interactions between group all and the exclusion group
|
||||||
|
|
||||||
int narg = 4;
|
neighbor->modify_params(fmt::format("exclude group {} all",group_id));
|
||||||
char **arg = new char*[narg];;
|
|
||||||
arg[0] = (char *) "exclude";
|
|
||||||
arg[1] = (char *) "group";
|
|
||||||
arg[2] = (char *) group_id.c_str();
|
|
||||||
arg[3] = (char *) "all";
|
|
||||||
neighbor->modify_params(narg,arg);
|
|
||||||
delete [] arg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check that no deletable atoms are in atom->firstgroup
|
// check that no deletable atoms are in atom->firstgroup
|
||||||
|
|||||||
@ -580,14 +580,7 @@ void FixGCMC::init()
|
|||||||
// neighbor list exclusion setup
|
// neighbor list exclusion setup
|
||||||
// turn off interactions between group all and the exclusion group
|
// turn off interactions between group all and the exclusion group
|
||||||
|
|
||||||
int narg = 4;
|
neighbor->modify_params(fmt::format("exclude group {} all",group_id);
|
||||||
char **arg = new char*[narg];;
|
|
||||||
arg[0] = (char *) "exclude";
|
|
||||||
arg[1] = (char *) "group";
|
|
||||||
arg[2] = (char *) group_id.c_str();
|
|
||||||
arg[3] = (char *) "all";
|
|
||||||
neighbor->modify_params(narg,arg);
|
|
||||||
delete [] arg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a new group for temporary use with selected molecules
|
// create a new group for temporary use with selected molecules
|
||||||
|
|||||||
@ -342,14 +342,7 @@ void FixWidom::init()
|
|||||||
// neighbor list exclusion setup
|
// neighbor list exclusion setup
|
||||||
// turn off interactions between group all and the exclusion group
|
// turn off interactions between group all and the exclusion group
|
||||||
|
|
||||||
int narg = 4;
|
neighbor->modify_params(fmt::format("exclude group {} all",group_id));
|
||||||
char **arg = new char*[narg];;
|
|
||||||
arg[0] = (char *) "exclude";
|
|
||||||
arg[1] = (char *) "group";
|
|
||||||
arg[2] = (char *) group_id.c_str();
|
|
||||||
arg[3] = (char *) "all";
|
|
||||||
neighbor->modify_params(narg,arg);
|
|
||||||
delete [] arg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a new group for temporary use with selected molecules
|
// create a new group for temporary use with selected molecules
|
||||||
|
|||||||
@ -128,20 +128,10 @@ void FixSRP::init()
|
|||||||
// bond particles do not interact with other types
|
// bond particles do not interact with other types
|
||||||
// type bptype only interacts with itself
|
// type bptype only interacts with itself
|
||||||
|
|
||||||
char* arg1[4];
|
|
||||||
arg1[0] = (char *) "exclude";
|
|
||||||
arg1[1] = (char *) "type";
|
|
||||||
char c0[20];
|
|
||||||
char c1[20];
|
|
||||||
|
|
||||||
for (int z = 1; z < atom->ntypes; z++) {
|
for (int z = 1; z < atom->ntypes; z++) {
|
||||||
if (z == bptype)
|
if (z == bptype)
|
||||||
continue;
|
continue;
|
||||||
sprintf(c0, "%d", z);
|
neighbor->modify_params(fmt::format("exclude type {} {}",z,bptype));
|
||||||
arg1[2] = c0;
|
|
||||||
sprintf(c1, "%d", bptype);
|
|
||||||
arg1[3] = c1;
|
|
||||||
neighbor->modify_params(4, arg1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2356,6 +2356,22 @@ void Neighbor::modify_params(int narg, char **arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
convenience function to allow modifying parameters from a single string
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void Neighbor::modify_params(const std::string &modcmd)
|
||||||
|
{
|
||||||
|
auto args = utils::split_words(modcmd);
|
||||||
|
char **newarg = new char*[args.size()];
|
||||||
|
int i=0;
|
||||||
|
for (const auto &arg : args) {
|
||||||
|
newarg[i++] = (char *)arg.c_str();
|
||||||
|
}
|
||||||
|
modify_params(args.size(),newarg);
|
||||||
|
delete[] newarg;
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
remove the first group-group exclusion matching group1, group2
|
remove the first group-group exclusion matching group1, group2
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -118,6 +118,7 @@ class Neighbor : protected Pointers {
|
|||||||
void set(int, char **); // set neighbor style and skin distance
|
void set(int, char **); // set neighbor style and skin distance
|
||||||
void reset_timestep(bigint); // reset of timestep counter
|
void reset_timestep(bigint); // reset of timestep counter
|
||||||
void modify_params(int, char**); // modify params that control builds
|
void modify_params(int, char**); // modify params that control builds
|
||||||
|
void modify_params(const std::string &); // convenience overload
|
||||||
|
|
||||||
void exclusion_group_group_delete(int, int); // rm a group-group exclusion
|
void exclusion_group_group_delete(int, int); // rm a group-group exclusion
|
||||||
int exclude_setting(); // return exclude value to accelerator pkg
|
int exclude_setting(); // return exclude value to accelerator pkg
|
||||||
|
|||||||
Reference in New Issue
Block a user