generalize and simplify support for accelerated commands with suffixes

This commit is contained in:
Axel Kohlmeyer
2021-12-14 09:06:04 -05:00
parent dee995f918
commit 1c38b7633f

View File

@ -782,22 +782,21 @@ int Input::execute_command()
if (flag) return 0; if (flag) return 0;
// invoke commands added via style_command.h // invoke commands added via style_command.h
// try suffixed version first
if (lmp && lmp->suffix_enable && utils::strmatch(command,"^dynamical_matrix")) { std::string mycmd = command;
if (utils::strmatch(lmp->suffix, "^kk")) { if (lmp->suffix_enable) {
std::string cstyle = command + std::string("/") + lmp->suffix; mycmd = command + std::string("/") + lmp->suffix;
if (command_map->find(command) != command_map->end()) { if (command_map->find(mycmd) == command_map->end()) {
CommandCreator &command_creator = (*command_map)[cstyle]; if (lmp->suffix2) {
Command *cmd = command_creator(lmp); mycmd = command + std::string("/") + lmp->suffix2;
cmd->command(narg, arg); if (command_map->find(mycmd) == command_map->end())
delete cmd; mycmd = command;
return 0; } else mycmd = command;
}
} }
} }
if (command_map->find(mycmd) != command_map->end()) {
if (command_map->find(command) != command_map->end()) { CommandCreator &command_creator = (*command_map)[mycmd];
CommandCreator &command_creator = (*command_map)[command];
Command *cmd = command_creator(lmp); Command *cmd = command_creator(lmp);
cmd->command(narg,arg); cmd->command(narg,arg);
delete cmd; delete cmd;