8 #ifndef SWOOSEUTILITIES_CALCULATOROPTIONS_H
9 #define SWOOSEUTILITIES_CALCULATOROPTIONS_H
12 #include <yaml-cpp/yaml.h>
15 namespace SwooseUtilities {
18 constexpr
const char* qmModelKey =
"qm_model";
19 constexpr
const char* qmModuleKey =
"qm_module";
20 constexpr
const char* mmModelKey =
"mm_model";
21 constexpr
const char* defaultMolecularMechanicsModel =
"SFAM";
30 inline std::string getChosenMMCalculatorOption(YAML::Node& yamlNode) {
31 std::string mmModel = defaultMolecularMechanicsModel;
32 if (yamlNode[mmModelKey]) {
33 mmModel = yamlNode[mmModelKey].as<std::string>();
34 yamlNode.remove(mmModelKey);
37 std::transform(mmModel.begin(), mmModel.end(), mmModel.begin(), ::toupper);
46 inline std::pair<std::string, std::string> getChosenQmCalculatorOption(YAML::Node& yamlNode) {
49 if (yamlNode[qmModelKey]) {
50 qmModel = yamlNode[qmModelKey].as<std::string>();
51 yamlNode.remove(qmModelKey);
53 if (yamlNode[qmModuleKey]) {
54 qmModule = yamlNode[qmModuleKey].as<std::string>();
55 yamlNode.remove(qmModuleKey);
57 if (qmModel.empty() || qmModule.empty())
58 throw std::runtime_error(
"For a QM/MM calculation, one needs to specify the QM model and module.");
61 std::transform(qmModel.begin(), qmModel.end(), qmModel.begin(), ::toupper);
64 std::transform(qmModule.begin(), qmModule.end(), qmModule.begin(), ::tolower);
65 qmModule.at(0) = std::toupper(qmModule.at(0));
67 return {qmModel, qmModule};
73 #endif // SWOOSEUTILITIES_OPTIONNAMES_H