qmcpack
qmcpack copied to clipboard
InputSection Enum parse exception probably needs modification/documentation
Describe the bug Probably less of a code bug but an unexpected behavior based on the available documentation. See this line: https://github.com/QMCPACK/qmcpack/blob/4a7faf845a61ed30fadc9ad4b0afd501731eb249/src/Estimators/tests/test_OneBodyDensityMatricesInput.cpp#L48
For the invalid XML examples, there are cases where the specified enum (integrator choice, for example) is not part of the predefined list of options. This throws an exception by design. In the above line, this throws an exception of type UniformCommunicateError, and so passes the CHECK_THROW_AS check for the invalid XML cases. On trying to replicate this for another class with bad input file enum choice, an exception is correctly raised, but the exception type is given by the following line from InputSection.
https://github.com/QMCPACK/qmcpack/blob/4a7faf845a61ed30fadc9ad4b0afd501731eb249/src/Estimators/InputSection.cpp#L221
There are two things that I'd like to see:
1.) Decision on whether InputSection should always throw a UniformCommunicateError or not.
2.) Update CHECK_THROW_AS to reflect this, or change them to CHECK_THROW.
2.) Explanation/documentation for why OneBodyDensityMatricesInput is throwing a UniformCommunicateError instead of std::logic_error.
Expected behavior I expect std::logic_error to be thrown if input option choice is not in the enum list. Instead, UniformCommunicateError is thrown.
System:
- Intel Xeon, RHEL7