route renamed reset sub-commands through Deprecated class to print warning

This commit is contained in:
Axel Kohlmeyer
2022-11-17 23:11:41 -05:00
parent 7e9d66bbfb
commit e8471790bc
6 changed files with 23 additions and 9 deletions

View File

@ -34,14 +34,25 @@ void Deprecated::command(int narg, char **arg)
return;
} else if (cmd == "reset_ids") {
if (lmp->comm->me == 0)
utils::logmesg(lmp, "\n'reset_ids' has been renamed to 'reset_atom_ids'\n\n");
utils::logmesg(lmp, "\n'reset_ids' has been renamed to 'reset atom_ids'\n\n");
} else if (utils::strmatch(cmd, "^kim_")) {
if (lmp->comm->me == 0)
utils::logmesg(lmp,
"\nWARNING: 'kim_<command>' has been renamed to 'kim <command>'. "
"Please update your input.\n\n");
std::string newcmd("kim");
newcmd += " " + cmd.substr(4);
if (lmp->comm->me == 0)
utils::logmesg(lmp, "\nWARNING: '{}' has been renamed to '{}'. Please update your input.\n\n",
cmd, newcmd);
for (int i = 0; i < narg; ++i) {
newcmd.append(1, ' ');
newcmd.append(arg[i]);
}
input->one(newcmd);
return;
} else if (utils::strmatch(cmd, "^reset_")) {
std::string newcmd("reset");
newcmd += " " + cmd.substr(6);
if (lmp->comm->me == 0)
utils::logmesg(lmp, "\nWARNING: '{}' has been renamed to '{}'. Please update your input.\n\n",
cmd, newcmd);
for (int i = 0; i < narg; ++i) {
newcmd.append(1, ' ');
newcmd.append(arg[i]);

View File

@ -20,6 +20,9 @@ CommandStyle(kim_interactions,Deprecated);
CommandStyle(kim_param,Deprecated);
CommandStyle(kim_property,Deprecated);
CommandStyle(kim_query,Deprecated);
CommandStyle(reset_atom_ids,Deprecated);
CommandStyle(reset_image_flags,Deprecated);
CommandStyle(reset_mol_ids,Deprecated);
CommandStyle(message,Deprecated);
CommandStyle(server,Deprecated);
// clang-format on

View File

@ -2003,7 +2003,7 @@ void Input::units()
int Input::meta(const std::string &prefix)
{
auto mycmd = fmt::format("{}_{}", prefix, arg[0]);
auto mycmd = fmt::format("{}_{}", utils::uppercase(prefix), utils::uppercase(arg[0]));
if (command_map->find(mycmd) != command_map->end()) {
CommandCreator &command_creator = (*command_map)[mycmd];
Command *cmd = command_creator(lmp);

View File

@ -13,7 +13,7 @@
#ifdef COMMAND_CLASS
// clang-format off
CommandStyle(reset_atom_ids,ResetIDs);
CommandStyle(RESET_ATOM_IDS,ResetIDs);
// clang-format on
#else

View File

@ -13,7 +13,7 @@
#ifdef COMMAND_CLASS
// clang-format off
CommandStyle(reset_image_flags,ResetImageFlags);
CommandStyle(RESET_IMAGE_FLAGS,ResetImageFlags);
// clang-format on
#else

View File

@ -13,7 +13,7 @@
#ifdef COMMAND_CLASS
// clang-format off
CommandStyle(reset_mol_ids,ResetMolIDs);
CommandStyle(RESET_MOL_IDS,ResetMolIDs);
// clang-format on
#else