diff --git a/apps/PQ.cpp b/apps/PQ.cpp index d064e73a8..ef377aae9 100644 --- a/apps/PQ.cpp +++ b/apps/PQ.cpp @@ -26,10 +26,10 @@ #include // for string, char_traits #include // for vector +#include "baseException.hpp" #include "capabilities.hpp" // for writeCapabilities #include "commandLineArgs.hpp" // for CommandLineArgs #include "driver.hpp" -#include "exceptions.hpp" // for CustomException #include "systemInfo.hpp" // for _VERSION_ #include "validation.hpp" // for validation @@ -80,7 +80,7 @@ int main(int argc, char *argv[]) { commandLineArgs.parse(); } - catch (const customException::CustomException &e) + catch (const exc::PQException &e) { std::cerr << "Error: " << e.getMessage() << '\n' << std::flush; return EXIT_FAILURE; @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) { driver::Driver().run(commandLineArgs.getInputFileName()); } - catch (const customException::CustomException &e) + catch (const exc::PQException &e) { std::cerr << "Error: " << e.getMessage() << '\n' << std::flush; exitCode = EXIT_FAILURE; diff --git a/apps/validation.cpp b/apps/validation.cpp index c90b479da..1b7b4d3b9 100644 --- a/apps/validation.cpp +++ b/apps/validation.cpp @@ -95,7 +95,7 @@ namespace { if (!std::filesystem::is_regular_file(fileName)) { - throw customException::InputFileException( + throw exc::InputFileException( std::format( "{} \"{}\" does not exist or is not a regular file", description, @@ -112,7 +112,7 @@ namespace { if (!std::filesystem::is_directory(directoryName)) { - throw customException::InputFileException( + throw exc::InputFileException( std::format( "{} \"{}\" does not exist or is not a directory", description, @@ -177,7 +177,7 @@ namespace if (script.empty() && fullPathScript.empty()) { - throw customException::InputFileException( + throw exc::InputFileException( "No qm_script provided. Please provide a qm_script in the " "input file." ); @@ -185,7 +185,7 @@ namespace if (!script.empty() && !fullPathScript.empty()) { - throw customException::InputFileException( + throw exc::InputFileException( "\"qm_script\" and \"qm_script_full_path\" are mutually " "exclusive" ); @@ -194,7 +194,7 @@ namespace if (!script.empty() && !cli::isExternalQMScript(QMSettings::getQMMethod(), script)) { - throw customException::InputFileException( + throw exc::InputFileException( std::format( "Bundled QM script \"{}\" is not available for {}", script, @@ -225,7 +225,7 @@ namespace if (isStaticBuild && fullPathScript.empty()) { - throw customException::InputFileException( + throw exc::InputFileException( "This PQ build requires \"qm_script_full_path\" for " "external QM programs" ); @@ -263,20 +263,20 @@ namespace if (engine.isConstraintsActivated() || ForceFieldSettings::isActive()) { if (!FileSettings::isTopologyFileNameSet()) - throw customException::InputFileException( + throw exc::InputFileException( "Topology file needed for requested simulation setup" ); } if (ForceFieldSettings::isActive() && !FileSettings::isParameterFileNameSet()) - throw customException::InputFileException( + throw exc::InputFileException( "Parameter file needed for requested simulation setup" ); if (engine.getConstraints()->isMShakeActive() && FileSettings::getMShakeFileName().empty()) - throw customException::InputFileException( + throw exc::InputFileException( "M-SHAKE file needed for requested simulation setup" ); @@ -387,7 +387,7 @@ namespace method == settings::QMMethod::FENNOL || method == settings::QMMethod::MACE) { - throw customException::InputFileException( + throw exc::InputFileException( std::format( "QM method {} requires ASE support, but this PQ build " "does not include it", @@ -507,7 +507,7 @@ cli::ValidationResult cli::validateInputFile( appendWarnings(reader, result); return result; } - catch (const customException::CustomException &exception) + catch (const exc::PQException &exception) { return invalidResult( inputFile, diff --git a/changes/developer/enhancement.exceptions.md b/changes/developer/enhancement.exceptions.md new file mode 100644 index 000000000..24d6318f4 --- /dev/null +++ b/changes/developer/enhancement.exceptions.md @@ -0,0 +1 @@ +- add new exception handling approach via tempalted NTTP for color and type, which makes handling of new exception types much easier diff --git a/changes/user/bugfix.throw-when-qm-runner-fails.md b/changes/user/bugfix.throw-when-qm-runner-fails.md index b04ca7c80..bd50da64d 100644 --- a/changes/user/bugfix.throw-when-qm-runner-fails.md +++ b/changes/user/bugfix.throw-when-qm-runner-fails.md @@ -1 +1 @@ -- Throw a customException::QMRunnerException when an external QM runner does not finish successfully +- Throw a exc::QMRunnerException when an external QM runner does not finish successfully diff --git a/include/exceptions/baseException.hpp b/include/exceptions/baseException.hpp new file mode 100644 index 000000000..4f5c92428 --- /dev/null +++ b/include/exceptions/baseException.hpp @@ -0,0 +1,104 @@ +/***************************************************************************** + + + PQ + Copyright (C) 2023-now Jakob Gamper + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + +******************************************************************************/ + +#ifndef _BASE_EXCEPTION_HPP_ +#define _BASE_EXCEPTION_HPP_ + +#include "color.hpp" +#include "exceptionTypes.hpp" + +namespace exc +{ + /** + * @class PQException + * + * @brief Base class for all custom exceptions in the application + * + * This class serves as a base for all custom exceptions in the application. + * It inherits from std::exception and provides a common interface for + * exception handling. + */ + class PQException : public std::exception + { + private: + std::string _message; + std::optional _lineNumber; + + public: + explicit PQException(const std::string_view message); + explicit PQException( + const std::string_view message, + std::optional lineNumber + ); + + void setLineNumber(const size_t lineNumber) noexcept; + + [[nodiscard]] + const std::string &getMessage() const noexcept; + + [[nodiscard]] + std::optional getLineNumber() const noexcept; + }; + + /** + * @class BaseException + * + * @brief Base class for custom exceptions + * + * This class serves as a base for all custom exceptions in the application. + * It provides common functionality such as message handling, line number + * tracking, and colorful output for exception messages. + * + * @tparam Color The color code for the exception message output + * @tparam Type The type of exception being thrown + */ + template < + Color::Code colorCode = Color::FG_RED, + ExceptionType exceptionType = ExceptionType::Undefined> + class BaseException : public PQException + { + private: + static constexpr Color::Code _color = colorCode; + static constexpr ExceptionType _type = exceptionType; + + public: + explicit BaseException( + const std::string_view message, + std::optional lineNumber + ); + explicit BaseException(const std::string_view message); + + [[nodiscard]] + const char *what() const noexcept override; + + static void colorfulOutput( + const Color::Code color, + const std::string_view message + ); + }; +} // namespace exc + +#ifndef _BASE_EXCEPTION_TPP_ +#include "baseException.tpp" +#endif // _BASE_EXCEPTION_TPP_ + +#endif // _BASE_EXCEPTION_HPP_ diff --git a/include/exceptions/baseException.tpp b/include/exceptions/baseException.tpp new file mode 100644 index 000000000..3004dd5ee --- /dev/null +++ b/include/exceptions/baseException.tpp @@ -0,0 +1,97 @@ +/***************************************************************************** + + + PQ + Copyright (C) 2023-now Jakob Gamper + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + +******************************************************************************/ + +#ifndef _BASE_EXCEPTION_TPP_ +#define _BASE_EXCEPTION_TPP_ + +#include + +#include "baseException.hpp" + +namespace exc +{ + /** + * @brief Construct a new Custom Exception:: Custom Exception object + * + * @param message + */ + template + BaseException::BaseException( + const std::string_view message, + std::optional lineNumber + ) + : PQException(message, lineNumber) + { + } + + /** + * @brief Construct a new Custom Exception:: Custom Exception object + * + * @param message + */ + template + BaseException::BaseException( + const std::string_view message + ) + : PQException(message, std::nullopt) + { + } + + /** + * @brief Prints the exceptionMsg type in color. + * + * @param color + * @param exceptionMsg + */ + template + void BaseException::colorfulOutput( + const Color::Code color, + const std::string_view exceptionMsg + ) + { + const Color::Modifier modifier(color); + const Color::Modifier def(Color::FG_DEFAULT); + + std::cout << modifier << exceptionMsg << def << '\n' << std::flush; + } + + /** + * @brief Construct a new Custom Exception:: Custom Exception object + * + * @return const char* + */ + template + const char *BaseException::what() const noexcept + { + if (exceptionType != ExceptionType::Undefined) + { + colorfulOutput( + colorCode, + ExceptionTypeMeta::toString(exceptionType) + ); + } + + return PQException::getMessage().c_str(); + } +} // namespace exc + +#endif // _BASE_EXCEPTION_TPP_ diff --git a/include/exceptions/exceptionTypes.hpp b/include/exceptions/exceptionTypes.hpp new file mode 100644 index 000000000..271bffacf --- /dev/null +++ b/include/exceptions/exceptionTypes.hpp @@ -0,0 +1,59 @@ +/***************************************************************************** + + + PQ + Copyright (C) 2023-now Jakob Gamper + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + +******************************************************************************/ + +#ifndef _EXCEPTION_TYPES_HPP_ +#define _EXCEPTION_TYPES_HPP_ + +#include +#include + +#define EXCEPTION_TYPES(X) \ + X(Undefined) \ + X(InputFileError) \ + X(RstFileError) \ + X(UserInputError) \ + X(MoldescriptorError) \ + X(UserInputWarning) \ + X(GuffDatError) \ + X(TopologyError) \ + X(ParameterFileError) \ + X(ManostatError) \ + X(IntraNonBondedError) \ + X(ShakeError) \ + X(CellListError) \ + X(RingPolymerRestartFileError) \ + X(QmRunnerError) \ + X(MpiError) \ + X(QmRuntimeExceeded) \ + X(MShakeFileError) \ + X(MShakeError) \ + X(LinearAlgebraError) \ + X(OptimizationError) \ + X(OptimizationWarning) \ + X(CompileTimeError) \ + X(HybridConfiguratorError) \ + X(HybridMDEngineError) \ + X(TimerError) + +MSTD_ENUM(ExceptionType, std::uint8_t, EXCEPTION_TYPES) + +#endif // _EXCEPTION_TYPES_HPP_ diff --git a/include/exceptions/exceptions.hpp b/include/exceptions/exceptions.hpp index 5756c4c66..17ddc7f04 100644 --- a/include/exceptions/exceptions.hpp +++ b/include/exceptions/exceptions.hpp @@ -24,406 +24,86 @@ #define _EXCEPTIONS_HPP_ -#include -#include -#include -#include -#include - +#include "baseException.hpp" #include "color.hpp" -namespace customException +namespace exc { + using InputFileException = + BaseException; + + using RstFileException = + BaseException; + + using UserInputException = + BaseException; + + using MolDescriptorException = + BaseException; + + using UserInputExceptionWarning = + BaseException; + + using GuffDatException = + BaseException; + + using TopologyException = + BaseException; + + using ParameterFileException = + BaseException; + + using ManostatException = + BaseException; + + using IntraNonBondedException = + BaseException; + + using ShakeException = + BaseException; + + using CellListException = + BaseException; + + using RingPolymerRestartFileException = BaseException< + Color::FG_RED, + ExceptionType::RingPolymerRestartFileError>; + + using QMRunnerException = + BaseException; + + using MPIException = BaseException; + + using QMRunTimeExceeded = + BaseException; + + using MShakeFileException = + BaseException; + + using MShakeException = + BaseException; + + using LinearAlgebraException = + BaseException; + + using OptException = + BaseException; + + using OptWarning = + BaseException; + + using CompileTimeException = + BaseException; + + using HybridConfiguratorException = + BaseException; + + using HybridMDEngineException = + BaseException; + + using TimerException = + BaseException; - /** - * @enum ExceptionType - * - */ - enum class ExceptionType : size_t - { - INPUTFILEEXCEPTION, - RSTFILEEXCEPTION, - USERINPUTEXCEPTION, - MOLDESCRIPTOREXCEPTION, - USERINPUTEXCEPTIONWARNING, - GUFFDATEXCEPTION, - TOPOLOGYEXCEPTION, - PARAMETERFILEEXCEPTION, - MANOSTATEXCEPTION, - INTRANONBONDEDEXCEPTION, - SHAKEEXCEPTION, - CELLLISTEXCEPTION, - RINGPOLYMERRESTARTFILEEXCEPTION, - QMRUNNEREXCEPTION, - MPIEXCEPTION, - QMRUNTIMEEXCEEDED, - MSHAKEFILEEXCEPTION, - MSHAKEEXCEPTION, - LINEARALGEBRAEXCEPTION, - OPTEXCEPTION, - OPTWARNING, - COMPILETIMEEXCEPTION, - HYBRIDCONFIGURATOREXCEPTION - }; - - /** - * @class CustomException - * - * @brief Custom exception base class - * - */ - class CustomException : public std::exception - { - protected: - std::string _message; - std::optional _lineNumber; - - public: - explicit CustomException( - const std::string_view message, - std::optional lineNumber - ); - explicit CustomException(const std::string_view message); - - void colorfulOutput(const Color::Code, const std::string_view) const; - void setLineNumber(const size_t lineNumber) noexcept; - [[nodiscard]] const std::string &getMessage() const noexcept; - [[nodiscard]] std::optional getLineNumber() const noexcept; - }; - - /** - * @class InputFileException inherits from CustomException - * - * @brief Exception for input file errors - * - */ - class InputFileException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class RstFileException inherits from CustomException - * - * @brief Exception for restart file errors - * - */ - class RstFileException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class UserInputException inherits from CustomException - * - * @brief Exception for user input errors (CLI) - * - */ - class UserInputException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class MolDescriptorException inherits from CustomException - * - * @brief Exception for MolDescriptor errors - * - */ - class MolDescriptorException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class UserInputExceptionWarning inherits from CustomException - * - * @brief Exception for user input warnings - * - */ - class UserInputExceptionWarning : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class GuffDatException inherits from CustomException - * - * @brief Exception for guff.dat errors - * - */ - class GuffDatException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class TopologyException inherits from CustomException - * - * @brief Exception for topology file errors - */ - class TopologyException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class ParameterFileException inherits from CustomException - * - * @brief Exception for parameter file errors - */ - class ParameterFileException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class ManostatException inherits from CustomException - * - * @brief Exception for manostat errors - */ - class ManostatException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class IntraNonBondedException inherits from CustomException - * - * @brief Exception for intra non bonded errors - */ - class IntraNonBondedException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class ShakeException inherits from CustomException - * - * @brief Exception for SHAKE errors - */ - class ShakeException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class CellListException inherits from CustomException - * - * @brief Exception for CellList errors - */ - class CellListException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class RingPolymerRestartFileException inherits from CustomException - * - * @brief Exception for ring polymer restart file errors - */ - class RingPolymerRestartFileException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class QMRunnerException inherits from CustomException - * - * @brief Exception for QMRunner errors - */ - class QMRunnerException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class MPIException inherits from CustomException - * - * @brief Exception for MPI errors - * - */ - class MPIException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class QMRunTimeExceeded inherits from CustomException - * - * @brief Exception for QM runtime exceeded - * - */ - class QMRunTimeExceeded : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class MShakeFileException inherits from CustomException - * - * @brief Exception for mShake errors - */ - class MShakeFileException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class MShakeException inherits from CustomException - * - * @brief Exception for MShake errors - */ - class MShakeException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class LinearAlgebraException inherits from CustomException - * - * @brief Exception for linear algebra errors - */ - class LinearAlgebraException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class OptException inherits from CustomException - * - * @brief Exception for optimization errors - */ - class OptException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class OptWarning inherits from CustomException - * - * @brief Exception for optimization errors - */ - class OptWarning : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class CompileTimeException inherits from CustomException - * - * @brief Exception for compile time errors - */ - class CompileTimeException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class HybridConfiguratorException inherits from CustomException - * - * @brief Exception for hybrid configurator errors - */ - class HybridConfiguratorException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class HybridMDEngineException inherits from CustomException - * - * @brief Exception for hybrid MD engine errors - */ - class HybridMDEngineException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - - /** - * @class PhysicalDataException inherits from CustomException - * - * @brief Exception for physical data errors - */ - class PhysicalDataException : public CustomException - { - public: - using CustomException::CustomException; - - [[nodiscard]] const char *what() const noexcept override; - }; - -} // namespace customException +} // namespace exc #endif // _EXCEPTIONS_HPP_ diff --git a/include/exceptions/exceptions.tpp b/include/exceptions/exceptions.tpp new file mode 100644 index 000000000..7ba219a75 --- /dev/null +++ b/include/exceptions/exceptions.tpp @@ -0,0 +1,22 @@ +/***************************************************************************** + + + PQ + Copyright (C) 2023-now Jakob Gamper + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + +******************************************************************************/ + diff --git a/include/linearAlgebra/matrix/matrixClass.tpp.hpp b/include/linearAlgebra/matrix/matrixClass.tpp.hpp index df64a876b..d14925406 100644 --- a/include/linearAlgebra/matrix/matrixClass.tpp.hpp +++ b/include/linearAlgebra/matrix/matrixClass.tpp.hpp @@ -144,7 +144,7 @@ namespace linearAlgebra if (ldlt.info() != Eigen::Success) { // matrix is not positive-definite - throw customException::LinearAlgebraException( + throw exc::LinearAlgebraException( "Matrix is not positive-definite." ); } @@ -158,4 +158,4 @@ namespace linearAlgebra } } // namespace linearAlgebra -#endif // _MATRIX_CLASS_TPP_ \ No newline at end of file +#endif // _MATRIX_CLASS_TPP_ diff --git a/include/linearAlgebra/staticMatrix/staticMatrix3x3Class.tpp.hpp b/include/linearAlgebra/staticMatrix/staticMatrix3x3Class.tpp.hpp index dd9aa1226..20f96c930 100644 --- a/include/linearAlgebra/staticMatrix/staticMatrix3x3Class.tpp.hpp +++ b/include/linearAlgebra/staticMatrix/staticMatrix3x3Class.tpp.hpp @@ -93,7 +93,7 @@ namespace linearAlgebra StaticMatrix3x3::StaticMatrix3x3(const std::vector &vector) { if (vector.size() != _nElements) - throw customException::LinearAlgebraException( + throw exc::LinearAlgebraException( "vector size must be " + std::to_string(_nElements) ); diff --git a/include/molsys/simulationBox.hpp b/include/molsys/simulationBox.hpp index dbf345f65..d75254b36 100644 --- a/include/molsys/simulationBox.hpp +++ b/include/molsys/simulationBox.hpp @@ -33,7 +33,6 @@ #include "atom.hpp" // for Atom #include "box.hpp" // for Box -#include "exceptions.hpp" // for ExceptionType #include "molecule.hpp" // for Molecule #include "moleculeType.hpp" // for MoleculeType #include "orthorhombicBox.hpp" // for OrthorhombicBox @@ -94,7 +93,7 @@ namespace molsys void copy(const SimulationBox&); [[nodiscard]] std::shared_ptr clone() const; - void checkCoulRadiusCutOff(const customException::ExceptionType) const; + void checkCoulRadiusCutOff(const ExceptionType) const; void setupExternalToInternalGlobalVdwTypesMap(); void calculateDegreesOfFreedom(); diff --git a/src/QM/external/dftbplusRunner.cpp b/src/QM/external/dftbplusRunner.cpp index bcaa229d4..9702d4e03 100644 --- a/src/QM/external/dftbplusRunner.cpp +++ b/src/QM/external/dftbplusRunner.cpp @@ -48,7 +48,7 @@ using enum molsys::Periodicity; using namespace configurator; using namespace constants; -using namespace customException; +using namespace exc; using namespace linearAlgebra; using namespace physicalData; using namespace settings; diff --git a/src/QM/external/externalQMRunner.cpp b/src/QM/external/externalQMRunner.cpp index b0b1c2214..94f247004 100644 --- a/src/QM/external/externalQMRunner.cpp +++ b/src/QM/external/externalQMRunner.cpp @@ -47,7 +47,7 @@ using enum molsys::Periodicity; using namespace molsys; using namespace physicalData; -using namespace customException; +using namespace exc; using namespace settings; using namespace constants; diff --git a/src/QM/external/pyscfRunner.cpp b/src/QM/external/pyscfRunner.cpp index e56a46207..d4186d448 100644 --- a/src/QM/external/pyscfRunner.cpp +++ b/src/QM/external/pyscfRunner.cpp @@ -34,7 +34,7 @@ using QM::PySCFRunner; using namespace molsys; using namespace settings; -using namespace customException; +using namespace exc; using namespace utilities; /** diff --git a/src/QM/external/turbomoleRunner.cpp b/src/QM/external/turbomoleRunner.cpp index f31c50ad9..45688b912 100644 --- a/src/QM/external/turbomoleRunner.cpp +++ b/src/QM/external/turbomoleRunner.cpp @@ -39,7 +39,7 @@ using QM::TurbomoleRunner; using namespace molsys; -using namespace customException; +using namespace exc; using namespace configurator; using namespace constants; using namespace settings; diff --git a/src/QM/qmRunner.cpp b/src/QM/qmRunner.cpp index e7cf5c703..273adde09 100644 --- a/src/QM/qmRunner.cpp +++ b/src/QM/qmRunner.cpp @@ -34,7 +34,7 @@ using enum molsys::Periodicity; using namespace settings; using namespace defaults; -using namespace customException; +using namespace exc; /** * @brief function to throw an exception after a timeout diff --git a/src/constraints/constraints.cpp b/src/constraints/constraints.cpp index 619a23bb1..c0c1e181a 100644 --- a/src/constraints/constraints.cpp +++ b/src/constraints/constraints.cpp @@ -34,7 +34,7 @@ using namespace constraints; using namespace molsys; -using namespace customException; +using namespace exc; /** * @brief constructor diff --git a/src/constraints/mShake.cpp b/src/constraints/mShake.cpp index 8cfec4517..d852bf627 100644 --- a/src/constraints/mShake.cpp +++ b/src/constraints/mShake.cpp @@ -367,7 +367,7 @@ void MShake::applyMShake(SimulationBox &simBox) if (iteration >= mShakeMaxIter) { - throw customException::MShakeException( + throw exc::MShakeException( std::format( "M-Shake did not converge within {} iterations for " "molecule type {}", @@ -490,7 +490,7 @@ bool MShake::isMShakeType(const size_t moltype) const * * @return bool * - * @throw customException::MShakeException if no M - Shake reference is + * @throw exc::MShakeException if no M - Shake reference is * found */ const MShakeReference &MShake::findMShakeRef(const size_t moltype) const @@ -503,7 +503,7 @@ const MShakeReference &MShake::findMShakeRef(const size_t moltype) const return mShakeReference; } - throw customException::MShakeException( + throw exc::MShakeException( std::format("No M-Shake reference found for molecule type {}", moltype) ); } @@ -515,7 +515,7 @@ const MShakeReference &MShake::findMShakeRef(const size_t moltype) const * * @return size_t * - * @throw customException::MShakeException if no M - Shake reference is + * @throw exc::MShakeException if no M - Shake reference is * found */ size_t MShake::findMShakeReferenceIndex(const size_t moltype) const @@ -532,7 +532,7 @@ size_t MShake::findMShakeReferenceIndex(const size_t moltype) const ++index; } - throw customException::MShakeException( + throw exc::MShakeException( std::format("No M-Shake reference found for molecule type {}", moltype) ); } diff --git a/src/engine/hessianEngine.cpp b/src/engine/hessianEngine.cpp index 3c9e2b64c..39138cc3f 100644 --- a/src/engine/hessianEngine.cpp +++ b/src/engine/hessianEngine.cpp @@ -56,7 +56,7 @@ using namespace engine; using namespace opt; using namespace settings; -using namespace customException; +using namespace exc; using namespace physicalData; using namespace defaults; diff --git a/src/engine/optEngine.cpp b/src/engine/optEngine.cpp index c23954970..724784bb9 100644 --- a/src/engine/optEngine.cpp +++ b/src/engine/optEngine.cpp @@ -64,7 +64,7 @@ void OptEngine::run() if (!_converged) { - throw customException::OptException( + throw exc::OptException( std::format( "Optimizer did not converge after {} epochs.", _optimizer->getNEpochs() @@ -86,7 +86,7 @@ void OptEngine::run() for (size_t i = 0; i < errorMessages.size(); ++i) msg += std::format("{}) {}\n", i + 1, errorMessages[i]); - throw customException::OptException(msg); + throw exc::OptException(msg); } timings::GlobalTimer::get().stopSimulationTimer(); diff --git a/src/engine/qmRunnerManager.cpp b/src/engine/qmRunnerManager.cpp index 6fd12855d..4aa72d2c0 100644 --- a/src/engine/qmRunnerManager.cpp +++ b/src/engine/qmRunnerManager.cpp @@ -40,7 +40,7 @@ using namespace engine; using namespace settings; -using namespace customException; +using namespace exc; using namespace QM; using std::make_shared; diff --git a/src/engine/qmmmMDEngine.cpp b/src/engine/qmmmMDEngine.cpp index 55c809fb9..26f5cb821 100644 --- a/src/engine/qmmmMDEngine.cpp +++ b/src/engine/qmmmMDEngine.cpp @@ -37,7 +37,7 @@ #include "virial.hpp" using namespace pq; -using namespace customException; +using namespace exc; using namespace settings; using namespace molsys; diff --git a/src/exceptions/CMakeLists.txt b/src/exceptions/CMakeLists.txt index b65a206f7..fe116038f 100644 --- a/src/exceptions/CMakeLists.txt +++ b/src/exceptions/CMakeLists.txt @@ -1,5 +1,5 @@ -add_library(exceptions - exceptions.cpp +add_library(exceptions + baseException.cpp ) target_include_directories(exceptions @@ -7,6 +7,11 @@ target_include_directories(exceptions ${PROJECT_SOURCE_DIR}/include/exceptions ) +target_link_libraries(exceptions + PUBLIC + mstd +) + install(TARGETS exceptions DESTINATION lib -) \ No newline at end of file +) diff --git a/src/exceptions/baseException.cpp b/src/exceptions/baseException.cpp new file mode 100644 index 000000000..a2ed7465c --- /dev/null +++ b/src/exceptions/baseException.cpp @@ -0,0 +1,89 @@ +/***************************************************************************** + + + PQ + Copyright (C) 2023-now Jakob Gamper + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + +******************************************************************************/ + +#include "baseException.hpp" + +namespace exc +{ + /** + * @class PQException + * + * @brief Base class for all custom exceptions in the application + * + * This class serves as a base for all custom exceptions in the application. + * It inherits from std::exception and provides a common interface for + * exception handling. + */ + PQException::PQException(const std::string_view message) + : _message(message), _lineNumber(std::nullopt) + { + } + + /** + * @brief Constructor for PQException with message and line number + * + * @param message The exception message + * @param lineNumber The line number where the exception occurred (optional) + */ + PQException::PQException( + const std::string_view message, + std::optional lineNumber + ) + : _message(message), _lineNumber(lineNumber) + { + } + + /** + * @brief Set the line number for the exception + * + * @param lineNumber The line number to set + */ + void PQException::setLineNumber(const size_t lineNumber) noexcept + { + // TODO: Consider whether to allow overwriting the line number or not. + // Currently, it only sets the line number if it hasn't been set before. + // This is a very bad code smell here + if (!_lineNumber.has_value()) + _lineNumber = lineNumber; + } + + /** + * @brief Get the exception message + * + * @return const std::string& The exception message + */ + const std::string &PQException::getMessage() const noexcept + { + return _message; + } + + /** + * @brief Get the line number where the exception occurred + * + * @return std::optional The line number (if set) + */ + std::optional PQException::getLineNumber() const noexcept + { + return _lineNumber; + } + +} // namespace exc diff --git a/src/exceptions/exceptions.cpp b/src/exceptions/exceptions.cpp deleted file mode 100644 index 3502827cd..000000000 --- a/src/exceptions/exceptions.cpp +++ /dev/null @@ -1,373 +0,0 @@ -/***************************************************************************** - - - PQ - Copyright (C) 2023-now Jakob Gamper - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - - -******************************************************************************/ - -#include "exceptions.hpp" - -#include - -using namespace customException; - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @param message - */ -CustomException::CustomException( - const std::string_view message, - std::optional lineNumber -) - : _message(message), _lineNumber(lineNumber) -{ -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @param message - */ -CustomException::CustomException(const std::string_view message) - : CustomException(message, std::nullopt) -{ -} - -/** - * @brief Adds a source line if the exception has no line yet. - * - * @param lineNumber - */ -void CustomException::setLineNumber(const size_t lineNumber) noexcept -{ - if (!_lineNumber.has_value()) - _lineNumber = lineNumber; -} - -/** - * @brief Returns the exception message without producing output. - * - * @return const std::string& - */ -const std::string &CustomException::getMessage() const noexcept -{ - return _message; -} - -/** - * @brief Returns the source line associated with the exception. - * - * @return std::optional - */ -std::optional CustomException::getLineNumber() const noexcept -{ - return _lineNumber; -} - -/** - * @brief Prints the exceptionMsg type in color. - * - * @param color - * @param exceptionMsg - */ -void CustomException::colorfulOutput( - const Color::Code color, - const std::string_view exceptionMsg -) const -{ - const Color::Modifier modifier(color); - const Color::Modifier def(Color::FG_DEFAULT); - - std::cout << modifier << exceptionMsg << def << '\n' << std::flush; -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @return const char* - */ -const char *InputFileException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "InputFileError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @return const char* - */ -const char *RstFileException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "RstFileError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @return const char* - */ -const char *UserInputException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "UserInputError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @return const char* - */ -const char *MolDescriptorException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "MolDescriptorError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @return const char* - */ -const char *UserInputExceptionWarning::what() const noexcept -{ - colorfulOutput(Color::FG_ORANGE, "UserInputWarning"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @return const char* - */ -const char *GuffDatException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "GuffDatError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @return const char* - */ -const char *TopologyException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "TopologyError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @return const char* - */ -const char *ParameterFileException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "ParameterFileError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @return const char* - */ -const char *ManostatException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "ManostatError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @return const char* - */ -const char *IntraNonBondedException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "IntraNonBondedError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @return const char* - */ -const char *ShakeException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "ShakeError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @return const char* - */ -const char *CellListException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "CellListError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @param message - */ -const char *RingPolymerRestartFileException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "RingPolymerRestartFileError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @param message - */ -const char *QMRunnerException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "QMRunnerError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @param message - */ -const char *MPIException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "MPIError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @param message - */ -const char *QMRunTimeExceeded::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "QMRunTimeExceeded"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @param message - */ -const char *MShakeFileException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "MShakeError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @param message - */ -const char *MShakeException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "MShakeError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @param message - */ -const char *LinearAlgebraException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "LinearAlgebraError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @param message - */ -const char *OptException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "OptimizationError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @param message - */ -const char *OptWarning::what() const noexcept -{ - colorfulOutput(Color::FG_ORANGE, "OptimizationWarning"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @param message - */ -const char *CompileTimeException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "CompileTimeError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @param message - */ -const char *HybridConfiguratorException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "HybridConfiguratorError"); - return _message.c_str(); -} - -/** - * @brief Construct a new Custom Exception:: Custom Exception object - * - * @param message - */ -const char *HybridMDEngineException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "HybridMDEngineError"); - return _message.c_str(); -} - -/** - * @brief return the exception message for PhysicalDataException - * - * @param message - */ -const char *PhysicalDataException::what() const noexcept -{ - colorfulOutput(Color::FG_RED, "PhysicalDataError"); - return _message.c_str(); -} diff --git a/src/forceField/forceFieldClass.cpp b/src/forceField/forceFieldClass.cpp index b3a9bbb71..83cb9758e 100644 --- a/src/forceField/forceFieldClass.cpp +++ b/src/forceField/forceFieldClass.cpp @@ -29,7 +29,7 @@ #include "exceptions.hpp" using namespace forceField; -using namespace customException; +using namespace exc; using namespace molsys; using namespace physicalData; using namespace potential; diff --git a/src/hybridConfigurator/hybridConfigurator.cpp b/src/hybridConfigurator/hybridConfigurator.cpp index 9b39c3a51..3d2876cb1 100644 --- a/src/hybridConfigurator/hybridConfigurator.cpp +++ b/src/hybridConfigurator/hybridConfigurator.cpp @@ -34,7 +34,7 @@ using enum molsys::HybridZone; using namespace pq; using namespace configurator; -using namespace customException; +using namespace exc; using namespace settings; using namespace molsys; diff --git a/src/input/commandLineArgs.cpp b/src/input/commandLineArgs.cpp index 2712cc9e7..1518fa99f 100644 --- a/src/input/commandLineArgs.cpp +++ b/src/input/commandLineArgs.cpp @@ -24,7 +24,7 @@ #include "exceptions.hpp" // for UserInputException -using namespace customException; +using namespace exc; /** * @brief Construct a new CommandLineArgs::CommandLineArgs object diff --git a/src/input/guffDatReader.cpp b/src/input/guffDatReader.cpp index 805db20d5..296353e06 100644 --- a/src/input/guffDatReader.cpp +++ b/src/input/guffDatReader.cpp @@ -52,7 +52,7 @@ using namespace input::guffdat; using namespace settings; using namespace utilities; using namespace defaults; -using namespace customException; +using namespace exc; using namespace molsys; using namespace potential; using namespace constants; diff --git a/src/input/inputFileParser/MMInputParser.cpp b/src/input/inputFileParser/MMInputParser.cpp index abcde418c..31d2ced6e 100644 --- a/src/input/inputFileParser/MMInputParser.cpp +++ b/src/input/inputFileParser/MMInputParser.cpp @@ -37,7 +37,7 @@ #include "waterModelSettings.hpp" // for WaterModelSettings using namespace input; -using namespace customException; +using namespace exc; using namespace settings; using namespace utilities; using namespace potential; diff --git a/src/input/inputFileParser/QMInputParser.cpp b/src/input/inputFileParser/QMInputParser.cpp index 9e5cc4c8d..392fb1f64 100644 --- a/src/input/inputFileParser/QMInputParser.cpp +++ b/src/input/inputFileParser/QMInputParser.cpp @@ -38,7 +38,7 @@ using namespace input; using namespace utilities; using namespace settings; -using namespace customException; +using namespace exc; using namespace references; using namespace constants; diff --git a/src/input/inputFileParser/cellListInputParser.cpp b/src/input/inputFileParser/cellListInputParser.cpp index 6cfea1658..496a444cb 100644 --- a/src/input/inputFileParser/cellListInputParser.cpp +++ b/src/input/inputFileParser/cellListInputParser.cpp @@ -37,7 +37,7 @@ using namespace input; using namespace utilities; -using namespace customException; +using namespace exc; /** * @brief Construct a new Input File Parser Cell List:: Input File Parser Cell diff --git a/src/input/inputFileParser/constraintsInputParser.cpp b/src/input/inputFileParser/constraintsInputParser.cpp index 2e841c0c2..303e02d5e 100644 --- a/src/input/inputFileParser/constraintsInputParser.cpp +++ b/src/input/inputFileParser/constraintsInputParser.cpp @@ -39,7 +39,7 @@ using namespace input; using namespace settings; using namespace references; -using namespace customException; +using namespace exc; /** * @brief Construct a new Input File Parser Constraints:: Input File Parser diff --git a/src/input/inputFileParser/convergenceInputParser.cpp b/src/input/inputFileParser/convergenceInputParser.cpp index fb1bda3ac..9afa22488 100644 --- a/src/input/inputFileParser/convergenceInputParser.cpp +++ b/src/input/inputFileParser/convergenceInputParser.cpp @@ -33,7 +33,7 @@ using namespace input; using namespace settings; using namespace utilities; -using namespace customException; +using namespace exc; /** * @brief Constructor diff --git a/src/input/inputFileParser/coulombLongRangeInputParser.cpp b/src/input/inputFileParser/coulombLongRangeInputParser.cpp index 5a7131ba4..58b024948 100644 --- a/src/input/inputFileParser/coulombLongRangeInputParser.cpp +++ b/src/input/inputFileParser/coulombLongRangeInputParser.cpp @@ -31,7 +31,7 @@ #include "stringUtilities.hpp" // for toLowerCopy using namespace input; -using namespace customException; +using namespace exc; using namespace settings; using namespace utilities; diff --git a/src/input/inputFileParser/filesInputParser.cpp b/src/input/inputFileParser/filesInputParser.cpp index d68572e1e..b4a1c3f00 100644 --- a/src/input/inputFileParser/filesInputParser.cpp +++ b/src/input/inputFileParser/filesInputParser.cpp @@ -32,7 +32,7 @@ #include "stringUtilities.hpp" // for fileExists using namespace input; -using namespace customException; +using namespace exc; using namespace settings; using namespace utilities; diff --git a/src/input/inputFileParser/generalInputParser.cpp b/src/input/inputFileParser/generalInputParser.cpp index 5ec21e370..3884c4318 100644 --- a/src/input/inputFileParser/generalInputParser.cpp +++ b/src/input/inputFileParser/generalInputParser.cpp @@ -41,7 +41,7 @@ using namespace input; using namespace settings; using namespace utilities; -using namespace customException; +using namespace exc; using namespace engine; using std::format; diff --git a/src/input/inputFileParser/hessianInputParser.cpp b/src/input/inputFileParser/hessianInputParser.cpp index bda0bd8f7..534279238 100644 --- a/src/input/inputFileParser/hessianInputParser.cpp +++ b/src/input/inputFileParser/hessianInputParser.cpp @@ -31,7 +31,7 @@ using namespace input; using namespace settings; -using namespace customException; +using namespace exc; using namespace utilities; HessianInputParser::HessianInputParser() diff --git a/src/input/inputFileParser/hybridInputParser.cpp b/src/input/inputFileParser/hybridInputParser.cpp index 609d43c9c..6649c1a29 100644 --- a/src/input/inputFileParser/hybridInputParser.cpp +++ b/src/input/inputFileParser/hybridInputParser.cpp @@ -42,7 +42,7 @@ #endif using namespace input; -using namespace customException; +using namespace exc; using namespace settings; using namespace utilities; @@ -441,7 +441,7 @@ void HybridInputParser::parseQMForceDistribution( * * @return std::vector The selection vector * - * @throws customException::InputFileException if the selection string contains + * @throws exc::InputFileException if the selection string contains * characters that are not digits, "-" or commas and the PQ build is compiled * without Python bindings. */ @@ -507,7 +507,7 @@ std::vector HybridInputParser::parseSelection( * * @return std::vector The selection vector * - * @throws customException::InputFileException if the selection string is an + * @throws exc::InputFileException if the selection string is an * empty list */ std::vector HybridInputParser::parseSelectionNoPython( @@ -642,7 +642,7 @@ std::vector HybridInputParser::parseSelectionNoPython( // check if the selection vector is empty if (selectionVec.empty()) { - throw customException::InputFileException( + throw exc::InputFileException( std::format( "The value of key {} - {} is an empty list. The {} string must " "be a comma-separated list of integers or ranges, representing " diff --git a/src/input/inputFileParser/inputFileParser.cpp b/src/input/inputFileParser/inputFileParser.cpp index a31d528e0..7ff927854 100644 --- a/src/input/inputFileParser/inputFileParser.cpp +++ b/src/input/inputFileParser/inputFileParser.cpp @@ -29,7 +29,7 @@ #include "stringUtilities.hpp" // for toLowerCopy using namespace input; -using namespace customException; +using namespace exc; using namespace utilities; /** diff --git a/src/input/inputFileParser/integratorInputParser.cpp b/src/input/inputFileParser/integratorInputParser.cpp index 8fe2c21a0..b19119875 100644 --- a/src/input/inputFileParser/integratorInputParser.cpp +++ b/src/input/inputFileParser/integratorInputParser.cpp @@ -33,7 +33,7 @@ #include "stringUtilities.hpp" // for toLowerCopy using namespace input; -using namespace customException; +using namespace exc; using namespace settings; using namespace utilities; using namespace references; diff --git a/src/input/inputFileParser/manostatInputParser.cpp b/src/input/inputFileParser/manostatInputParser.cpp index 8162a60fe..f78c83fe3 100644 --- a/src/input/inputFileParser/manostatInputParser.cpp +++ b/src/input/inputFileParser/manostatInputParser.cpp @@ -37,7 +37,7 @@ using namespace input; using namespace settings; -using namespace customException; +using namespace exc; using namespace references; using namespace utilities; using namespace constants; diff --git a/src/input/inputFileParser/optInputParser.cpp b/src/input/inputFileParser/optInputParser.cpp index 81eacbda5..ae82eeb09 100644 --- a/src/input/inputFileParser/optInputParser.cpp +++ b/src/input/inputFileParser/optInputParser.cpp @@ -32,7 +32,7 @@ using namespace input; using namespace settings; -using namespace customException; +using namespace exc; using namespace utilities; /** diff --git a/src/input/inputFileParser/outputInputParser.cpp b/src/input/inputFileParser/outputInputParser.cpp index 2d4df3844..2db317543 100644 --- a/src/input/inputFileParser/outputInputParser.cpp +++ b/src/input/inputFileParser/outputInputParser.cpp @@ -31,7 +31,7 @@ using namespace input; using namespace utilities; -using namespace customException; +using namespace exc; using namespace settings; /** diff --git a/src/input/inputFileParser/resetKineticsInputParser.cpp b/src/input/inputFileParser/resetKineticsInputParser.cpp index 7e62c6f15..6b79dc380 100644 --- a/src/input/inputFileParser/resetKineticsInputParser.cpp +++ b/src/input/inputFileParser/resetKineticsInputParser.cpp @@ -31,7 +31,7 @@ #include "stringUtilities.hpp" // for stringToInt using namespace input; -using namespace customException; +using namespace exc; using namespace settings; /** diff --git a/src/input/inputFileParser/ringPolymerInputParser.cpp b/src/input/inputFileParser/ringPolymerInputParser.cpp index cd4625919..21ca7dd79 100644 --- a/src/input/inputFileParser/ringPolymerInputParser.cpp +++ b/src/input/inputFileParser/ringPolymerInputParser.cpp @@ -30,7 +30,7 @@ #include "stringUtilities.hpp" // for stringToInt using namespace input; -using namespace customException; +using namespace exc; using namespace settings; /** diff --git a/src/input/inputFileParser/simulationBoxInputParser.cpp b/src/input/inputFileParser/simulationBoxInputParser.cpp index 81f368781..fdb038418 100644 --- a/src/input/inputFileParser/simulationBoxInputParser.cpp +++ b/src/input/inputFileParser/simulationBoxInputParser.cpp @@ -34,7 +34,7 @@ #include "stringUtilities.hpp" // for toLowerCopy using namespace input; -using namespace customException; +using namespace exc; using namespace settings; using namespace utilities; diff --git a/src/input/inputFileParser/thermostatInputParser.cpp b/src/input/inputFileParser/thermostatInputParser.cpp index ea5f03c67..53a4d27c1 100644 --- a/src/input/inputFileParser/thermostatInputParser.cpp +++ b/src/input/inputFileParser/thermostatInputParser.cpp @@ -37,7 +37,7 @@ #include "thermostatSettings.hpp" // for ThermostatSettings using namespace input; -using namespace customException; +using namespace exc; using namespace settings; using namespace utilities; using namespace references; diff --git a/src/input/inputFileParser/timingsInputParser.cpp b/src/input/inputFileParser/timingsInputParser.cpp index f90ad23cd..1931d87ca 100644 --- a/src/input/inputFileParser/timingsInputParser.cpp +++ b/src/input/inputFileParser/timingsInputParser.cpp @@ -30,7 +30,7 @@ #include "timingsSettings.hpp" // for TimingsSettings using namespace input; -using namespace customException; +using namespace exc; using namespace settings; using namespace utilities; diff --git a/src/input/inputFileParser/virialInputParser.cpp b/src/input/inputFileParser/virialInputParser.cpp index af1f57937..a9a15912c 100644 --- a/src/input/inputFileParser/virialInputParser.cpp +++ b/src/input/inputFileParser/virialInputParser.cpp @@ -30,7 +30,7 @@ #include "stringUtilities.hpp" // for toLowerCopy using namespace input; -using namespace customException; +using namespace exc; using namespace utilities; /** diff --git a/src/input/inputFileReader.cpp b/src/input/inputFileReader.cpp index 507e5feaa..020cee785 100644 --- a/src/input/inputFileReader.cpp +++ b/src/input/inputFileReader.cpp @@ -56,7 +56,7 @@ using namespace input; using namespace utilities; -using namespace customException; +using namespace exc; using std::make_unique; /** @@ -206,7 +206,7 @@ void InputFileReader::process(const std::vector &lineElements) { parserFunc(lineElements, _lineNumber); } - catch (CustomException &exception) + catch (PQException &exception) { exception.setLineNumber(_lineNumber); throw; @@ -285,7 +285,7 @@ void InputFileReader::read() processInputCommand ); } - catch (CustomException &exception) + catch (PQException &exception) { exception.setLineNumber(_lineNumber); throw; @@ -353,7 +353,7 @@ void input::readJobType( processInputCommand ); } - catch (CustomException &exception) + catch (PQException &exception) { exception.setLineNumber(lineNumber); throw; diff --git a/src/input/inputValidation.cpp b/src/input/inputValidation.cpp index 3e9073c77..39265f5a1 100644 --- a/src/input/inputValidation.cpp +++ b/src/input/inputValidation.cpp @@ -39,7 +39,7 @@ using namespace input; using namespace settings; -using namespace customException; +using namespace exc; /** * @brief validates semantic dependencies between parsed input keywords diff --git a/src/input/intraNonBondedReader.cpp b/src/input/intraNonBondedReader.cpp index 95934fcdd..36ae22434 100644 --- a/src/input/intraNonBondedReader.cpp +++ b/src/input/intraNonBondedReader.cpp @@ -41,7 +41,7 @@ using namespace input::intraNonBondedReader; using namespace engine; using namespace settings; -using namespace customException; +using namespace exc; using namespace utilities; using namespace intraNonBonded; diff --git a/src/input/mShakeReader.cpp b/src/input/mShakeReader.cpp index 5a3438baa..becaa6e13 100644 --- a/src/input/mShakeReader.cpp +++ b/src/input/mShakeReader.cpp @@ -32,7 +32,7 @@ using namespace input::mShake; using namespace engine; -using namespace customException; +using namespace exc; using namespace settings; using namespace utilities; using namespace constraints; diff --git a/src/input/moldescriptorReader.cpp b/src/input/moldescriptorReader.cpp index 06ae805bd..fd34c459c 100644 --- a/src/input/moldescriptorReader.cpp +++ b/src/input/moldescriptorReader.cpp @@ -39,7 +39,7 @@ using namespace settings; using namespace engine; using namespace molsys; using namespace utilities; -using namespace customException; +using namespace exc; /** * @brief constructor diff --git a/src/input/parameterFileReader/angleSection.cpp b/src/input/parameterFileReader/angleSection.cpp index 6b1b5fbf1..33f2658f9 100644 --- a/src/input/parameterFileReader/angleSection.cpp +++ b/src/input/parameterFileReader/angleSection.cpp @@ -31,7 +31,7 @@ using namespace input::parameterFile; using namespace engine; -using namespace customException; +using namespace exc; using namespace forceField; using namespace constants; diff --git a/src/input/parameterFileReader/bondSection.cpp b/src/input/parameterFileReader/bondSection.cpp index 5df29617b..94155d50e 100644 --- a/src/input/parameterFileReader/bondSection.cpp +++ b/src/input/parameterFileReader/bondSection.cpp @@ -29,7 +29,7 @@ #include "exceptions.hpp" // for ParameterFileException using namespace input::parameterFile; -using namespace customException; +using namespace exc; using namespace engine; using namespace forceField; diff --git a/src/input/parameterFileReader/dihedralSection.cpp b/src/input/parameterFileReader/dihedralSection.cpp index 37cd029ad..a0c94de53 100644 --- a/src/input/parameterFileReader/dihedralSection.cpp +++ b/src/input/parameterFileReader/dihedralSection.cpp @@ -31,7 +31,7 @@ using namespace input::parameterFile; using namespace engine; -using namespace customException; +using namespace exc; using namespace forceField; using namespace constants; diff --git a/src/input/parameterFileReader/improperDihedralSection.cpp b/src/input/parameterFileReader/improperDihedralSection.cpp index 648fd45d1..7fdc008e7 100644 --- a/src/input/parameterFileReader/improperDihedralSection.cpp +++ b/src/input/parameterFileReader/improperDihedralSection.cpp @@ -31,7 +31,7 @@ using namespace input::parameterFile; using namespace engine; -using namespace customException; +using namespace exc; using namespace forceField; using namespace constants; diff --git a/src/input/parameterFileReader/jCouplingSection.cpp b/src/input/parameterFileReader/jCouplingSection.cpp index e65c9ef0f..8bbe5ae28 100644 --- a/src/input/parameterFileReader/jCouplingSection.cpp +++ b/src/input/parameterFileReader/jCouplingSection.cpp @@ -31,7 +31,7 @@ using namespace input::parameterFile; using namespace engine; -using namespace customException; +using namespace exc; using namespace forceField; using namespace constants; diff --git a/src/input/parameterFileReader/nonCoulombicsSection.cpp b/src/input/parameterFileReader/nonCoulombicsSection.cpp index 4cb8c3524..005067143 100644 --- a/src/input/parameterFileReader/nonCoulombicsSection.cpp +++ b/src/input/parameterFileReader/nonCoulombicsSection.cpp @@ -36,7 +36,7 @@ #include "stringUtilities.hpp" // for toLowerCopy using namespace input::parameterFile; -using namespace customException; +using namespace exc; using namespace engine; using namespace potential; using namespace settings; diff --git a/src/input/parameterFileReader/parameterFileReader.cpp b/src/input/parameterFileReader/parameterFileReader.cpp index 65bdb797b..95e0a4022 100644 --- a/src/input/parameterFileReader/parameterFileReader.cpp +++ b/src/input/parameterFileReader/parameterFileReader.cpp @@ -38,7 +38,7 @@ using namespace input::parameterFile; using namespace engine; using namespace utilities; -using namespace customException; +using namespace exc; using namespace settings; using std::make_unique; diff --git a/src/input/parameterFileReader/parameterFileSection.cpp b/src/input/parameterFileReader/parameterFileSection.cpp index 0286efb47..98e2f8793 100644 --- a/src/input/parameterFileReader/parameterFileSection.cpp +++ b/src/input/parameterFileReader/parameterFileSection.cpp @@ -29,7 +29,7 @@ using namespace input::parameterFile; using namespace utilities; -using namespace customException; +using namespace exc; using namespace engine; /** @@ -116,4 +116,4 @@ void ParameterFileSection::setFp(std::ifstream *fp) { _fp = fp; } * * @return int */ -int ParameterFileSection::getLineNumber() const { return _lineNumber; } \ No newline at end of file +int ParameterFileSection::getLineNumber() const { return _lineNumber; } diff --git a/src/input/parameterFileReader/typesSection.cpp b/src/input/parameterFileReader/typesSection.cpp index 8de0b75a5..ef599ef63 100644 --- a/src/input/parameterFileReader/typesSection.cpp +++ b/src/input/parameterFileReader/typesSection.cpp @@ -29,7 +29,7 @@ using namespace input::parameterFile; using namespace engine; -using namespace customException; +using namespace exc; using namespace settings; /** diff --git a/src/input/restartFileReader/atomSection.cpp b/src/input/restartFileReader/atomSection.cpp index d9e86ebad..fb10754e6 100644 --- a/src/input/restartFileReader/atomSection.cpp +++ b/src/input/restartFileReader/atomSection.cpp @@ -40,7 +40,7 @@ using namespace input::restartFile; using namespace molsys; using namespace engine; -using namespace customException; +using namespace exc; using namespace settings; using namespace utilities; diff --git a/src/input/restartFileReader/boxSection.cpp b/src/input/restartFileReader/boxSection.cpp index 265af7c1f..f8bc53d55 100644 --- a/src/input/restartFileReader/boxSection.cpp +++ b/src/input/restartFileReader/boxSection.cpp @@ -37,7 +37,7 @@ #include "triclinicBox.hpp" // for TriclinicBox using namespace input::restartFile; -using namespace customException; +using namespace exc; using namespace linearAlgebra; using namespace utilities; using namespace settings; diff --git a/src/input/restartFileReader/noseHooverSection.cpp b/src/input/restartFileReader/noseHooverSection.cpp index d3aa5a653..568171b1f 100644 --- a/src/input/restartFileReader/noseHooverSection.cpp +++ b/src/input/restartFileReader/noseHooverSection.cpp @@ -30,7 +30,7 @@ using input::restartFile::NoseHooverSection; using namespace engine; -using namespace customException; +using namespace exc; using namespace settings; /** diff --git a/src/input/restartFileReader/restartFileReader.cpp b/src/input/restartFileReader/restartFileReader.cpp index 7d4d874f7..d2ccae23c 100644 --- a/src/input/restartFileReader/restartFileReader.cpp +++ b/src/input/restartFileReader/restartFileReader.cpp @@ -84,7 +84,7 @@ RestartFileSection *RestartFileReader::determineSection( * @brief Reads a restart file and calls the process function of the * corresponding section * - * @throw customException::InputFileException if file not found + * @throw exc::InputFileException if file not found */ void RestartFileReader::read() { diff --git a/src/input/restartFileReader/stepCountSection.cpp b/src/input/restartFileReader/stepCountSection.cpp index 8477e0e78..2d7dce537 100644 --- a/src/input/restartFileReader/stepCountSection.cpp +++ b/src/input/restartFileReader/stepCountSection.cpp @@ -34,7 +34,7 @@ using namespace input::restartFile; using namespace engine; using namespace settings; -using namespace customException; +using namespace exc; /** * @brief processes the step count section of the rst file diff --git a/src/input/ringPolymerRestartFileReader/ringPolymerRestartFileReader.cpp b/src/input/ringPolymerRestartFileReader/ringPolymerRestartFileReader.cpp index b4cd6f021..73b3da630 100644 --- a/src/input/ringPolymerRestartFileReader/ringPolymerRestartFileReader.cpp +++ b/src/input/ringPolymerRestartFileReader/ringPolymerRestartFileReader.cpp @@ -36,7 +36,7 @@ using input::ringPolymer::RingPolymerRestartFileReader; using namespace engine; using namespace settings; -using namespace customException; +using namespace exc; using namespace utilities; /** diff --git a/src/input/topologyFileReader/angleSection.cpp b/src/input/topologyFileReader/angleSection.cpp index 669020a1a..b1e769aca 100644 --- a/src/input/topologyFileReader/angleSection.cpp +++ b/src/input/topologyFileReader/angleSection.cpp @@ -35,7 +35,7 @@ using namespace input::topology; using namespace molsys; using namespace forceField; -using namespace customException; +using namespace exc; using namespace engine; /** diff --git a/src/input/topologyFileReader/bondSection.cpp b/src/input/topologyFileReader/bondSection.cpp index 7907ab9fc..dae41acac 100644 --- a/src/input/topologyFileReader/bondSection.cpp +++ b/src/input/topologyFileReader/bondSection.cpp @@ -34,7 +34,7 @@ using namespace input::topology; using namespace molsys; using namespace forceField; -using namespace customException; +using namespace exc; using namespace engine; /** diff --git a/src/input/topologyFileReader/dihedralSection.cpp b/src/input/topologyFileReader/dihedralSection.cpp index 80df4a180..aa9268196 100644 --- a/src/input/topologyFileReader/dihedralSection.cpp +++ b/src/input/topologyFileReader/dihedralSection.cpp @@ -35,7 +35,7 @@ using namespace input::topology; using namespace molsys; using namespace forceField; -using namespace customException; +using namespace exc; using namespace engine; /** diff --git a/src/input/topologyFileReader/distanceConstraintsSection.cpp b/src/input/topologyFileReader/distanceConstraintsSection.cpp index 5d3567c9a..07dfe3e9d 100644 --- a/src/input/topologyFileReader/distanceConstraintsSection.cpp +++ b/src/input/topologyFileReader/distanceConstraintsSection.cpp @@ -31,7 +31,7 @@ using namespace input::topology; using namespace engine; -using namespace customException; +using namespace exc; using namespace constraints; /** diff --git a/src/input/topologyFileReader/improperDihedralSection.cpp b/src/input/topologyFileReader/improperDihedralSection.cpp index b139ef67c..9790f59dd 100644 --- a/src/input/topologyFileReader/improperDihedralSection.cpp +++ b/src/input/topologyFileReader/improperDihedralSection.cpp @@ -33,7 +33,7 @@ using namespace input::topology; using namespace forceField; -using namespace customException; +using namespace exc; using namespace engine; /** diff --git a/src/input/topologyFileReader/jCouplingSection.cpp b/src/input/topologyFileReader/jCouplingSection.cpp index 060f825f1..32120eebb 100644 --- a/src/input/topologyFileReader/jCouplingSection.cpp +++ b/src/input/topologyFileReader/jCouplingSection.cpp @@ -32,7 +32,7 @@ #include "jCouplingForceField.hpp" // for JCouplingForceField using namespace input::topology; -using namespace customException; +using namespace exc; using namespace engine; using namespace forceField; diff --git a/src/input/topologyFileReader/shakeSection.cpp b/src/input/topologyFileReader/shakeSection.cpp index 1ec4e1cf5..d7ace6561 100644 --- a/src/input/topologyFileReader/shakeSection.cpp +++ b/src/input/topologyFileReader/shakeSection.cpp @@ -31,7 +31,7 @@ using namespace input::topology; using namespace engine; -using namespace customException; +using namespace exc; using namespace constraints; /** diff --git a/src/input/topologyFileReader/topologyReader.cpp b/src/input/topologyFileReader/topologyReader.cpp index 65537a17e..a8222c41a 100644 --- a/src/input/topologyFileReader/topologyReader.cpp +++ b/src/input/topologyFileReader/topologyReader.cpp @@ -40,7 +40,7 @@ using namespace input::topology; using namespace engine; -using namespace customException; +using namespace exc; using namespace settings; using namespace utilities; diff --git a/src/intraNonBonded/intraNonBonded.cpp b/src/intraNonBonded/intraNonBonded.cpp index a9b599cd2..22a1ad1b4 100644 --- a/src/intraNonBonded/intraNonBonded.cpp +++ b/src/intraNonBonded/intraNonBonded.cpp @@ -32,7 +32,7 @@ using namespace intraNonBonded; using namespace potential; -using namespace customException; +using namespace exc; using namespace molsys; using namespace physicalData; diff --git a/src/manostat/berendsenManostat.cpp b/src/manostat/berendsenManostat.cpp index 1809bae8e..c05aaf09f 100644 --- a/src/manostat/berendsenManostat.cpp +++ b/src/manostat/berendsenManostat.cpp @@ -25,7 +25,6 @@ #include // for __for_each_fn, for_each #include // for cbrt -#include "exceptions.hpp" // for ExceptionType #include "globalTimer.hpp" #include "manostatSettings.hpp" // for ManostatType, Isotropy #include "physicalData.hpp" // for PhysicalData @@ -35,7 +34,7 @@ using namespace linearAlgebra; using namespace settings; using namespace manostat; -using namespace customException; +using namespace exc; using namespace molsys; using namespace physicalData; @@ -107,7 +106,7 @@ void BerendsenManostat::applyManostat( physicalData.setVolume(simBox.getVolume()); physicalData.setDensity(simBox.getDensity()); - simBox.checkCoulRadiusCutOff(ExceptionType::MANOSTATEXCEPTION); + simBox.checkCoulRadiusCutOff(ExceptionType::ManostatError); auto scaleMolecule = [&mu, &simBox](auto &molecule) { molecule.scale(mu, simBox.getBox()); }; diff --git a/src/manostat/stochasticRescalingManostat.cpp b/src/manostat/stochasticRescalingManostat.cpp index 489b7e964..e2ed3fd17 100644 --- a/src/manostat/stochasticRescalingManostat.cpp +++ b/src/manostat/stochasticRescalingManostat.cpp @@ -27,7 +27,6 @@ #include "constants/conversionFactors.hpp" // for _BOLTZMANN_CONSTANT_IN_KCAL_PER_MOL_ #include "constants/internalConversionFactors.hpp" // for _PRESSURE_FACTOR_ -#include "exceptions.hpp" // for ExceptionType #include "globalTimer.hpp" #include "manostatSettings.hpp" // for ManostatType, Isotropy #include "physicalData.hpp" // for PhysicalData @@ -40,7 +39,7 @@ using namespace manostat; using namespace settings; using namespace molsys; using namespace physicalData; -using namespace customException; +using namespace exc; using namespace constants; using namespace linearAlgebra; @@ -152,7 +151,7 @@ void StochasticRescalingManostat::applyManostat( physicalData.setVolume(simBox.getVolume()); physicalData.setDensity(simBox.getDensity()); - simBox.checkCoulRadiusCutOff(ExceptionType::MANOSTATEXCEPTION); + simBox.checkCoulRadiusCutOff(ExceptionType::ManostatError); auto scalePositions = [&mu, &simBox](auto &molecule) { molecule.scale(mu, simBox.getBox()); }; diff --git a/src/molsys/atom.cpp b/src/molsys/atom.cpp index 0b0f6e0c1..3e9d6b319 100644 --- a/src/molsys/atom.cpp +++ b/src/molsys/atom.cpp @@ -32,7 +32,7 @@ using namespace molsys; using namespace utilities; using namespace constants; -using namespace customException; +using namespace exc; using namespace linearAlgebra; using namespace settings; diff --git a/src/molsys/celllist.cpp b/src/molsys/celllist.cpp index b7671733e..d1564d13f 100644 --- a/src/molsys/celllist.cpp +++ b/src/molsys/celllist.cpp @@ -39,7 +39,7 @@ using namespace molsys; using namespace settings; using namespace linearAlgebra; -using namespace customException; +using namespace exc; /** * @brief clone cell list @@ -99,7 +99,7 @@ void CellList::determineCellSize(const Vec3D &box) /** * @brief check if coulomb cutoff is smaller than half of the largest cell size * - * @throws customException::CellListException if coulomb cutoff is smaller than + * @throws exc::CellListException if coulomb cutoff is smaller than * half of the largest cell size * * @param coulombCutoff diff --git a/src/molsys/simulationBox.cpp b/src/molsys/simulationBox.cpp index 76af01cde..5e5f4ac30 100644 --- a/src/molsys/simulationBox.cpp +++ b/src/molsys/simulationBox.cpp @@ -34,7 +34,7 @@ #include "stlVector.hpp" // for rms using namespace linearAlgebra; -using namespace customException; +using namespace exc; using namespace constants; using namespace settings; using namespace randomNumberGenerator; @@ -734,7 +734,7 @@ namespace molsys "Coulomb radius cut off is larger than half of the minimal box " "dimension"; - if (exceptionType == ExceptionType::MANOSTATEXCEPTION) + if (exceptionType == ExceptionType::ManostatError) throw ManostatException(message); throw UserInputException(message); diff --git a/src/opt/evaluator/evaluator.cpp b/src/opt/evaluator/evaluator.cpp index b4de73a27..08543d200 100644 --- a/src/opt/evaluator/evaluator.cpp +++ b/src/opt/evaluator/evaluator.cpp @@ -40,7 +40,7 @@ using namespace forceField; using namespace intraNonBonded; using namespace virial; using namespace constraints; -using namespace customException; +using namespace exc; bool Evaluator::supportsAnalyticHessian() const { return false; } diff --git a/src/opt/evaluator/hessianBuilder.cpp b/src/opt/evaluator/hessianBuilder.cpp index ee30f7b72..fb834a4d0 100644 --- a/src/opt/evaluator/hessianBuilder.cpp +++ b/src/opt/evaluator/hessianBuilder.cpp @@ -30,7 +30,7 @@ using namespace opt; using namespace settings; -using namespace customException; +using namespace exc; /** * @brief Construct a new Force Difference Hessian Builder:: Force Difference diff --git a/src/opt/optimizer/optimizer.cpp b/src/opt/optimizer/optimizer.cpp index 403512083..b979001db 100644 --- a/src/opt/optimizer/optimizer.cpp +++ b/src/opt/optimizer/optimizer.cpp @@ -32,7 +32,7 @@ using namespace opt; using namespace physicalData; using namespace molsys; using namespace settings; -using namespace customException; +using namespace exc; /** * @brief Construct a new Optimizer object diff --git a/src/output/output.cpp b/src/output/output.cpp index edd784847..ed2fdbe9e 100644 --- a/src/output/output.cpp +++ b/src/output/output.cpp @@ -22,14 +22,14 @@ #include "output.hpp" -#include // for format -#include // for ifstream, ofstream, std +#include // for format +#include // for ifstream, ofstream, std #include "exceptions.hpp" // for InputFileException, customException #include "outputFileSettings.hpp" // for OutputFileSettings using namespace std; -using namespace customException; +using namespace exc; using namespace output; using namespace settings; diff --git a/src/output/stdoutOutput.cpp b/src/output/stdoutOutput.cpp index 6ae26cbe0..189d40b46 100644 --- a/src/output/stdoutOutput.cpp +++ b/src/output/stdoutOutput.cpp @@ -30,7 +30,7 @@ #include "outputMessages.hpp" // for initialMomentumMessage using output::StdoutOutput; -using namespace customException; +using namespace exc; /** * @brief write a message to the stdout diff --git a/src/potential/nonCoulomb/forceFieldNonCoulomb.cpp b/src/potential/nonCoulomb/forceFieldNonCoulomb.cpp index 4f366e3db..678c4143b 100644 --- a/src/potential/nonCoulomb/forceFieldNonCoulomb.cpp +++ b/src/potential/nonCoulomb/forceFieldNonCoulomb.cpp @@ -35,7 +35,7 @@ #include "nonCoulombPair.hpp" // for NonCoulombPair using namespace potential; -using namespace customException; +using namespace exc; using namespace linearAlgebra; using std::ranges::adjacent_find; diff --git a/src/resetKinetics/resetKinetics.cpp b/src/resetKinetics/resetKinetics.cpp index e3df26c8b..fb91e89aa 100644 --- a/src/resetKinetics/resetKinetics.cpp +++ b/src/resetKinetics/resetKinetics.cpp @@ -41,7 +41,7 @@ using namespace linearAlgebra; using namespace physicalData; using namespace molsys; using namespace constants; -using namespace customException; +using namespace exc; using namespace settings; using namespace utilities; diff --git a/src/settings/convergenceSettings.cpp b/src/settings/convergenceSettings.cpp index 5d736558b..de51171d4 100644 --- a/src/settings/convergenceSettings.cpp +++ b/src/settings/convergenceSettings.cpp @@ -25,7 +25,7 @@ #include "exceptions.hpp" using namespace settings; -using namespace customException; +using namespace exc; /** * @brief returns the convergence strategy as string @@ -321,4 +321,4 @@ std::optional ConvSettings::getEnConvStrategy() ConvStrategy ConvSettings::getDefaultEnergyConvStrategy() { return getConvStrategy(_defaultEnergyConvStrategy); -} \ No newline at end of file +} diff --git a/src/settings/optimizerSettings.cpp b/src/settings/optimizerSettings.cpp index 52d46e20f..34b82b557 100644 --- a/src/settings/optimizerSettings.cpp +++ b/src/settings/optimizerSettings.cpp @@ -29,7 +29,7 @@ using namespace settings; using namespace utilities; -using namespace customException; +using namespace exc; /** * @brief returns the optimizer as string diff --git a/src/settings/potentialSettings.cpp b/src/settings/potentialSettings.cpp index 97c00a4f7..007ef0f7e 100644 --- a/src/settings/potentialSettings.cpp +++ b/src/settings/potentialSettings.cpp @@ -27,7 +27,7 @@ using namespace settings; using namespace utilities; -using namespace customException; +using namespace exc; /** * @brief return string of nonCoulombType @@ -289,4 +289,4 @@ double PotentialSettings::getReactionFieldEpsilon() * * @return double */ -double PotentialSettings::getWolfParameter() { return _wolfParameter; } \ No newline at end of file +double PotentialSettings::getWolfParameter() { return _wolfParameter; } diff --git a/src/settings/qmSettings.cpp b/src/settings/qmSettings.cpp index 9e5d7d537..33aeec519 100644 --- a/src/settings/qmSettings.cpp +++ b/src/settings/qmSettings.cpp @@ -36,7 +36,7 @@ using settings::QMMethod; using settings::QMSettings; using settings::SlakosType; using settings::XtbMethod; -using namespace customException; +using namespace exc; using namespace utilities; namespace diff --git a/src/settings/waterModelSettings.cpp b/src/settings/waterModelSettings.cpp index f09bad8ce..49090836a 100644 --- a/src/settings/waterModelSettings.cpp +++ b/src/settings/waterModelSettings.cpp @@ -29,7 +29,7 @@ using namespace settings; using namespace utilities; -using namespace customException; +using namespace exc; /******************** * standard getters * diff --git a/src/setup/hybridSetup.cpp b/src/setup/hybridSetup.cpp index c92b8b3df..55fbe4b27 100644 --- a/src/setup/hybridSetup.cpp +++ b/src/setup/hybridSetup.cpp @@ -35,7 +35,7 @@ using setup::HybridSetup; using namespace settings; using namespace engine; -using namespace customException; +using namespace exc; /** * @brief wrapper to build HybridSetup object and call setup @@ -81,7 +81,7 @@ void HybridSetup::setup() /** * @brief Check if chosen QM method is available for hybrid type calculations * - * @throws customException::InputFileException if the QM method is not supported + * @throws exc::InputFileException if the QM method is not supported * for hybrid type calculations */ void HybridSetup::validateQMMethod() @@ -170,13 +170,13 @@ void HybridSetup::setupForcedOuterList() /** * @brief Validate zone radii configuration for hybrid calculations * - * @throws customException::InputFileException if the core radius is larger than + * @throws exc::InputFileException if the core radius is larger than * the layer radius - * @throws customException::InputFileException if the smoothing region is too + * @throws exc::InputFileException if the smoothing region is too * thick for the chosen combinatin of core and layer radius - * @throws customException::InputFileException if the layer radius exceeds one + * @throws exc::InputFileException if the layer radius exceeds one quarter of the smallest box dimension (minimum image convention) - * @throws customException::InputFileException if the sum of layer radius and + * @throws exc::InputFileException if the sum of layer radius and point charge thickness exceeds three quarters of the smallest box dimension (includes point charges from beyond immediate neighboring cells) */ @@ -251,7 +251,7 @@ void HybridSetup::checkZoneRadii() * calculations where MM charges are requested (qm_charges = mm) but QM atoms * (moltype 0) are present in the system. * - * @throws customException::InputFileException if MM charges are requested but + * @throws exc::InputFileException if MM charges are requested but * atoms without moltype are present in the simulation box */ void HybridSetup::validateQMChargeSettings() diff --git a/src/setup/optimizerSetup.cpp b/src/setup/optimizerSetup.cpp index 1b19538d3..c18b0dbb7 100644 --- a/src/setup/optimizerSetup.cpp +++ b/src/setup/optimizerSetup.cpp @@ -41,7 +41,7 @@ using setup::OptimizerSetup; using namespace settings; -using namespace customException; +using namespace exc; using namespace defaults; using namespace engine; using namespace opt; diff --git a/src/setup/potentialSetup.cpp b/src/setup/potentialSetup.cpp index 887067f4d..c5473415e 100644 --- a/src/setup/potentialSetup.cpp +++ b/src/setup/potentialSetup.cpp @@ -43,7 +43,7 @@ using namespace setup; using namespace potential; using namespace engine; using namespace settings; -using namespace customException; +using namespace exc; /** * @brief wrapper to create PotentialSetup object and call setup diff --git a/src/setup/qmSetup.cpp b/src/setup/qmSetup.cpp index 2e6af6ec6..6b9a9666e 100644 --- a/src/setup/qmSetup.cpp +++ b/src/setup/qmSetup.cpp @@ -42,7 +42,7 @@ using namespace settings; using namespace engine; using namespace QM; using namespace utilities; -using namespace customException; +using namespace exc; using namespace references; /** diff --git a/src/setup/ringPolymerSetup.cpp b/src/setup/ringPolymerSetup.cpp index ace187775..409d3c982 100644 --- a/src/setup/ringPolymerSetup.cpp +++ b/src/setup/ringPolymerSetup.cpp @@ -40,7 +40,7 @@ using setup::RingPolymerSetup; using namespace engine; using namespace settings; -using namespace customException; +using namespace exc; using namespace input::ringPolymer; using namespace maxwellBoltzmann; diff --git a/src/setup/setup.cpp b/src/setup/setup.cpp index 803e3d15a..1b3843148 100644 --- a/src/setup/setup.cpp +++ b/src/setup/setup.cpp @@ -153,7 +153,7 @@ void setup::setupEngine(Engine& engine) } case IntegratorType::NONE: { - throw customException::InputFileException( + throw exc::InputFileException( "Integrator is not set for MD simulation - please set it " "in the input file" ); diff --git a/src/setup/simulationBoxSetup.cpp b/src/setup/simulationBoxSetup.cpp index adc47c74b..b929a185a 100644 --- a/src/setup/simulationBoxSetup.cpp +++ b/src/setup/simulationBoxSetup.cpp @@ -52,7 +52,7 @@ using namespace engine; using namespace settings; using namespace utilities; using namespace constants; -using namespace customException; +using namespace exc; using namespace maxwellBoltzmann; using namespace output; diff --git a/src/setup/thermostatSetup.cpp b/src/setup/thermostatSetup.cpp index 762e611fa..96e83d809 100644 --- a/src/setup/thermostatSetup.cpp +++ b/src/setup/thermostatSetup.cpp @@ -43,7 +43,7 @@ using namespace setup; using namespace settings; using namespace engine; using namespace thermostat; -using namespace customException; +using namespace exc; using namespace constants; /** diff --git a/src/setup/waterModelSetup.cpp b/src/setup/waterModelSetup.cpp index cc6de3e98..a62e59588 100644 --- a/src/setup/waterModelSetup.cpp +++ b/src/setup/waterModelSetup.cpp @@ -46,7 +46,7 @@ using namespace constants; using namespace constraints; -using namespace customException; +using namespace exc; using namespace engine; using namespace references; using namespace settings; diff --git a/src/thermostat/berendsenThermostat.cpp b/src/thermostat/berendsenThermostat.cpp index 166464c0f..385b5bd2c 100644 --- a/src/thermostat/berendsenThermostat.cpp +++ b/src/thermostat/berendsenThermostat.cpp @@ -33,7 +33,7 @@ #include "timingsSettings.hpp" // for TimingsSettings using thermostat::BerendsenThermostat; -using namespace customException; +using namespace exc; using namespace settings; using namespace molsys; using namespace physicalData; diff --git a/src/thermostat/velocityRescalingThermostat.cpp b/src/thermostat/velocityRescalingThermostat.cpp index cb19b8075..839f0c8c3 100644 --- a/src/thermostat/velocityRescalingThermostat.cpp +++ b/src/thermostat/velocityRescalingThermostat.cpp @@ -33,7 +33,7 @@ #include "timingsSettings.hpp" // for TimingsSettings using thermostat::VelocityRescalingThermostat; -using namespace customException; +using namespace exc; using namespace settings; using namespace molsys; using namespace physicalData; diff --git a/src/timings/timer.cpp b/src/timings/timer.cpp index eae5f378a..43fba500b 100644 --- a/src/timings/timer.cpp +++ b/src/timings/timer.cpp @@ -27,7 +27,7 @@ #include "exceptions.hpp" using namespace timings; -using namespace customException; +using namespace exc; /** * @brief Construct a new Timer:: Timer object @@ -120,7 +120,7 @@ void Timer::stopTimingsSection() const auto index = findTimingsSectionIndex(getTimerName()); if (index == _timingDetails.size()) - throw CustomException("Timer not found"); + throw TimerException("Timer not found"); _timingDetails[index].endTimer(); } @@ -134,7 +134,7 @@ void Timer::stopTimingsSection(const std::string_view name) const auto index = findTimingsSectionIndex(name); if (index == _timingDetails.size()) - throw CustomException("Timer not found"); + throw TimerException("Timer not found"); _timingDetails[index].endTimer(); } @@ -189,7 +189,7 @@ TimingsSection Timer::getTimingsSection(const std::string_view name) const const auto index = findTimingsSectionIndex(name); if (index == _timingDetails.size()) - throw CustomException("Timer not found"); + throw TimerException("Timer not found"); return _timingDetails[index]; } diff --git a/src/utilities/stringUtilities.cpp b/src/utilities/stringUtilities.cpp index 3696f6483..6aaae0042 100644 --- a/src/utilities/stringUtilities.cpp +++ b/src/utilities/stringUtilities.cpp @@ -39,7 +39,7 @@ #include "exceptions.hpp" -using namespace customException; +using namespace exc; using std::views::split; using std::views::transform; @@ -295,7 +295,7 @@ void utilities::addSpaces( else { - throw customException::InputFileException( + throw exc::InputFileException( std::format( R"(Missing "{}" in command "{}" in line {})", stringToReplace, diff --git a/tests/src/QM/testExternalQMRunner.cpp b/tests/src/QM/testExternalQMRunner.cpp index a9193f9f7..5465d2f37 100644 --- a/tests/src/QM/testExternalQMRunner.cpp +++ b/tests/src/QM/testExternalQMRunner.cpp @@ -43,7 +43,7 @@ #include "stringUtilities.hpp" #include "turbomoleRunner.hpp" -using customException::QMRunnerException; +using exc::QMRunnerException; using molsys::Atom; using molsys::Periodicity; using molsys::SimulationBox; diff --git a/tests/src/constraints/testConstraints.cpp b/tests/src/constraints/testConstraints.cpp index 1ad1bbe62..9114ef503 100644 --- a/tests/src/constraints/testConstraints.cpp +++ b/tests/src/constraints/testConstraints.cpp @@ -109,7 +109,7 @@ TEST_F(TestConstraints, applyShakeNotConverged) EXPECT_THROW_MSG( _constraints->applyShake(*_box), - customException::ShakeException, + exc::ShakeException, "Shake algorithm did not converge for 2 bonds." ); } @@ -175,7 +175,7 @@ TEST_F(TestConstraints, applyRattleNotConverged) EXPECT_THROW_MSG( _constraints->applyRattle(*_box), - customException::ShakeException, + exc::ShakeException, "Rattle algorithm did not converge for 2 bonds." ); } diff --git a/tests/src/constraints/testMShake.cpp b/tests/src/constraints/testMShake.cpp index eb9e6e0b9..69859deb6 100644 --- a/tests/src/constraints/testMShake.cpp +++ b/tests/src/constraints/testMShake.cpp @@ -201,5 +201,5 @@ TEST(TestMShake, applyMShakeThrowsWhenIterationLimitTooSmall) settings::ConstraintSettings::setMShakeMaxIter(1); settings::ConstraintSettings::setMShakeTolerance(-1.0); - EXPECT_THROW(mShake.applyMShake(simBox), customException::MShakeException); + EXPECT_THROW(mShake.applyMShake(simBox), exc::MShakeException); } diff --git a/tests/src/exceptions/testColorExceptions.cpp b/tests/src/exceptions/testColorExceptions.cpp index b9f72d85d..d6c703417 100644 --- a/tests/src/exceptions/testColorExceptions.cpp +++ b/tests/src/exceptions/testColorExceptions.cpp @@ -25,9 +25,9 @@ #include // for allocator, string #include // for string_view -#include "color.hpp" // for Code -#include "exceptions.hpp" // for CustomException -#include "gtest/gtest.h" // for Message, TestPartResult +#include "baseException.hpp" +#include "color.hpp" // for Code +#include "gtest/gtest.h" // for Message, TestPartResult /** * @brief tests colorful output for FG_RED @@ -36,7 +36,7 @@ TEST(TestColor, redException) { testing::internal::CaptureStdout(); - auto customException = customException::CustomException("test"); + auto customException = exc::BaseException("test"); customException.colorfulOutput(Color::FG_RED, "test"); std::string output = testing::internal::GetCapturedStdout(); EXPECT_STREQ(output.c_str(), "\033[31mtest\033[39m\n"); @@ -49,8 +49,8 @@ TEST(TestColor, redException) TEST(TestColor, orangeException) { testing::internal::CaptureStdout(); - auto customException = customException::CustomException("test"); + auto customException = exc::BaseException("test"); customException.colorfulOutput(Color::FG_ORANGE, "test"); std::string output = testing::internal::GetCapturedStdout(); EXPECT_STREQ(output.c_str(), "\033[33mtest\033[39m\n"); -} \ No newline at end of file +} diff --git a/tests/src/exceptions/testExceptions.cpp b/tests/src/exceptions/testExceptions.cpp index c91bb33a3..4a0a2d4ef 100644 --- a/tests/src/exceptions/testExceptions.cpp +++ b/tests/src/exceptions/testExceptions.cpp @@ -36,8 +36,8 @@ TEST(TestExceptions, inputFileException) { EXPECT_THROW_MSG( - throw customException::InputFileException("test"), - customException::InputFileException, + throw exc::InputFileException("test"), + exc::InputFileException, "test" ); } @@ -47,7 +47,7 @@ TEST(TestExceptions, inputFileException) */ TEST(TestExceptions, sourceLine) { - auto exception = customException::InputFileException("test", 12); + auto exception = exc::InputFileException("test", 12); EXPECT_EQ(exception.getLineNumber(), std::optional(12)); @@ -62,8 +62,8 @@ TEST(TestExceptions, sourceLine) TEST(TestExceptions, rstFileException) { EXPECT_THROW_MSG( - throw customException::RstFileException("test"), - customException::RstFileException, + throw exc::RstFileException("test"), + exc::RstFileException, "test" ); } @@ -75,8 +75,8 @@ TEST(TestExceptions, rstFileException) TEST(TestExceptions, UserInputException) { EXPECT_THROW_MSG( - throw customException::UserInputException("test"), - customException::UserInputException, + throw exc::UserInputException("test"), + exc::UserInputException, "test" ); } @@ -88,8 +88,8 @@ TEST(TestExceptions, UserInputException) TEST(TestExceptions, molDescriptorException) { EXPECT_THROW_MSG( - throw customException::MolDescriptorException("test"), - customException::MolDescriptorException, + throw exc::MolDescriptorException("test"), + exc::MolDescriptorException, "test" ); } @@ -101,8 +101,8 @@ TEST(TestExceptions, molDescriptorException) TEST(TestExceptions, userInputExceptionWarning) { EXPECT_THROW_MSG( - throw customException::UserInputExceptionWarning("test"), - customException::UserInputExceptionWarning, + throw exc::UserInputExceptionWarning("test"), + exc::UserInputExceptionWarning, "test" ); } @@ -114,8 +114,8 @@ TEST(TestExceptions, userInputExceptionWarning) TEST(TestExceptions, guffDatException) { EXPECT_THROW_MSG( - throw customException::GuffDatException("test"), - customException::GuffDatException, + throw exc::GuffDatException("test"), + exc::GuffDatException, "test" ); } @@ -127,8 +127,8 @@ TEST(TestExceptions, guffDatException) TEST(TestExceptions, topologyException) { EXPECT_THROW_MSG( - throw customException::TopologyException("test"), - customException::TopologyException, + throw exc::TopologyException("test"), + exc::TopologyException, "test" ); } @@ -140,8 +140,8 @@ TEST(TestExceptions, topologyException) TEST(TestExceptions, parameterFileException) { EXPECT_THROW_MSG( - throw customException::ParameterFileException("test"), - customException::ParameterFileException, + throw exc::ParameterFileException("test"), + exc::ParameterFileException, "test" ); } @@ -153,8 +153,8 @@ TEST(TestExceptions, parameterFileException) TEST(TestExceptions, manostatException) { EXPECT_THROW_MSG( - throw customException::ManostatException("test"), - customException::ManostatException, + throw exc::ManostatException("test"), + exc::ManostatException, "test" ); } @@ -166,8 +166,8 @@ TEST(TestExceptions, manostatException) TEST(TestExceptions, intraNonBondedException) { EXPECT_THROW_MSG( - throw customException::IntraNonBondedException("test"), - customException::IntraNonBondedException, + throw exc::IntraNonBondedException("test"), + exc::IntraNonBondedException, "test" ); } @@ -179,8 +179,8 @@ TEST(TestExceptions, intraNonBondedException) TEST(TestExceptions, shakeException) { EXPECT_THROW_MSG( - throw customException::ShakeException("test"), - customException::ShakeException, + throw exc::ShakeException("test"), + exc::ShakeException, "test" ); } @@ -192,8 +192,8 @@ TEST(TestExceptions, shakeException) TEST(TestExceptions, cellListException) { EXPECT_THROW_MSG( - throw customException::CellListException("test"), - customException::CellListException, + throw exc::CellListException("test"), + exc::CellListException, "test" ); } @@ -205,8 +205,8 @@ TEST(TestExceptions, cellListException) TEST(TestExceptions, ringPolymerRestartFileException) { EXPECT_THROW_MSG( - throw customException::RingPolymerRestartFileException("test"), - customException::RingPolymerRestartFileException, + throw exc::RingPolymerRestartFileException("test"), + exc::RingPolymerRestartFileException, "test" ); } @@ -218,8 +218,8 @@ TEST(TestExceptions, ringPolymerRestartFileException) TEST(TestExceptions, qmRunnerException) { EXPECT_THROW_MSG( - throw customException::QMRunnerException("test"), - customException::QMRunnerException, + throw exc::QMRunnerException("test"), + exc::QMRunnerException, "test" ); } @@ -227,8 +227,8 @@ TEST(TestExceptions, qmRunnerException) TEST(TestExceptions, hybridConfiguratorException) { EXPECT_THROW_MSG( - throw customException::HybridConfiguratorException("test"), - customException::HybridConfiguratorException, + throw exc::HybridConfiguratorException("test"), + exc::HybridConfiguratorException, "test" ); } @@ -236,8 +236,8 @@ TEST(TestExceptions, hybridConfiguratorException) TEST(TestExceptions, hybridMDEngineException) { EXPECT_THROW_MSG( - throw customException::HybridMDEngineException("test"), - customException::HybridMDEngineException, + throw exc::HybridMDEngineException("test"), + exc::HybridMDEngineException, "test" ); } diff --git a/tests/src/forceField/testForceField.cpp b/tests/src/forceField/testForceField.cpp index b17c08b12..ee5d5a244 100644 --- a/tests/src/forceField/testForceField.cpp +++ b/tests/src/forceField/testForceField.cpp @@ -81,7 +81,7 @@ TEST_F(TestForceField, findBondTypeByIdNotFoundError) EXPECT_THROW_MSG( const auto _ = forceField.findBondTypeById(BondId{0}), - customException::TopologyException, + exc::TopologyException, "Bond type with id " + BondId(0).toString() + " not found." ); } @@ -110,7 +110,7 @@ TEST_F(TestForceField, findAngleTypeByIdNotFoundError) EXPECT_THROW_MSG( const auto _ = forceField.findAngleTypeById(AngleId{0}), - customException::TopologyException, + exc::TopologyException, "Angle type with id " + AngleId(0).toString() + " not found." ); } @@ -139,7 +139,7 @@ TEST_F(TestForceField, findDihedralTypeByIdNotFoundError) EXPECT_THROW_MSG( const auto _ = forceField.findDihedralTypeById(DihedralId{0}), - customException::TopologyException, + exc::TopologyException, "Dihedral type with id " + DihedralId(0).toString() + " not found." ); } @@ -172,7 +172,7 @@ TEST_F(TestForceField, findImproperDihedralTypeByIdNotFoundError) EXPECT_THROW_MSG( const auto _ = forceField.findImproperTypeById(DihedralId{0}), - customException::TopologyException, + exc::TopologyException, "Improper dihedral type with id " + DihedralId(0).toString() + " not found." ); diff --git a/tests/src/hybridConfigurator/testHybridConfigurator.cpp b/tests/src/hybridConfigurator/testHybridConfigurator.cpp index 3f3d831d7..5a6804335 100644 --- a/tests/src/hybridConfigurator/testHybridConfigurator.cpp +++ b/tests/src/hybridConfigurator/testHybridConfigurator.cpp @@ -36,7 +36,7 @@ #include "vectorNear.hpp" // for EXPECT_VECTOR_NEAR using namespace configurator; -using namespace customException; +using namespace exc; using namespace linearAlgebra; using namespace pq; using namespace settings; diff --git a/tests/src/input/inputFileParsing/testCelllistParser.cpp b/tests/src/input/inputFileParsing/testCelllistParser.cpp index 75e942e68..b5aa5e483 100644 --- a/tests/src/input/inputFileParsing/testCelllistParser.cpp +++ b/tests/src/input/inputFileParsing/testCelllistParser.cpp @@ -54,7 +54,7 @@ TEST_F(TestInputFileReader, parseCellListActivated) lineElements = {"cell-list", "=", "notValid"}; EXPECT_THROW_MSG( parser.parseCellListActivated(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Invalid cell-list keyword \"notValid\" at line 0 " "in input file\n" "Possible keywords are \"on\" and \"off\"" @@ -80,7 +80,7 @@ TEST_F(TestInputFileReader, numberOfCells) lineElements = {"cell-number", "=", "0"}; EXPECT_THROW_MSG( parser.parseNumberOfCells(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Number of cells must be positive - number of cells = 0" ); } diff --git a/tests/src/input/inputFileParsing/testConstraintsParser.cpp b/tests/src/input/inputFileParsing/testConstraintsParser.cpp index 80c5fc5e1..9cc2f1c28 100644 --- a/tests/src/input/inputFileParsing/testConstraintsParser.cpp +++ b/tests/src/input/inputFileParsing/testConstraintsParser.cpp @@ -82,7 +82,7 @@ TEST_F(TestInputFileReader, testParseShakeActivated) lineElements = {"shake", "=", "1"}; EXPECT_THROW_MSG( parser.parseShakeActivated(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Invalid shake keyword \"1\" at line 0 in input file\n" "Possible keywords are: \"on\", \"off\", \"shake\", \"mshake\"" ); @@ -104,14 +104,14 @@ TEST_F(TestInputFileReader, testParseShakeTolerance) lineElements = {"shake-tolerance", "=", "-0.0001"}; EXPECT_THROW_MSG( parser.parseShakeTolerance(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Shake tolerance must be positive" ); lineElements = {"shake-tolerance", "=", "0"}; EXPECT_THROW_MSG( parser.parseShakeTolerance(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Shake tolerance must be positive" ); } @@ -132,14 +132,14 @@ TEST_F(TestInputFileReader, testParseShakeIteration) lineElements = {"shake-iter", "=", "-100"}; EXPECT_THROW_MSG( parser.parseShakeIteration(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Maximum shake iterations must be positive" ); lineElements = {"shake-iter", "=", "0"}; EXPECT_THROW_MSG( parser.parseShakeIteration(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Maximum shake iterations must be positive" ); } @@ -160,14 +160,14 @@ TEST_F(TestInputFileReader, testParseRattleTolerance) lineElements = {"rattle-tolerance", "=", "-0.0001"}; EXPECT_THROW_MSG( parser.parseRattleTolerance(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Rattle tolerance must be positive" ); lineElements = {"rattle-tolerance", "=", "0"}; EXPECT_THROW_MSG( parser.parseRattleTolerance(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Rattle tolerance must be positive" ); } @@ -188,14 +188,14 @@ TEST_F(TestInputFileReader, testParseRattleIteration) lineElements = {"rattle-iter", "=", "-100"}; EXPECT_THROW_MSG( parser.parseRattleIteration(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Maximum rattle iterations must be positive" ); lineElements = {"rattle-iter", "=", "0"}; EXPECT_THROW_MSG( parser.parseRattleIteration(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Maximum rattle iterations must be positive" ); } @@ -216,14 +216,14 @@ TEST_F(TestInputFileReader, testParseMShakeTolerance) lineElements = {"mshake-tolerance", "=", "-0.0001"}; EXPECT_THROW_MSG( parser.parseMShakeTolerance(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "MShake tolerance must be positive" ); lineElements = {"mshake-tolerance", "=", "0"}; EXPECT_THROW_MSG( parser.parseMShakeTolerance(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "MShake tolerance must be positive" ); } @@ -244,14 +244,14 @@ TEST_F(TestInputFileReader, testParseMShakeIteration) lineElements = {"mshake-iter", "=", "-100"}; EXPECT_THROW_MSG( parser.parseMShakeIteration(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Maximum MShake iterations must be positive" ); lineElements = {"mshake-iter", "=", "0"}; EXPECT_THROW_MSG( parser.parseMShakeIteration(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Maximum MShake iterations must be positive" ); } @@ -280,7 +280,7 @@ TEST_F(TestInputFileReader, testParseDistanceConstraintsActivated) lineElements = {"distance-constraints", "=", "1"}; EXPECT_THROW_MSG( parser.parseDistanceConstraintActivated(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Invalid distance-constraints keyword \"1\" " "at line 0 in input file\n" "Possible keywords are \"on\" and \"off\"" diff --git a/tests/src/input/inputFileParsing/testConvergenceParser.cpp b/tests/src/input/inputFileParsing/testConvergenceParser.cpp index 950a48be9..82f1aad7a 100644 --- a/tests/src/input/inputFileParsing/testConvergenceParser.cpp +++ b/tests/src/input/inputFileParsing/testConvergenceParser.cpp @@ -31,7 +31,7 @@ using namespace input; using namespace settings; -using namespace customException; +using namespace exc; TEST_F(TestInputFileReader, parserEnergyConvergenceStrategy) { diff --git a/tests/src/input/inputFileParsing/testCoulombLongRangeParser.cpp b/tests/src/input/inputFileParsing/testCoulombLongRangeParser.cpp index 248256584..ad63de96f 100644 --- a/tests/src/input/inputFileParsing/testCoulombLongRangeParser.cpp +++ b/tests/src/input/inputFileParsing/testCoulombLongRangeParser.cpp @@ -31,7 +31,7 @@ using namespace input; using namespace settings; -using namespace customException; +using namespace exc; /** * @brief tests parsing the "long-range" command diff --git a/tests/src/input/inputFileParsing/testFilesParser.cpp b/tests/src/input/inputFileParsing/testFilesParser.cpp index 94df22fae..b547cbc04 100644 --- a/tests/src/input/inputFileParsing/testFilesParser.cpp +++ b/tests/src/input/inputFileParsing/testFilesParser.cpp @@ -52,7 +52,7 @@ TEST_F(TestInputFileReader, testParseTopologyFilename) }; EXPECT_THROW_MSG( parser.parseTopologyFilename(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Cannot open topology file - filename = topology.txt" ); @@ -82,7 +82,7 @@ TEST_F(TestInputFileReader, testParseParameterFilename) }; EXPECT_THROW_MSG( parser.parseParameterFilename(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Cannot open parameter file - filename = param.txt" ); @@ -112,7 +112,7 @@ TEST_F(TestInputFileReader, parseIntraNonBondedFile) }; EXPECT_THROW_MSG( parser.parseIntraNonBondedFile(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Intra non bonded file \"intra.dat\" File not found" ); @@ -142,7 +142,7 @@ TEST_F(TestInputFileReader, testStartFileName) }; EXPECT_THROW_MSG( parser.parseStartFilename(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Cannot open start file - filename = start.xyz" ); @@ -168,7 +168,7 @@ TEST_F(TestInputFileReader, testMoldescriptorFileName) }; EXPECT_THROW_MSG( parser.parseMoldescriptorFilename(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Cannot open moldescriptor file - filename = \"moldescriptor.txt\" - " "file not found" ); @@ -195,7 +195,7 @@ TEST_F(TestInputFileReader, testGuffPath) const std::vector lineElements = {"guff_path", "=", "guff"}; EXPECT_THROW_MSG( parser.parseGuffPath(lineElements, 0), - customException::InputFileException, + exc::InputFileException, R"(The "guff_path" keyword id deprecated. Please use "guffdat_file" instead.)" ); } @@ -210,7 +210,7 @@ TEST_F(TestInputFileReader, guffDatFilename) std::vector lineElements = {"guffdat_file", "=", "guff.dat"}; EXPECT_THROW_MSG( parser.parseGuffDatFilename(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Cannot open guff file - filename = guff.dat" ); @@ -235,7 +235,7 @@ TEST_F(TestInputFileReader, testRpmdStartFileName) }; EXPECT_THROW_MSG( parser.parseRingPolymerStartFilename(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Cannot open ring polymer start file - filename = rpmd_start.xyz" ); @@ -261,7 +261,7 @@ TEST_F(TestInputFileReader, testMShakeFileName) EXPECT_THROW_MSG( parser.parseMShakeFilename(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Cannot open mshake file - filename = mshake.dat" ); @@ -287,7 +287,7 @@ TEST_F(TestInputFileReader, testDFTBFileName) EXPECT_THROW_MSG( parser.parseDFTBFilename(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Cannot open DFTB setup file - filename = dftb_in.template" ); @@ -313,7 +313,7 @@ TEST_F(TestInputFileReader, testTMFileName) EXPECT_THROW_MSG( parser.parseTMFilename(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Cannot open TURBOMOLE setup file - filename = tm_define.template" ); diff --git a/tests/src/input/inputFileParsing/testGeneralParser.cpp b/tests/src/input/inputFileParsing/testGeneralParser.cpp index f59254687..6b86248dd 100644 --- a/tests/src/input/inputFileParsing/testGeneralParser.cpp +++ b/tests/src/input/inputFileParsing/testGeneralParser.cpp @@ -90,7 +90,7 @@ TEST_F(TestInputFileReader, JobType) lineElements = {"jobtype", "=", "notValid"}; EXPECT_THROW_MSG( parser.parseJobTypeForEngine(lineElements, 0, engine), - customException::InputFileException, + exc::InputFileException, "Invalid jobtype \"notValid\" in input file - possible values are:\n" "- mm-opt\n" "- mm-hessian\n" @@ -126,7 +126,7 @@ TEST_F(TestInputFileReader, parseDimensionality) lineElements = {"dim", "=", "2"}; EXPECT_THROW_MSG( parser.parseDimensionality(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Invalid dimensionality \"2\" in input file\n" "Possible values are: 3, 3d" ); @@ -134,7 +134,7 @@ TEST_F(TestInputFileReader, parseDimensionality) lineElements = {"dim", "=", "1"}; EXPECT_THROW_MSG( parser.parseDimensionality(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Invalid dimensionality \"1\" in input file\n" "Possible values are: 3, 3d" ); @@ -142,7 +142,7 @@ TEST_F(TestInputFileReader, parseDimensionality) lineElements = {"dim", "=", "0"}; EXPECT_THROW_MSG( parser.parseDimensionality(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Invalid dimensionality \"0\" in input file\n" "Possible values are: 3, 3d" ); @@ -166,7 +166,7 @@ TEST_F(TestInputFileReader, parseFloatingPointType) lineElements = {"floatingPointType", "=", "notValid"}; EXPECT_THROW_MSG( parser.parseFloatingPointType(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Invalid floating point type \"notValid\" in input file\n" "Possible values are: float, double" ); @@ -205,7 +205,7 @@ TEST_F(TestInputFileReader, parseRandomSeed) }; EXPECT_THROW_MSG( parser.parseRandomSeed(lineElements, 0), - customException::InputFileException, + exc::InputFileException, std::format( "Random seed value \"{}\" is out of range.\n" "Must be an integer between \"0\" and \"{}\" (inclusive)", @@ -218,7 +218,7 @@ TEST_F(TestInputFileReader, parseRandomSeed) lineElements = {"random_seed", "=", "-1"}; EXPECT_THROW_MSG( parser.parseRandomSeed(lineElements, 0), - customException::InputFileException, + exc::InputFileException, std::format( "Random seed value \"{}\" is out of range.\n" "Must be an integer between \"0\" and \"{}\" (inclusive)", @@ -231,7 +231,7 @@ TEST_F(TestInputFileReader, parseRandomSeed) lineElements = {"random_seed", "=", "seed"}; EXPECT_THROW_MSG( parser.parseRandomSeed(lineElements, 0), - customException::InputFileException, + exc::InputFileException, std::format( "Random seed value \"{}\" is invalid.\n" "Must be an integer between \"0\" and \"{}\" (inclusive)", @@ -244,7 +244,7 @@ TEST_F(TestInputFileReader, parseRandomSeed) lineElements = {"random_seed", "=", "3.14159"}; EXPECT_THROW_MSG( parser.parseRandomSeed(lineElements, 0), - customException::InputFileException, + exc::InputFileException, std::format( "Random seed value \"{}\" is invalid.\n" "Must be an integer between \"0\" and \"{}\" (inclusive)", @@ -257,7 +257,7 @@ TEST_F(TestInputFileReader, parseRandomSeed) lineElements = {"random_seed", "=", "1e3"}; EXPECT_THROW_MSG( parser.parseRandomSeed(lineElements, 0), - customException::InputFileException, + exc::InputFileException, std::format( "Random seed value \"{}\" is invalid.\n" "Must be an integer between \"0\" and \"{}\" (inclusive)", @@ -270,7 +270,7 @@ TEST_F(TestInputFileReader, parseRandomSeed) lineElements = {"random_seed", "=", "+"}; EXPECT_THROW_MSG( parser.parseRandomSeed(lineElements, 0), - customException::InputFileException, + exc::InputFileException, std::format( "Random seed value \"{}\" is invalid.\n" "Must be an integer between \"0\" and \"{}\" (inclusive)", diff --git a/tests/src/input/inputFileParsing/testHessianParser.cpp b/tests/src/input/inputFileParsing/testHessianParser.cpp index 5aa467c70..fdeff28b6 100644 --- a/tests/src/input/inputFileParsing/testHessianParser.cpp +++ b/tests/src/input/inputFileParsing/testHessianParser.cpp @@ -64,7 +64,7 @@ TEST_F(TestInputFileReader, parseHessianDisplacement) EXPECT_THROW_MSG( parser.parseDisplacement(lineElements, 7), - customException::InputFileException, + exc::InputFileException, "Hessian displacement must be greater than 0 in input file at line 7" ); } @@ -89,7 +89,7 @@ TEST_F(TestInputFileReader, parseHessianBuilder) EXPECT_THROW_MSG( parser.parseBuilder(lineElements, 9), - customException::InputFileException, + exc::InputFileException, "Invalid hessian_builder \"unknown\" in input file at line 9 - " "possible values are: central, forward, five-point, analytic" ); diff --git a/tests/src/input/inputFileParsing/testHybridParser.cpp b/tests/src/input/inputFileParsing/testHybridParser.cpp index 4b4552ca1..9f04d3e50 100644 --- a/tests/src/input/inputFileParsing/testHybridParser.cpp +++ b/tests/src/input/inputFileParsing/testHybridParser.cpp @@ -35,7 +35,7 @@ using namespace input; using namespace settings; -using namespace customException; +using namespace exc; TEST_F(TestInputFileReader, parseInnerRegionCenter) { diff --git a/tests/src/input/inputFileParsing/testInputFileParser.cpp b/tests/src/input/inputFileParsing/testInputFileParser.cpp index 3908cb439..f8464eca4 100644 --- a/tests/src/input/inputFileParsing/testInputFileParser.cpp +++ b/tests/src/input/inputFileParsing/testInputFileParser.cpp @@ -47,14 +47,14 @@ TEST_F(TestInputFileReader, checkCommand) auto lineElements = std::vector{"test", "="}; ASSERT_THROW_MSG( checkCommand(lineElements, 1), - customException::InputFileException, + exc::InputFileException, "Invalid number of arguments at line 1 in input file" ); lineElements = std::vector{"test", "=", "test2", "tooMany"}; ASSERT_THROW_MSG( checkCommand(lineElements, 1), - customException::InputFileException, + exc::InputFileException, "Invalid number of arguments at line 1 in input file" ); @@ -74,7 +74,7 @@ TEST_F(TestInputFileReader, checkCommandArray) auto lineElements = std::vector{"test", "="}; ASSERT_THROW_MSG( checkCommandArray(lineElements, 1), - customException::InputFileException, + exc::InputFileException, "Invalid number of arguments at line 1 in input file" ); @@ -93,7 +93,7 @@ TEST_F(TestInputFileReader, equalSign) { ASSERT_THROW_MSG( checkEqualSign("a", 1), - customException::InputFileException, + exc::InputFileException, "Invalid command at line 1 in input file" ); diff --git a/tests/src/input/inputFileParsing/testIntegratorParser.cpp b/tests/src/input/inputFileParsing/testIntegratorParser.cpp index 47566e21e..427d5d515 100644 --- a/tests/src/input/inputFileParsing/testIntegratorParser.cpp +++ b/tests/src/input/inputFileParsing/testIntegratorParser.cpp @@ -50,7 +50,7 @@ TEST_F(TestInputFileReader, testParseIntegrator) lineElements = {"integrator", "=", "notValid"}; ASSERT_THROW_MSG( parser.parseIntegrator(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Invalid integrator \"notValid\" at line 0 in input file" ); } diff --git a/tests/src/input/inputFileParsing/testMMParser.cpp b/tests/src/input/inputFileParsing/testMMParser.cpp index d65688715..4f78fa95b 100644 --- a/tests/src/input/inputFileParsing/testMMParser.cpp +++ b/tests/src/input/inputFileParsing/testMMParser.cpp @@ -64,7 +64,7 @@ TEST_F(TestInputFileReader, testParseForceField) lineElements = {"forceField", "=", "notValid"}; ASSERT_THROW_MSG( parser.parseForceFieldType(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Invalid force-field keyword \"notValid\" at line 0 in input file\n" "Possible options are \"on\", \"off\" or \"bonded\"" ); @@ -111,7 +111,7 @@ TEST_F(TestInputFileReader, testParseNonCoulombType) lineElements = {"coulomb", "=", "notValid"}; EXPECT_THROW_MSG( parser.parseNonCoulombType(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Invalid nonCoulomb type \"notValid\" at line 0 in input file.\n" "Possible options are: lj, buck, morse and guff" ); diff --git a/tests/src/input/inputFileParsing/testManostatParser.cpp b/tests/src/input/inputFileParsing/testManostatParser.cpp index 4fd7be566..5ca0bc00a 100644 --- a/tests/src/input/inputFileParsing/testManostatParser.cpp +++ b/tests/src/input/inputFileParsing/testManostatParser.cpp @@ -72,21 +72,21 @@ TEST_F(TestInputFileReader, ParseRelaxationTimeManostat) lineElements = {"p_relaxation", "=", "-100.0"}; EXPECT_THROW_MSG( parser.parseManostatRelaxationTime(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Relaxation time of manostat must be finite and greater than zero" ); lineElements = {"p_relaxation", "=", "0"}; EXPECT_THROW_MSG( parser.parseManostatRelaxationTime(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Relaxation time of manostat must be finite and greater than zero" ); lineElements = {"p_relaxation", "=", "1e308"}; EXPECT_THROW_MSG( parser.parseManostatRelaxationTime(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Relaxation time of manostat is too large to represent in femtoseconds" ); } @@ -125,7 +125,7 @@ TEST_F(TestInputFileReader, ParseManostat) lineElements = {"manostat", "=", "notValid"}; EXPECT_THROW_MSG( parser.parseManostat(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Invalid manostat \"notValid\" at line 0 in input file.\n" "Possible options are: berendsen, stochastic_rescaling and none" ); @@ -147,7 +147,7 @@ TEST_F(TestInputFileReader, ParseCompressibility) lineElements = {"compressibility", "=", "-0.1"}; EXPECT_THROW_MSG( parser.parseCompressibility(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Compressibility must be finite and non-negative" ); @@ -250,7 +250,7 @@ TEST_F(TestInputFileReader, ParseIsotropy) lineElements = {"isotropy", "=", "notValid"}; EXPECT_THROW_MSG( parser.parseIsotropy(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Invalid isotropy \"notValid\" at line 0 in input file.\n" "Possible options are: isotropic, xy, xz, yz, anisotropic and " "full_anisotropic" diff --git a/tests/src/input/inputFileParsing/testOptParser.cpp b/tests/src/input/inputFileParsing/testOptParser.cpp index 2fe87d843..bdb34fbf6 100644 --- a/tests/src/input/inputFileParsing/testOptParser.cpp +++ b/tests/src/input/inputFileParsing/testOptParser.cpp @@ -31,7 +31,7 @@ using namespace input; using namespace settings; -using namespace customException; +using namespace exc; using namespace defaults; /** diff --git a/tests/src/input/inputFileParsing/testOutputParser.cpp b/tests/src/input/inputFileParsing/testOutputParser.cpp index c69e3387a..f9e88af77 100644 --- a/tests/src/input/inputFileParsing/testOutputParser.cpp +++ b/tests/src/input/inputFileParsing/testOutputParser.cpp @@ -51,7 +51,7 @@ TEST_F(TestInputFileReader, testParseOutputFreq) lineElements = {"outputfreq", "=", "-1000"}; EXPECT_THROW_MSG( parser.parseOutputFreq(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Output frequency cannot be negative - \"-1000\" at line 0 in input " "file" ); @@ -431,7 +431,7 @@ TEST_F(TestInputFileReader, parseOverwriteOutput) ASSERT_THROW_MSG( parser.parseOverwriteOutput({"overwrite_output", "=", "notABool"}, 0), - customException::InputFileException, + exc::InputFileException, "Invalid boolean option \"notABool\" for keyword \"overwrite_output\" " "in input file.\n" "Possible values are: on, yes, true, off, no, false." @@ -464,7 +464,7 @@ TEST_F(TestInputFileReader, parseIncludeOutputMetadata) {"include_output_metadata", "=", "notABool"}, 0 ), - customException::InputFileException, + exc::InputFileException, "Invalid boolean option \"notABool\" for keyword " "\"include_output_metadata\" in input file.\n" "Possible values are: on, yes, true, off, no, false." diff --git a/tests/src/input/inputFileParsing/testQMParser.cpp b/tests/src/input/inputFileParsing/testQMParser.cpp index eea7448b0..eb4942563 100644 --- a/tests/src/input/inputFileParsing/testQMParser.cpp +++ b/tests/src/input/inputFileParsing/testQMParser.cpp @@ -33,7 +33,7 @@ using namespace input; using namespace settings; -using namespace customException; +using namespace exc; TEST_F(TestInputFileReader, parseQMMethod) { diff --git a/tests/src/input/inputFileParsing/testResetKineticsParser.cpp b/tests/src/input/inputFileParsing/testResetKineticsParser.cpp index 269c8ac31..f2f29241c 100644 --- a/tests/src/input/inputFileParsing/testResetKineticsParser.cpp +++ b/tests/src/input/inputFileParsing/testResetKineticsParser.cpp @@ -49,7 +49,7 @@ TEST_F(TestInputFileReader, testParseNScale) lineElements = {"nscale", "=", "-1"}; EXPECT_THROW_MSG( parser.parseNScale(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Nscale must be positive" ); } @@ -69,7 +69,7 @@ TEST_F(TestInputFileReader, testParseFScale) lineElements = {"fscale", "=", "-1"}; EXPECT_THROW_MSG( parser.parseFScale(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Fscale must be positive" ); } @@ -89,7 +89,7 @@ TEST_F(TestInputFileReader, testParseNReset) lineElements = {"nreset", "=", "-1"}; EXPECT_THROW_MSG( parser.parseNReset(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Nreset must be positive" ); } @@ -109,7 +109,7 @@ TEST_F(TestInputFileReader, testParseFReset) lineElements = {"freset", "=", "-1"}; EXPECT_THROW_MSG( parser.parseFReset(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Freset must be positive" ); } @@ -129,7 +129,7 @@ TEST_F(TestInputFileReader, testParseNResetAngular) lineElements = {"nreset_angular", "=", "-1"}; EXPECT_THROW_MSG( parser.parseNResetAngular(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Nreset_angular must be positive" ); } @@ -149,7 +149,7 @@ TEST_F(TestInputFileReader, testParseFResetAngular) lineElements = {"freset_angular", "=", "-1"}; EXPECT_THROW_MSG( parser.parseFResetAngular(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Freset_angular must be positive" ); } diff --git a/tests/src/input/inputFileParsing/testRingPolymerParser.cpp b/tests/src/input/inputFileParsing/testRingPolymerParser.cpp index 990feda1b..62f915836 100644 --- a/tests/src/input/inputFileParsing/testRingPolymerParser.cpp +++ b/tests/src/input/inputFileParsing/testRingPolymerParser.cpp @@ -52,7 +52,7 @@ TEST_F(TestInputFileReader, testParseNumberOfReplicas) lineElements = {"rpmd_n_replica", "=", "1"}; EXPECT_THROW_MSG( parser.parseNumberOfBeads(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Number of beads must be at least 2 - in input file in line 0" ); } diff --git a/tests/src/input/inputFileParsing/testSimulationBoxParser.cpp b/tests/src/input/inputFileParsing/testSimulationBoxParser.cpp index 6df4a54d8..2b7ca6acc 100644 --- a/tests/src/input/inputFileParsing/testSimulationBoxParser.cpp +++ b/tests/src/input/inputFileParsing/testSimulationBoxParser.cpp @@ -52,14 +52,14 @@ TEST_F(TestInputFileReader, parseDensity) const std::vector lineElements2 = {"density", "=", "-1.0"}; EXPECT_THROW_MSG( parser.parseDensity(lineElements2, 0), - customException::InputFileException, + exc::InputFileException, "Density must be positive - density = -1" ); const std::vector zeroDensity = {"density", "=", "0"}; EXPECT_THROW_MSG( parser.parseDensity(zeroDensity, 0), - customException::InputFileException, + exc::InputFileException, "Density must be positive - density = 0" ); } @@ -80,7 +80,7 @@ TEST_F(TestInputFileReader, parseCoulombRadius) const std::vector lineElements2 = {"rcoulomb", "=", "-1.0"}; EXPECT_THROW_MSG( parser.parseCoulombRadius(lineElements2, 0), - customException::InputFileException, + exc::InputFileException, "Coulomb radius cutoff must be positive - \"-1.0\" at line 0 in input " "file" ); @@ -130,7 +130,7 @@ TEST_F(TestInputFileReader, parseInitVelocities) }; EXPECT_THROW_MSG( parser.parseInitializeVelocities(lineElements4, 0), - customException::InputFileException, + exc::InputFileException, "Invalid value for initialize velocities - \"wrongKeyword\" at line 0 " "in input file.\n" "Possible options are: true, false, force" diff --git a/tests/src/input/inputFileParsing/testThermostatParser.cpp b/tests/src/input/inputFileParsing/testThermostatParser.cpp index 637e8b06a..32c924e72 100644 --- a/tests/src/input/inputFileParsing/testThermostatParser.cpp +++ b/tests/src/input/inputFileParsing/testThermostatParser.cpp @@ -54,7 +54,7 @@ TEST_F(TestInputFileReader, testParseTemperature) lineElements = {"temp", "=", "-100.0"}; EXPECT_THROW_MSG( parser.parseTemperature(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Temperature must be finite and non-negative" ); @@ -79,14 +79,14 @@ TEST_F(TestInputFileReader, testParseRelaxationTime) lineElements = {"t_relaxation", "=", "-100.0"}; EXPECT_THROW_MSG( parser.parseThermostatRelaxationTime(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Relaxation time of thermostat must be finite and greater than zero" ); lineElements = {"t_relaxation", "=", "1e308"}; EXPECT_THROW_MSG( parser.parseThermostatRelaxationTime(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Relaxation time of thermostat is too large to represent in " "femtoseconds" ); @@ -94,7 +94,7 @@ TEST_F(TestInputFileReader, testParseRelaxationTime) lineElements = {"t_relaxation", "=", "0"}; EXPECT_THROW_MSG( parser.parseThermostatRelaxationTime(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Relaxation time of thermostat must be finite and greater than zero" ); } @@ -154,7 +154,7 @@ TEST_F(TestInputFileReader, testParseThermostat) lineElements = {"thermostat", "=", "notValid"}; EXPECT_THROW_MSG( parser.parseThermostat(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Invalid thermostat \"notValid\" at line 0 in input file.\n" "Possible options are: none, berendsen, " "velocity_rescaling, langevin, nh-chain" @@ -175,14 +175,14 @@ TEST_F(TestInputFileReader, testParseFriction) lineElements = {"friction", "=", "-0.1"}; EXPECT_THROW_MSG( parser.parseThermostatFriction(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Friction of thermostat must be finite and non-negative" ); lineElements = {"friction", "=", "1e308"}; EXPECT_THROW_MSG( parser.parseThermostatFriction(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Friction of thermostat is too large to represent in inverse seconds" ); } @@ -203,14 +203,14 @@ TEST_F(TestInputFileReader, testParseChainLength) lineElements = {"nh-chain-length", "=", "-10"}; EXPECT_THROW_MSG( parser.parseThermostatChainLength(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Chain length of thermostat must be greater than zero" ); lineElements = {"nh-chain-length", "=", "0"}; EXPECT_THROW_MSG( parser.parseThermostatChainLength(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Chain length of thermostat must be greater than zero" ); } @@ -232,14 +232,14 @@ TEST_F(TestInputFileReader, testParseCouplingFrequency) lineElements = {"coupling_frequency", "=", "-10"}; EXPECT_THROW_MSG( parser.parseThermostatCouplingFrequency(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Coupling frequency of thermostat must be finite and non-negative" ); lineElements = {"coupling_frequency", "=", "1e308"}; EXPECT_THROW_MSG( parser.parseThermostatCouplingFrequency(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Coupling frequency of thermostat is too large to represent in hertz" ); } @@ -260,7 +260,7 @@ TEST_F(TestInputFileReader, testParseTemperatureRampSteps) lineElements = {"temp_ramp_steps", "=", "-10"}; EXPECT_THROW_MSG( parser.parseTemperatureRampSteps(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Temperature ramp steps cannot be negative" ); } @@ -281,14 +281,14 @@ TEST_F(TestInputFileReader, testParseTemperatureRampFrequency) lineElements = {"temp_ramp_frequency", "=", "-10"}; EXPECT_THROW_MSG( parser.parseTemperatureRampFrequency(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Temperature ramp frequency must be greater than zero" ); lineElements = {"temp_ramp_frequency", "=", "0"}; EXPECT_THROW_MSG( parser.parseTemperatureRampFrequency(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Temperature ramp frequency must be greater than zero" ); } @@ -309,7 +309,7 @@ TEST_F(TestInputFileReader, testParseStartTemperature) lineElements = {"start_temperature", "=", "-10"}; EXPECT_THROW_MSG( parser.parseStartTemperature(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Start temperature must be finite and non-negative" ); @@ -333,7 +333,7 @@ TEST_F(TestInputFileReader, testParseEndTemperature) lineElements = {"end_temperature", "=", "-10"}; EXPECT_THROW_MSG( parser.parseEndTemperature(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "End temperature must be finite and non-negative" ); diff --git a/tests/src/input/inputFileParsing/testTimingsParser.cpp b/tests/src/input/inputFileParsing/testTimingsParser.cpp index c49ef97cb..d37cbe6ee 100644 --- a/tests/src/input/inputFileParsing/testTimingsParser.cpp +++ b/tests/src/input/inputFileParsing/testTimingsParser.cpp @@ -52,7 +52,7 @@ TEST_F(TestInputFileReader, testParseTimestep) lineElements = {"timestep", "=", "0"}; EXPECT_THROW_MSG( parser.parseTimeStep(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Time step must be finite and greater than zero" ); @@ -86,14 +86,14 @@ TEST_F(TestInputFileReader, testParseNumberOfSteps) lineElements = {"nsteps", "=", "-1"}; EXPECT_THROW_MSG( parser.parseNumberOfSteps(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Number of steps must be greater than zero" ); lineElements = {"nsteps", "=", "0"}; EXPECT_THROW_MSG( parser.parseNumberOfSteps(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Number of steps must be greater than zero" ); } diff --git a/tests/src/input/inputFileParsing/testVirialParser.cpp b/tests/src/input/inputFileParsing/testVirialParser.cpp index d4acc8e3b..8fe1fb96a 100644 --- a/tests/src/input/inputFileParsing/testVirialParser.cpp +++ b/tests/src/input/inputFileParsing/testVirialParser.cpp @@ -62,7 +62,7 @@ TEST_F(TestInputFileReader, testParseVirial) lineElements = {"virial", "=", "notValid"}; EXPECT_THROW_MSG( parser.parseVirial(lineElements, 0), - customException::InputFileException, + exc::InputFileException, "Invalid virial setting \"notValid\" at line 0 in input file.\n" "Possible options are: molecular or atomic" ); diff --git a/tests/src/input/parameterFileReader/testAngleTypesSection.cpp b/tests/src/input/parameterFileReader/testAngleTypesSection.cpp index ab8be0f4e..4dc490909 100644 --- a/tests/src/input/parameterFileReader/testAngleTypesSection.cpp +++ b/tests/src/input/parameterFileReader/testAngleTypesSection.cpp @@ -58,7 +58,7 @@ TEST_F(TestParameterFileSection, processSectionAngle) lineElements = {"1", "2", "1.0", "0"}; EXPECT_THROW( angleSection.processSection(lineElements, *_engine), - customException::ParameterFileException + exc::ParameterFileException ); } @@ -69,7 +69,7 @@ TEST_F(TestParameterFileSection, endedNormallyAngle) ASSERT_THROW_MSG( angleSection.endedNormally(false), - customException::ParameterFileException, + exc::ParameterFileException, "Parameter file angles section ended abnormally!" ); } diff --git a/tests/src/input/parameterFileReader/testBondTypesSection.cpp b/tests/src/input/parameterFileReader/testBondTypesSection.cpp index 2b3e90429..df3cebb59 100644 --- a/tests/src/input/parameterFileReader/testBondTypesSection.cpp +++ b/tests/src/input/parameterFileReader/testBondTypesSection.cpp @@ -52,13 +52,13 @@ TEST_F(TestParameterFileSection, processSectionBonds) lineElements = {"1", "2", "1.0", "0"}; EXPECT_THROW( bondSection.processSection(lineElements, *_engine), - customException::ParameterFileException + exc::ParameterFileException ); lineElements = {"1", "-2", "1.0"}; EXPECT_THROW( bondSection.processSection(lineElements, *_engine), - customException::ParameterFileException + exc::ParameterFileException ); } @@ -69,7 +69,7 @@ TEST_F(TestParameterFileSection, endedNormallyBonds) ASSERT_THROW_MSG( bondSection.endedNormally(false), - customException::ParameterFileException, + exc::ParameterFileException, "Parameter file bonds section ended abnormally!" ); } diff --git a/tests/src/input/parameterFileReader/testDihedralTypesSection.cpp b/tests/src/input/parameterFileReader/testDihedralTypesSection.cpp index 4d98fa951..1be47397a 100644 --- a/tests/src/input/parameterFileReader/testDihedralTypesSection.cpp +++ b/tests/src/input/parameterFileReader/testDihedralTypesSection.cpp @@ -56,13 +56,13 @@ TEST_F(TestParameterFileSection, processSectionDihedral) lineElements = {"1", "2", "1.0", "0", "2"}; EXPECT_THROW( dihedralSection.processSection(lineElements, *_engine), - customException::ParameterFileException + exc::ParameterFileException ); lineElements = {"1", "2", "-1.0", "3"}; EXPECT_THROW( dihedralSection.processSection(lineElements, *_engine), - customException::ParameterFileException + exc::ParameterFileException ); } @@ -73,7 +73,7 @@ TEST_F(TestParameterFileSection, endedNormallyDihedral) ASSERT_THROW_MSG( dihedralSection.endedNormally(false), - customException::ParameterFileException, + exc::ParameterFileException, "Parameter file dihedrals section ended abnormally!" ); } diff --git a/tests/src/input/parameterFileReader/testImproperDihedralTypesSection.cpp b/tests/src/input/parameterFileReader/testImproperDihedralTypesSection.cpp index c978ef6d4..d48e5a58f 100644 --- a/tests/src/input/parameterFileReader/testImproperDihedralTypesSection.cpp +++ b/tests/src/input/parameterFileReader/testImproperDihedralTypesSection.cpp @@ -60,13 +60,13 @@ TEST_F(TestParameterFileSection, processSectionImproperDihedral) lineElements = {"1", "2", "1.0", "0", "2"}; EXPECT_THROW( improperDihedralSection.processSection(lineElements, *_engine), - customException::ParameterFileException + exc::ParameterFileException ); lineElements = {"1", "2", "-1.0", "3"}; EXPECT_THROW( improperDihedralSection.processSection(lineElements, *_engine), - customException::ParameterFileException + exc::ParameterFileException ); } @@ -77,7 +77,7 @@ TEST_F(TestParameterFileSection, endedNormallyDihedral) ASSERT_THROW_MSG( improperDihedralSection.endedNormally(false), - customException::ParameterFileException, + exc::ParameterFileException, "Parameter file impropers section ended abnormally!" ); } diff --git a/tests/src/input/parameterFileReader/testJCouplingTypesSection.cpp b/tests/src/input/parameterFileReader/testJCouplingTypesSection.cpp index d5893e48e..5c5838956 100644 --- a/tests/src/input/parameterFileReader/testJCouplingTypesSection.cpp +++ b/tests/src/input/parameterFileReader/testJCouplingTypesSection.cpp @@ -31,7 +31,7 @@ #include "testParameterFileSection.hpp" using namespace input::parameterFile; -using namespace customException; +using namespace exc; TEST_F(TestParameterFileSection, jCouplingSectionKeyword) { diff --git a/tests/src/input/parameterFileReader/testNonCoulombicTypesSection.cpp b/tests/src/input/parameterFileReader/testNonCoulombicTypesSection.cpp index dc24aeda9..a57874c40 100644 --- a/tests/src/input/parameterFileReader/testNonCoulombicTypesSection.cpp +++ b/tests/src/input/parameterFileReader/testNonCoulombicTypesSection.cpp @@ -36,7 +36,7 @@ using namespace input::parameterFile; using namespace potential; -using namespace customException; +using namespace exc; using namespace settings; TEST_F(TestParameterFileSection, processSectionLennardJones) diff --git a/tests/src/input/parameterFileReader/testParameterFileReader.cpp b/tests/src/input/parameterFileReader/testParameterFileReader.cpp index ae1bae7f9..bdd76e78c 100644 --- a/tests/src/input/parameterFileReader/testParameterFileReader.cpp +++ b/tests/src/input/parameterFileReader/testParameterFileReader.cpp @@ -94,7 +94,7 @@ TEST_F(TestParameterFileReader, determineSection) EXPECT_THROW_MSG( [[maybe_unused]] const auto dummy = reader->determineSection({"N.A."}), - customException::ParameterFileException, + exc::ParameterFileException, "Unknown or already parsed keyword \"N.A.\" in parameter file" ); } @@ -151,7 +151,7 @@ TEST_F(TestParameterFileReader, readFileNameEmpty) settings::FileSettings::unsetIsParameterFileNameSet(); EXPECT_THROW_MSG( _parameterFileReader->read(), - customException::InputFileException, + exc::InputFileException, "Parameter file needed for requested simulation setup" ); } diff --git a/tests/src/input/parameterFileReader/testTypesSection.cpp b/tests/src/input/parameterFileReader/testTypesSection.cpp index 0d830da7b..2159df0d6 100644 --- a/tests/src/input/parameterFileReader/testTypesSection.cpp +++ b/tests/src/input/parameterFileReader/testTypesSection.cpp @@ -50,31 +50,31 @@ TEST_F(TestParameterFileSection, processSectionTypes) lineElements = {"1", "2", "1.0", "0", "s", "f", "0.23"}; EXPECT_THROW( typesSection.process(lineElements, *_engine), - customException::ParameterFileException + exc::ParameterFileException ); lineElements = {"1", "2", "1.0", "0", "s", "f", "0.23", "1.01"}; EXPECT_THROW( typesSection.process(lineElements, *_engine), - customException::ParameterFileException + exc::ParameterFileException ); lineElements = {"1", "2", "1.0", "0", "s", "f", "1.23", "0.01"}; EXPECT_THROW( typesSection.process(lineElements, *_engine), - customException::ParameterFileException + exc::ParameterFileException ); lineElements = {"1", "2", "1.0", "0", "s", "f", "-0.23", "0.01"}; EXPECT_THROW( typesSection.process(lineElements, *_engine), - customException::ParameterFileException + exc::ParameterFileException ); lineElements = {"1", "2", "1.0", "0", "s", "f", "0.23", "-0.01"}; EXPECT_THROW( typesSection.process(lineElements, *_engine), - customException::ParameterFileException + exc::ParameterFileException ); } @@ -85,7 +85,7 @@ TEST_F(TestParameterFileSection, endedNormallyTypes) ASSERT_THROW_MSG( typesSection.endedNormally(false), - customException::ParameterFileException, + exc::ParameterFileException, "Parameter file types section ended abnormally!" ); } @@ -99,4 +99,4 @@ TEST_F(TestParameterFileSection, dummyHeaderTest) auto typesSection = TypesSection(); auto lineElements = std::vector({"dummy"}); EXPECT_NO_THROW(typesSection.processHeader(lineElements, *_engine)); -} \ No newline at end of file +} diff --git a/tests/src/input/restartFileSection/testAtomSection.cpp b/tests/src/input/restartFileSection/testAtomSection.cpp index 47bfd1e54..3320acf59 100644 --- a/tests/src/input/restartFileSection/testAtomSection.cpp +++ b/tests/src/input/restartFileSection/testAtomSection.cpp @@ -71,7 +71,7 @@ TEST_F(TestAtomSection, numberOfArguments) auto line = std::vector(i); ASSERT_THROW_MSG( _section->process(line, *_engine), - customException::RstFileException, + exc::RstFileException, "Error in line 7: Atom section must have 6, 9, 12, 15, 18 or " "21 elements" ); @@ -89,7 +89,7 @@ TEST_F(TestAtomSection, moltypeNotFound) line[2] = "1"; ASSERT_THROW_MSG( _section->process(line, *_engine), - customException::RstFileException, + exc::RstFileException, "Molecule type 1 not found" ); } @@ -110,10 +110,7 @@ TEST_F(TestAtomSection, notEnoughElementsInLine) std::ifstream fp(filename); _section->_fp = &fp; - ASSERT_THROW( - _section->process(line, *_engine), - customException::RstFileException - ); + ASSERT_THROW(_section->process(line, *_engine), exc::RstFileException); line[2] = "1"; @@ -122,10 +119,7 @@ TEST_F(TestAtomSection, notEnoughElementsInLine) std::ifstream fp2(filename2); _section->_fp = &fp2; - ASSERT_THROW( - _section->process(line, *_engine), - customException::RstFileException - ); + ASSERT_THROW(_section->process(line, *_engine), exc::RstFileException); } TEST_F(TestAtomSection, numberOfArgumentsWithinMolecule) @@ -144,10 +138,7 @@ TEST_F(TestAtomSection, numberOfArgumentsWithinMolecule) std::ifstream fp(filename); _section->_fp = &fp; - ASSERT_THROW( - _section->process(line, *_engine), - customException::RstFileException - ); + ASSERT_THROW(_section->process(line, *_engine), exc::RstFileException); } TEST_F(TestAtomSection, testProcess) diff --git a/tests/src/input/restartFileSection/testBoxSection.cpp b/tests/src/input/restartFileSection/testBoxSection.cpp index c2b2a01b0..567b9a1f1 100644 --- a/tests/src/input/restartFileSection/testBoxSection.cpp +++ b/tests/src/input/restartFileSection/testBoxSection.cpp @@ -50,7 +50,7 @@ TEST_F(TestBoxSection, testNumberOfArguments) auto line = std::vector(i); ASSERT_THROW( _section->process(line, *_engine), - customException::RstFileException + exc::RstFileException ); } } @@ -85,22 +85,13 @@ TEST_F(TestBoxSection, testProcess) ); line = {"box", "1.0", "2.0", "-3.0", "90.0", "90.0", "90.0"}; - ASSERT_THROW( - _section->process(line, *_engine), - customException::RstFileException - ); + ASSERT_THROW(_section->process(line, *_engine), exc::RstFileException); line = {"box", "1.0", "2.0", "3.0", "90.0", "90.0", "190.0"}; - ASSERT_THROW( - _section->process(line, *_engine), - customException::RstFileException - ); + ASSERT_THROW(_section->process(line, *_engine), exc::RstFileException); line = {"box", "1.0", "2.0", "3.0", "90.0", "90.0", "-90.0"}; - ASSERT_THROW( - _section->process(line, *_engine), - customException::RstFileException - ); + ASSERT_THROW(_section->process(line, *_engine), exc::RstFileException); EXPECT_EQ(settings::SimulationBoxSettings::getBoxSet(), true); } diff --git a/tests/src/input/restartFileSection/testStepCountSection.cpp b/tests/src/input/restartFileSection/testStepCountSection.cpp index 995ef8847..531d877b8 100644 --- a/tests/src/input/restartFileSection/testStepCountSection.cpp +++ b/tests/src/input/restartFileSection/testStepCountSection.cpp @@ -53,7 +53,7 @@ TEST_F(TestStepCountSection, testNumberOfArguments) auto line = std::vector(i); ASSERT_THROW( _section->process(line, *_engine), - customException::RstFileException + exc::RstFileException ); } } @@ -63,10 +63,7 @@ TEST_F(TestStepCountSection, testNegativeStepCount) { auto line = std::vector(2); line[1] = "-1"; - ASSERT_THROW( - _section->process(line, *_engine), - customException::RstFileException - ); + ASSERT_THROW(_section->process(line, *_engine), exc::RstFileException); } TEST_F(TestStepCountSection, testProcess) diff --git a/tests/src/input/testCommandLineArgs.cpp b/tests/src/input/testCommandLineArgs.cpp index e874618f4..87247a8ff 100644 --- a/tests/src/input/testCommandLineArgs.cpp +++ b/tests/src/input/testCommandLineArgs.cpp @@ -174,7 +174,7 @@ TEST(TestCommandLineArgs, rejectDuplicateValidationFormat) EXPECT_THROW_MSG( commandLineArgs.parse(), - customException::UserInputException, + exc::UserInputException, "Unexpected argument: --format=json. Use PQ --help for usage." ); } @@ -189,7 +189,7 @@ TEST(TestCommandLineArgs, parseValidationWithoutInput) EXPECT_THROW_MSG( commandLineArgs.parse(), - customException::UserInputException, + exc::UserInputException, "No input file specified. Usage: PQ --validate " ); } @@ -204,7 +204,7 @@ TEST(TestCommandLineArgs, parseValidationFormatWithoutInput) EXPECT_THROW_MSG( commandLineArgs.parse(), - customException::UserInputException, + exc::UserInputException, "No input file specified. Usage: PQ --validate " ); } @@ -220,7 +220,7 @@ TEST(TestCommandLineArgs, parseValidationUnknownFormat) EXPECT_THROW_MSG( commandLineArgs.parse(), - customException::UserInputException, + exc::UserInputException, "Unexpected argument: --format=yaml. Use PQ --help for usage." ); } @@ -233,7 +233,7 @@ TEST(TestCommandLineArgs, parseValidationUnknownScope) EXPECT_THROW_MSG( commandLineArgs.parse(), - customException::UserInputException, + exc::UserInputException, "Unexpected argument: --scope=project. Use PQ --help for usage." ); } @@ -248,7 +248,7 @@ TEST(TestCommandLineArgs, parseUnknownOption) EXPECT_THROW_MSG( commandLineArgs.parse(), - customException::UserInputException, + exc::UserInputException, "Unknown option: --unknown. Use PQ --help for usage." ); } @@ -264,7 +264,7 @@ TEST(TestCommandLineArgs, parseMissingInputFile) EXPECT_THROW_MSG( commandLineArgs.parse(), - customException::UserInputException, + exc::UserInputException, "No input file specified. Usage: PQ " ); } @@ -279,7 +279,7 @@ TEST(TestCommandLineArgs, parseExtraArgument) EXPECT_THROW_MSG( commandLineArgs.parse(), - customException::UserInputException, + exc::UserInputException, "Unexpected argument: extra. Use PQ --help for usage." ); } diff --git a/tests/src/input/testGuffDatReader.cpp b/tests/src/input/testGuffDatReader.cpp index 05c4c1740..d25aeb68c 100644 --- a/tests/src/input/testGuffDatReader.cpp +++ b/tests/src/input/testGuffDatReader.cpp @@ -48,7 +48,7 @@ using namespace input::guffdat; using namespace potential; using namespace settings; using namespace constants; -using namespace customException; +using namespace exc; /** * @brief tests parseLine function of GuffDatReader diff --git a/tests/src/input/testInputFileReader.cpp b/tests/src/input/testInputFileReader.cpp index 48ef9d091..ff2581ea3 100644 --- a/tests/src/input/testInputFileReader.cpp +++ b/tests/src/input/testInputFileReader.cpp @@ -107,7 +107,7 @@ TEST_F(TestInputFileReader, testNotAValidKeyword) auto lineElements = std::vector{"notAValidKeyword", "=", "1"}; ASSERT_THROW( _inputFileReader->process(lineElements), - customException::InputFileException + exc::InputFileException ); } @@ -141,7 +141,7 @@ TEST_F(TestInputFileReader, testReadFileNotFound) { std::string filename = "data/inputFileReader/inputFileNotFound.txt"; _inputFileReader->setFilename(filename); - ASSERT_THROW(_inputFileReader->read(), customException::InputFileException); + ASSERT_THROW(_inputFileReader->read(), exc::InputFileException); } TEST_F(TestInputFileReader, testReadInputFileFunction) @@ -166,7 +166,7 @@ TEST_F(TestInputFileReader, testReadInputFileReactionFieldMissingEpsilon) ASSERT_THROW_MSG( readInputFile(_fileName, *_mdEngine), - customException::InputFileException, + exc::InputFileException, "Missing required keyword \"rf_epsilon\" in input file: it must be " "set when the Coulomb long-range correction is set to " "\"reaction-field\"." @@ -225,10 +225,7 @@ TEST_F(TestInputFileReader, testPostProcessRequiredFail) { const auto &keyword = keywordsRef[index]; _inputFileReader->setKeywordCount(keyword, 0); - ASSERT_THROW( - _inputFileReader->postProcess(), - customException::InputFileException - ); + ASSERT_THROW(_inputFileReader->postProcess(), exc::InputFileException); _inputFileReader->setKeywordCount(keyword, 1); } } @@ -266,7 +263,7 @@ TEST_F(TestInputFileReader, testPostProcessCountToOftenFail) _inputFileReader->setKeywordCount(keyword, index); ASSERT_THROW( _inputFileReader->postProcess(), - customException::InputFileException + exc::InputFileException ); _inputFileReader->setKeywordCount(keyword, 1); } @@ -312,14 +309,14 @@ TEST_F(TestInputFileReader, testReadJobType) filename = "fileNotFound"; ASSERT_THROW_MSG( input::readJobType(filename, engine), - customException::InputFileException, + exc::InputFileException, "\"fileNotFound\" File not found" ); filename = "data/inputFileReader/missingJobType.txt"; ASSERT_THROW_MSG( input::readJobType(filename, engine), - customException::InputFileException, + exc::InputFileException, "Missing keyword \"jobtype\" in input file" ); } diff --git a/tests/src/input/testInputValidation.cpp b/tests/src/input/testInputValidation.cpp index 7c2c05aba..2bd418410 100644 --- a/tests/src/input/testInputValidation.cpp +++ b/tests/src/input/testInputValidation.cpp @@ -41,7 +41,7 @@ #include "throwWithMessage.hpp" // for ASSERT_THROW_MSG #include "timingsSettings.hpp" // for TimingsSettings -using namespace customException; +using namespace exc; using namespace input; using namespace settings; diff --git a/tests/src/input/testIntraNonBondedReader.cpp b/tests/src/input/testIntraNonBondedReader.cpp index 4ad059e48..02510d52c 100644 --- a/tests/src/input/testIntraNonBondedReader.cpp +++ b/tests/src/input/testIntraNonBondedReader.cpp @@ -30,7 +30,7 @@ #include "intraNonBondedContainer.hpp" // for IntraNonBondedContainer #include "throwWithMessage.hpp" // for EXPECT_THROW_MSG -using namespace customException; +using namespace exc; TEST_F(TestIntraNonBondedReader, findMoleculeType) { diff --git a/tests/src/input/testMShakeReader.cpp b/tests/src/input/testMShakeReader.cpp index dfe7a1984..0da92ffa6 100644 --- a/tests/src/input/testMShakeReader.cpp +++ b/tests/src/input/testMShakeReader.cpp @@ -61,7 +61,7 @@ TEST_F(TestMShakeReader, testProcessCommentLine) EXPECT_THROW_MSG( reader.processCommentLine(commentLine, mShakeReference), - customException::MShakeFileException, + exc::MShakeFileException, error_message ); @@ -69,7 +69,7 @@ TEST_F(TestMShakeReader, testProcessCommentLine) EXPECT_THROW_MSG( reader.processCommentLine(commentLine, mShakeReference), - customException::MShakeFileException, + exc::MShakeFileException, "Molecule type 1 not found" ); @@ -99,7 +99,7 @@ TEST_F(TestMShakeReader, testProcessAtomLines) EXPECT_THROW_MSG( reader.processAtomLines(atomLines, mShakeReference), - customException::MShakeFileException, + exc::MShakeFileException, error_message ); @@ -110,7 +110,7 @@ TEST_F(TestMShakeReader, testProcessAtomLines) EXPECT_THROW_MSG( reader.processAtomLines(atomLines, mShakeReference), - customException::MShakeFileException, + exc::MShakeFileException, "Molecule type 1 has only one atom. M-Shake requires at least two " "atoms." ); @@ -123,7 +123,7 @@ TEST_F(TestMShakeReader, testProcessAtomLines) EXPECT_THROW_MSG( reader.processAtomLines(atomLines, mShakeReference), - customException::MShakeFileException, + exc::MShakeFileException, "Atom names in mShake file at line 0 do not match the atom names of " "the molecule type! The M-Shake file should be in the form a an " "extended xyz file. Therefore, the atom names in the atom lines should " diff --git a/tests/src/input/testMoldescriptorReader.cpp b/tests/src/input/testMoldescriptorReader.cpp index 718e108aa..95904c93f 100644 --- a/tests/src/input/testMoldescriptorReader.cpp +++ b/tests/src/input/testMoldescriptorReader.cpp @@ -33,7 +33,7 @@ using namespace std; using namespace ::testing; using namespace input::molDescriptor; -using namespace customException; +using namespace exc; /** * @brief tests constructor of MoldescriptorReader diff --git a/tests/src/input/topologyReader/testAngleSection.cpp b/tests/src/input/topologyReader/testAngleSection.cpp index b838fca20..95fc6378a 100644 --- a/tests/src/input/topologyReader/testAngleSection.cpp +++ b/tests/src/input/topologyReader/testAngleSection.cpp @@ -62,19 +62,19 @@ TEST_F(TestTopologySection, processSectionAngle) lineElements = {"1", "1", "2", "3"}; EXPECT_THROW( angleSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); lineElements = {"1", "2", "7"}; EXPECT_THROW( angleSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); lineElements = {"1", "2", "3", "7", "#"}; EXPECT_THROW( angleSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); } @@ -85,9 +85,6 @@ TEST_F(TestTopologySection, processSectionAngle) TEST_F(TestTopologySection, endedNormallyAngle) { input::topology::AngleSection angleSection; - EXPECT_THROW( - angleSection.endedNormally(false), - customException::TopologyException - ); + EXPECT_THROW(angleSection.endedNormally(false), exc::TopologyException); EXPECT_NO_THROW(angleSection.endedNormally(true)); } diff --git a/tests/src/input/topologyReader/testBondSection.cpp b/tests/src/input/topologyReader/testBondSection.cpp index 771691bdc..6f48185d1 100644 --- a/tests/src/input/topologyReader/testBondSection.cpp +++ b/tests/src/input/topologyReader/testBondSection.cpp @@ -61,19 +61,19 @@ TEST_F(TestTopologySection, processSectionBond) lineElements = {"1", "1", "7"}; EXPECT_THROW( bondSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); lineElements = {"1", "2", "7", "1", "2"}; EXPECT_THROW( bondSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); lineElements = {"1", "2", "7", "#"}; EXPECT_THROW( bondSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); } @@ -84,9 +84,6 @@ TEST_F(TestTopologySection, processSectionBond) TEST_F(TestTopologySection, endedNormallyBond) { input::topology::BondSection bondSection; - EXPECT_THROW( - bondSection.endedNormally(false), - customException::TopologyException - ); + EXPECT_THROW(bondSection.endedNormally(false), exc::TopologyException); EXPECT_NO_THROW(bondSection.endedNormally(true)); } diff --git a/tests/src/input/topologyReader/testDihedralSection.cpp b/tests/src/input/topologyReader/testDihedralSection.cpp index 0a10c536a..9529a21ac 100644 --- a/tests/src/input/topologyReader/testDihedralSection.cpp +++ b/tests/src/input/topologyReader/testDihedralSection.cpp @@ -64,19 +64,19 @@ TEST_F(TestTopologySection, processSectionDihedral) lineElements = {"1", "1", "2", "3", "4"}; EXPECT_THROW( dihedralSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); lineElements = {"1", "2", "7"}; EXPECT_THROW( dihedralSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); lineElements = {"1", "2", "3", "4", "7", "#"}; EXPECT_THROW( dihedralSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); } @@ -87,9 +87,6 @@ TEST_F(TestTopologySection, processSectionDihedral) TEST_F(TestTopologySection, endedNormallyDihedral) { input::topology::DihedralSection dihedralSection; - EXPECT_THROW( - dihedralSection.endedNormally(false), - customException::TopologyException - ); + EXPECT_THROW(dihedralSection.endedNormally(false), exc::TopologyException); EXPECT_NO_THROW(dihedralSection.endedNormally(true)); } diff --git a/tests/src/input/topologyReader/testDistanceConstraintsSection.cpp b/tests/src/input/topologyReader/testDistanceConstraintsSection.cpp index 7668ec7d7..3cb2d3567 100644 --- a/tests/src/input/topologyReader/testDistanceConstraintsSection.cpp +++ b/tests/src/input/topologyReader/testDistanceConstraintsSection.cpp @@ -63,21 +63,21 @@ TEST_F(TestTopologySection, processSectionShake) lineElements = {"1", "1", "1.0", "2", "1"}; EXPECT_THROW( distanceConstraintsSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); // same atom indices lineElements = {"1", "1", "1.0", "2", "1", "2"}; EXPECT_THROW( distanceConstraintsSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); // lower distance greater than upper distance lineElements = {"1", "2", "2.0", "1.0", "1", "2"}; EXPECT_THROW( distanceConstraintsSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); } @@ -90,7 +90,7 @@ TEST_F(TestTopologySection, endedNormallyShake) input::topology::DistanceConstraintsSection distanceConstraintsSection; EXPECT_THROW( distanceConstraintsSection.endedNormally(false), - customException::TopologyException + exc::TopologyException ); EXPECT_NO_THROW(distanceConstraintsSection.endedNormally(true)); } diff --git a/tests/src/input/topologyReader/testImproperDihedralSection.cpp b/tests/src/input/topologyReader/testImproperDihedralSection.cpp index bc9e83c8e..1dd183fa3 100644 --- a/tests/src/input/topologyReader/testImproperDihedralSection.cpp +++ b/tests/src/input/topologyReader/testImproperDihedralSection.cpp @@ -58,13 +58,13 @@ TEST_F(TestTopologySection, processSectionImproperDihedral) lineElements = {"1", "1", "2", "3", "4"}; EXPECT_THROW( improperDihedralSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); lineElements = {"1", "2", "7"}; EXPECT_THROW( improperDihedralSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); } @@ -77,7 +77,7 @@ TEST_F(TestTopologySection, endedNormallyImproperDihedral) input::topology::ImproperDihedralSection improperDihedralSection; EXPECT_THROW( improperDihedralSection.endedNormally(false), - customException::TopologyException + exc::TopologyException ); EXPECT_NO_THROW(improperDihedralSection.endedNormally(true)); } diff --git a/tests/src/input/topologyReader/testJCouplingSection.cpp b/tests/src/input/topologyReader/testJCouplingSection.cpp index b2510c400..5624dca18 100644 --- a/tests/src/input/topologyReader/testJCouplingSection.cpp +++ b/tests/src/input/topologyReader/testJCouplingSection.cpp @@ -31,7 +31,7 @@ #include "testTopologySection.hpp" using input::topology::JCouplingSection; -using namespace customException; +using namespace exc; TEST_F(TestTopologySection, jCouplingSectionKeyword) { diff --git a/tests/src/input/topologyReader/testShakeSection.cpp b/tests/src/input/topologyReader/testShakeSection.cpp index 65cdade8a..2f869902c 100644 --- a/tests/src/input/topologyReader/testShakeSection.cpp +++ b/tests/src/input/topologyReader/testShakeSection.cpp @@ -59,13 +59,13 @@ TEST_F(TestTopologySection, processSectionShake) lineElements = {"1", "1", "1.0", "0"}; EXPECT_THROW( shakeSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); lineElements = {"1", "1", "1.0", "0", "1"}; EXPECT_THROW( shakeSection.processSection(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); } @@ -76,9 +76,6 @@ TEST_F(TestTopologySection, processSectionShake) TEST_F(TestTopologySection, endedNormallyShake) { input::topology::ShakeSection shakeSection; - EXPECT_THROW( - shakeSection.endedNormally(false), - customException::TopologyException - ); + EXPECT_THROW(shakeSection.endedNormally(false), exc::TopologyException); EXPECT_NO_THROW(shakeSection.endedNormally(true)); } diff --git a/tests/src/input/topologyReader/testTopologyReader.cpp b/tests/src/input/topologyReader/testTopologyReader.cpp index 1a40a919c..3ccae0d94 100644 --- a/tests/src/input/topologyReader/testTopologyReader.cpp +++ b/tests/src/input/topologyReader/testTopologyReader.cpp @@ -64,7 +64,7 @@ TEST_F(TestTopologyReader, determineSection) EXPECT_THROW( [[maybe_unused]] const auto dummy = _topologyReader->determineSection({"unknown"}), - customException::TopologyException + exc::TopologyException ); } @@ -79,7 +79,7 @@ TEST_F(TestTopologyReader, read) EXPECT_NO_THROW(_topologyReader->read()); settings::FileSettings::unsetIsTopologyFileNameSet(); - EXPECT_THROW(_topologyReader->read(), customException::InputFileException); + EXPECT_THROW(_topologyReader->read(), exc::InputFileException); } /** diff --git a/tests/src/input/topologyReader/testTopologySection.cpp b/tests/src/input/topologyReader/testTopologySection.cpp index 4cc951e3f..3962499d9 100644 --- a/tests/src/input/topologyReader/testTopologySection.cpp +++ b/tests/src/input/topologyReader/testTopologySection.cpp @@ -111,7 +111,7 @@ TEST_F(TestTopologySection, processShakeSectionIncorrectNumberOfElements) EXPECT_THROW( shakeSection.process(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); } @@ -138,7 +138,7 @@ TEST_F(TestTopologySection, processShakeSectionSameAtomTwice) EXPECT_THROW( shakeSection.process(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); } @@ -167,6 +167,6 @@ TEST_F(TestTopologySection, processShakeSectionMissingEnd) EXPECT_THROW( shakeSection.process(lineElements, *_engine), - customException::TopologyException + exc::TopologyException ); } diff --git a/tests/src/intraNonBonded/testIntraNonBonded.cpp b/tests/src/intraNonBonded/testIntraNonBonded.cpp index 3db282bee..1d49d3852 100644 --- a/tests/src/intraNonBonded/testIntraNonBonded.cpp +++ b/tests/src/intraNonBonded/testIntraNonBonded.cpp @@ -85,7 +85,7 @@ TEST_F(TestIntraNonBonded, findIntraNonBondedContainerByMolType) EXPECT_THROW_MSG( [[maybe_unused]] const auto dummy = intraNonBonded.findIntraNonBondedContainerByMolType(3), - customException::IntraNonBondedException, + exc::IntraNonBondedException, std::format("IntraNonBondedContainer with molType 3 not found!") ) } diff --git a/tests/src/manostat/testManostat.cpp b/tests/src/manostat/testManostat.cpp index 16bd5b391..a9232dae1 100644 --- a/tests/src/manostat/testManostat.cpp +++ b/tests/src/manostat/testManostat.cpp @@ -308,7 +308,7 @@ TEST_F( EXPECT_THROW_MSG( _manostat->applyManostat(*_box, *_data), - customException::ManostatException, + exc::ManostatException, "Coulomb radius cut off is larger than half of the minimal box " "dimension" ); diff --git a/tests/src/molsys/testCelllist.cpp b/tests/src/molsys/testCelllist.cpp index 0235ca84c..6d3192de8 100644 --- a/tests/src/molsys/testCelllist.cpp +++ b/tests/src/molsys/testCelllist.cpp @@ -228,7 +228,7 @@ TEST_F(TestCellList, addNeighbouringCellsRejectsAliasedPeriodicOffsets) EXPECT_THROW_MSG( _cellList->addNeighbouringCells(4.0), - customException::CellListException, + exc::CellListException, "Invalid cell-list layout for x dimension: cell-number must be at " "least 2 * neighbour cells + 1 (required 3, configured 2). Decrease " "coulomb radius cutoff or increase cell-number." @@ -247,7 +247,7 @@ TEST_F(TestCellList, checkCoulombCutoff) EXPECT_THROW_MSG( _cellList->checkCoulombCutoff(0.1), - customException::CellListException, + exc::CellListException, "Coulomb cutoff is smaller than half of the largest cell size." ); } @@ -258,7 +258,7 @@ TEST_F(TestCellList, resizeCellsRejectsOverflow) EXPECT_THROW_MSG( _cellList->resizeCells(), - customException::CellListException, + exc::CellListException, "Number of cells exceeds the supported size" ); } @@ -269,7 +269,7 @@ TEST_F(TestCellList, resizeCellsRejectsZeroDimensions) EXPECT_THROW_MSG( _cellList->resizeCells(), - customException::CellListException, + exc::CellListException, "Number of cells must be positive" ); } diff --git a/tests/src/molsys/testSimulationBox.cpp b/tests/src/molsys/testSimulationBox.cpp index 8acd2edb4..a78fcdea1 100644 --- a/tests/src/molsys/testSimulationBox.cpp +++ b/tests/src/molsys/testSimulationBox.cpp @@ -119,7 +119,7 @@ TEST_F(TestSimulationBox, findMoleculeType) EXPECT_THROW( [[maybe_unused]] auto &dummy = _simulationBox->findMoleculeType(3), - customException::RstFileException + exc::RstFileException ); } @@ -141,11 +141,11 @@ TEST_F(TestSimulationBox, findMoleculeByAtomIndex) EXPECT_THROW([[maybe_unused]] const auto dummy = _simulationBox->findMoleculeByAtomIndex(6); - , customException::UserInputException); + , exc::UserInputException); EXPECT_THROW([[maybe_unused]] const auto dummy = _simulationBox->findMoleculeByAtomIndex(0); - , customException::UserInputException); + , exc::UserInputException); } /** @@ -194,19 +194,15 @@ TEST_F(TestSimulationBox, checkCoulombRadiusCutoff) _simulationBox->setBoxDimensions({1.99, 10.0, 10.0}); EXPECT_THROW_MSG( - _simulationBox->checkCoulRadiusCutOff( - customException::ExceptionType::USERINPUTEXCEPTION - ), - customException::UserInputException, + _simulationBox->checkCoulRadiusCutOff(ExceptionType::UserInputError), + exc::UserInputException, "Coulomb radius cut off is larger than half of the minimal box " "dimension" ); EXPECT_THROW_MSG( - _simulationBox->checkCoulRadiusCutOff( - customException::ExceptionType::MANOSTATEXCEPTION - ), - customException::ManostatException, + _simulationBox->checkCoulRadiusCutOff(ExceptionType::ManostatError), + exc::ManostatException, "Coulomb radius cut off is larger than half of the minimal box " "dimension" ); @@ -214,10 +210,8 @@ TEST_F(TestSimulationBox, checkCoulombRadiusCutoff) _simulationBox->setBoxDimensions({10.0, 1.99, 10.0}); EXPECT_THROW_MSG( - _simulationBox->checkCoulRadiusCutOff( - customException::ExceptionType::USERINPUTEXCEPTION - ), - customException::UserInputException, + _simulationBox->checkCoulRadiusCutOff(ExceptionType::UserInputError), + exc::UserInputException, "Coulomb radius cut off is larger than half of the minimal box " "dimension" ); @@ -225,10 +219,8 @@ TEST_F(TestSimulationBox, checkCoulombRadiusCutoff) _simulationBox->setBoxDimensions({10.0, 10.0, 1.99}); EXPECT_THROW_MSG( - _simulationBox->checkCoulRadiusCutOff( - customException::ExceptionType::USERINPUTEXCEPTION - ), - customException::UserInputException, + _simulationBox->checkCoulRadiusCutOff(ExceptionType::UserInputError), + exc::UserInputException, "Coulomb radius cut off is larger than half of the minimal box " "dimension" ); @@ -378,7 +370,7 @@ TEST_F( EXPECT_THROW_MSG( simulationBox.setPartialChargesOfMoleculesFromMoleculeTypes(), - customException::UserInputException, + exc::UserInputException, "Molecule type 1 not found in molecule types" ); } @@ -483,33 +475,33 @@ TEST_F(TestSimulationBox, validatesHybridIndexLists) ); EXPECT_THROW( _simulationBox->addInnerRegionCenterAtoms({-1}), - customException::UserInputException + exc::UserInputException ); EXPECT_THROW( _simulationBox->addInnerRegionCenterAtoms({5}), - customException::UserInputException + exc::UserInputException ); _simulationBox->setupForcedOuterMolecules({0}); EXPECT_TRUE(_simulationBox->getMolecule(0).isForcedOuter()); EXPECT_THROW( _simulationBox->setupForcedCoreMolecules({0}), - customException::UserInputException + exc::UserInputException ); _simulationBox->setupForcedCoreMolecules({1}); EXPECT_TRUE(_simulationBox->getMolecule(1).isForcedCore()); EXPECT_THROW( _simulationBox->setupForcedOuterMolecules({1}), - customException::UserInputException + exc::UserInputException ); EXPECT_THROW( _simulationBox->setupForcedCoreMolecules({2}), - customException::UserInputException + exc::UserInputException ); EXPECT_THROW( _simulationBox->setupForcedOuterMolecules({-1}), - customException::UserInputException + exc::UserInputException ); } @@ -530,38 +522,38 @@ TEST_F(TestSimulationBox, validatesForcedLayerList) EXPECT_THROW_MSG( simBox.setupForcedLayerMolecules({-1}), - customException::UserInputException, + exc::UserInputException, "Forced Layer region molecule index -1 out of range" ); EXPECT_THROW_MSG( simBox.setupForcedLayerMolecules({3}), - customException::UserInputException, + exc::UserInputException, "Forced Layer region molecule index 3 out of range" ); EXPECT_THROW_MSG( simBox.setupForcedLayerMolecules({0}), - customException::UserInputException, + exc::UserInputException, "Ambiguous molecule index 0 - molecule cannot be in " "forced_layer_list AND forced_core_list/forced_outer_list at the same " "time" ); EXPECT_THROW_MSG( simBox.setupForcedLayerMolecules({2}), - customException::UserInputException, + exc::UserInputException, "Ambiguous molecule index 2 - molecule cannot be in " "forced_layer_list AND forced_core_list/forced_outer_list at the same " "time" ); EXPECT_THROW_MSG( simBox.setupForcedCoreMolecules({1}), - customException::UserInputException, + exc::UserInputException, "Ambiguous molecule index 1 - molecule cannot be in " "forced_core_list AND forced_layer_list/forced_outer_list at the same " "time" ); EXPECT_THROW_MSG( simBox.setupForcedOuterMolecules({1}), - customException::UserInputException, + exc::UserInputException, "Ambiguous molecule index 1 - molecule cannot be in " "forced_outer_list AND forced_core_list/forced_layer_list at the same " "time" diff --git a/tests/src/opt/testHessianBuilder.cpp b/tests/src/opt/testHessianBuilder.cpp index ec7b295f9..7d4868f8e 100644 --- a/tests/src/opt/testHessianBuilder.cpp +++ b/tests/src/opt/testHessianBuilder.cpp @@ -185,7 +185,7 @@ TEST(TestHessianBuilder, analyticBuilderRequiresEvaluatorSupport) EXPECT_THROW( (void) builder.build(evaluator, *box), - customException::UserInputException + exc::UserInputException ); } @@ -237,6 +237,6 @@ TEST(TestHessianBuilder, makeHessianBuilderSelectsConcreteStrategies) EXPECT_THROW( (void) makeHessianBuilder(settings::HessianBuilderType::NONE, 1.0e-3), - customException::UserInputException + exc::UserInputException ); } diff --git a/tests/src/opt/testOptimizer.cpp b/tests/src/opt/testOptimizer.cpp index 49a6b205e..b29961e0f 100644 --- a/tests/src/opt/testOptimizer.cpp +++ b/tests/src/opt/testOptimizer.cpp @@ -101,8 +101,8 @@ TEST(TestOptimizer, cloneProducesEquivalentObject) TEST(TestOptimizer, getHistoryIndexThrowsOnNonNegativeOffset) { const SteepestDescent opt(1U); - EXPECT_THROW((void) opt.getHistoryIndex(0), customException::OptException); - EXPECT_THROW((void) opt.getHistoryIndex(1), customException::OptException); + EXPECT_THROW((void) opt.getHistoryIndex(0), exc::OptException); + EXPECT_THROW((void) opt.getHistoryIndex(1), exc::OptException); } /* ---------- updateHistory + getters ---------- */ diff --git a/tests/src/output/testOutput.cpp b/tests/src/output/testOutput.cpp index 1eb0ff0c7..0dbc1922b 100644 --- a/tests/src/output/testOutput.cpp +++ b/tests/src/output/testOutput.cpp @@ -42,19 +42,19 @@ TEST(TestOutput, testSpecialSetFilename) EXPECT_THROW_MSG( output.setFilename(""), - customException::InputFileException, + exc::InputFileException, "Filename cannot be empty" ); EXPECT_THROW_MSG( output.setFilename("src"), - customException::InputFileException, + exc::InputFileException, "File already exists - filename = src" ); EXPECT_THROW_MSG( output.openFile(), - customException::InputFileException, + exc::InputFileException, std::format("Could not open file - filename = src") ); @@ -64,7 +64,7 @@ TEST(TestOutput, testSpecialSetFilename) EXPECT_THROW_MSG( output.setFilename(testFileName), - customException::InputFileException, + exc::InputFileException, std::format("File already exists - filename = {}", testFileName) ); @@ -76,4 +76,4 @@ TEST(TestOutput, testSpecialSetFilename) OutputFileSettings::setOverwriteOutputFiles(false); std::filesystem::remove(testFileName); -} \ No newline at end of file +} diff --git a/tests/src/potential/nonCoulomb/testForceFieldNonCoulomb.cpp b/tests/src/potential/nonCoulomb/testForceFieldNonCoulomb.cpp index 676bdc41c..6627871a9 100644 --- a/tests/src/potential/nonCoulomb/testForceFieldNonCoulomb.cpp +++ b/tests/src/potential/nonCoulomb/testForceFieldNonCoulomb.cpp @@ -344,7 +344,7 @@ TEST_F( EXPECT_THROW_MSG( [[maybe_unused]] const auto dummy = _nonCoulombPotential->findNonCoulPairByInternalTypes(0, 2), - customException::ParameterFileException, + exc::ParameterFileException, "Non coulombic pair with global van der waals types 1 and 5 is defined " "twice in the parameter file." ); @@ -382,7 +382,7 @@ TEST_F( EXPECT_THROW_MSG( _nonCoulombPotential->fillOffDiagOfNonCoulPairsMatrix(), - customException::ParameterFileException, + exc::ParameterFileException, "Not all combinations of global van der Waals types are defined in the " "parameter file - and no mixing rules were chosen" ); @@ -603,7 +603,7 @@ TEST_F( EXPECT_THROW_MSG( _nonCoulombPotential->fillOffDiagOfNonCoulPairsMatrix(), - customException::ParameterFileException, + exc::ParameterFileException, "Non-coulombic pairs with global van der Waals types 1, 2 and 2, 1 in " "the parameter file have different parameters" ); @@ -738,7 +738,7 @@ TEST_F(TestNonCoulombPotentialFF, sortNonCoulombicsPairs) EXPECT_THROW_MSG( _nonCoulombPotential->sortNonCoulombicsPairs(vector), - customException::ParameterFileException, + exc::ParameterFileException, "Non-coulombic pairs with global van der Waals types 1 and 1 in the " "parameter file are defined twice" ); diff --git a/tests/src/resetKinetics/testResetKinetics.cpp b/tests/src/resetKinetics/testResetKinetics.cpp index 2acfa1aab..03528f46c 100644 --- a/tests/src/resetKinetics/testResetKinetics.cpp +++ b/tests/src/resetKinetics/testResetKinetics.cpp @@ -157,7 +157,7 @@ TEST(TestResetKinetics, rejectsZeroTargetFromZeroTemperature) EXPECT_THROW_MSG( resetKinetics.resetTemperature(*box), - customException::UserInputException, + exc::UserInputException, "Cannot rescale a zero-temperature system. Initialize velocities first." ); @@ -176,7 +176,7 @@ TEST(TestResetKinetics, rejectsPositiveTargetFromZeroTemperature) EXPECT_THROW_MSG( resetKinetics.resetTemperature(*box), - customException::UserInputException, + exc::UserInputException, "Cannot rescale a zero-temperature system. Initialize velocities first." ); diff --git a/tests/src/settings/testQMSettings.cpp b/tests/src/settings/testQMSettings.cpp index 606f4ec8b..e4de166f5 100644 --- a/tests/src/settings/testQMSettings.cpp +++ b/tests/src/settings/testQMSettings.cpp @@ -31,7 +31,7 @@ #include "throwWithMessage.hpp" // for ASSERT_THROW_MSG using namespace settings; -using namespace customException; +using namespace exc; TEST(QMSettingsTest, SetQMMethodTest) { diff --git a/tests/src/settings/testSettings.cpp b/tests/src/settings/testSettings.cpp index e9daab1fc..1c6875a9e 100644 --- a/tests/src/settings/testSettings.cpp +++ b/tests/src/settings/testSettings.cpp @@ -34,7 +34,7 @@ using enum settings::JobType; using enum settings::FPType; using namespace settings; -// using namespace customException; +// using namespace exc; TEST(TestSettings, stringJobtypeTest) { diff --git a/tests/src/settings/testWaterModelSettings.cpp b/tests/src/settings/testWaterModelSettings.cpp index 88c39dfe3..e7d31a814 100644 --- a/tests/src/settings/testWaterModelSettings.cpp +++ b/tests/src/settings/testWaterModelSettings.cpp @@ -28,7 +28,7 @@ #include "exceptions.hpp" #include "waterModelSettings.hpp" -using customException::UserInputException; +using exc::UserInputException; using settings::WaterInterModel; using settings::WaterIntraModel; using settings::WaterModelSettings; diff --git a/tests/src/setup/testHybridSetup.cpp b/tests/src/setup/testHybridSetup.cpp index 16fc93a66..71a6eea1c 100644 --- a/tests/src/setup/testHybridSetup.cpp +++ b/tests/src/setup/testHybridSetup.cpp @@ -39,7 +39,7 @@ using namespace setup; using namespace settings; -using namespace customException; +using namespace exc; using namespace input; namespace diff --git a/tests/src/setup/testOptimizerSetup.cpp b/tests/src/setup/testOptimizerSetup.cpp index d0dbe8d73..21086328d 100644 --- a/tests/src/setup/testOptimizerSetup.cpp +++ b/tests/src/setup/testOptimizerSetup.cpp @@ -37,7 +37,7 @@ using namespace setup; using namespace settings; -using namespace customException; +using namespace exc; namespace { @@ -175,10 +175,7 @@ TEST_F(TestSetup, setupEmptyOptimizerSteepestDescent) OptimizerSetup s(dynamic_cast(*_engine)); const auto opt = s.setupEmptyOptimizer(); ASSERT_NE(opt, nullptr); - EXPECT_NE( - std::dynamic_pointer_cast(opt), - nullptr - ); + EXPECT_NE(std::dynamic_pointer_cast(opt), nullptr); } TEST_F(TestSetup, setupEmptyOptimizerAdam) diff --git a/tests/src/setup/testPotentialSetup.cpp b/tests/src/setup/testPotentialSetup.cpp index eb3ec57a9..f614c66ef 100644 --- a/tests/src/setup/testPotentialSetup.cpp +++ b/tests/src/setup/testPotentialSetup.cpp @@ -133,7 +133,7 @@ TEST_F(TestSetup, setupNonCoulombicPairs) EXPECT_THROW_MSG( potentialSetup.setupNonCoulombicPairs(), - customException::ParameterFileException, + exc::ParameterFileException, "Not all self interacting non coulombics were set in the noncoulombics " "section of the parameter file" ); diff --git a/tests/src/setup/testQMSetup.cpp b/tests/src/setup/testQMSetup.cpp index 8bd5e2f92..344b4c472 100644 --- a/tests/src/setup/testQMSetup.cpp +++ b/tests/src/setup/testQMSetup.cpp @@ -112,7 +112,7 @@ TEST(TestQMSetup, setupDftbplus) ASSERT_THROW_MSG( setupQM.setup(), - customException::InputFileException, + exc::InputFileException, "A QM based jobtype was requested but no valid external program via " "\"qm_prog\" provided" ); @@ -133,7 +133,7 @@ TEST(TestQMSetup, setupPySCF) ASSERT_THROW_MSG( setupQM.setup(), - customException::InputFileException, + exc::InputFileException, "A QM based jobtype was requested but no valid external program via " "\"qm_prog\" provided" ); @@ -154,7 +154,7 @@ TEST(TestQMSetup, setupTurbomoleRunner) ASSERT_THROW_MSG( setupQM.setup(), - customException::InputFileException, + exc::InputFileException, "A QM based jobtype was requested but no valid external program via " "\"qm_prog\" provided" ); diff --git a/tests/src/setup/testSimulationBoxSetup.cpp b/tests/src/setup/testSimulationBoxSetup.cpp index 7b7a930c6..808885beb 100644 --- a/tests/src/setup/testSimulationBoxSetup.cpp +++ b/tests/src/setup/testSimulationBoxSetup.cpp @@ -288,7 +288,7 @@ TEST_F(TestSetup, testSetAtomMassesThrowsError) SimulationBoxSetup simulationBoxSetup(*_engine); ASSERT_THROW( simulationBoxSetup.setAtomMasses(), - customException::MolDescriptorException + exc::MolDescriptorException ); } @@ -342,7 +342,7 @@ TEST_F(TestSetup, testSetAtomicNumbersThrowsError) SimulationBoxSetup simulationBoxSetup(*_engine); ASSERT_THROW( simulationBoxSetup.setAtomicNumbers(), - customException::MolDescriptorException + exc::MolDescriptorException ); } @@ -411,7 +411,7 @@ TEST_F(TestSetup, noDensityNoBox) SimulationBoxSetup simulationBoxSetup(*_engine); ASSERT_THROW( simulationBoxSetup.checkBoxSettings(), - customException::UserInputException + exc::UserInputException ); } @@ -473,10 +473,7 @@ TEST_F(TestSetup, testCheckRcCutoff) _engine->getSimulationBox().setBoxDimensions({10.0, 20.0, 30.0}); settings::PotentialSettings::setCoulombRadiusCutOff(14.0); SimulationBoxSetup simulationBoxSetup(*_engine); - EXPECT_THROW( - simulationBoxSetup.checkRcCutoff(), - customException::InputFileException - ); + EXPECT_THROW(simulationBoxSetup.checkRcCutoff(), exc::InputFileException); SimulationBoxSetup simulationBox2Setup(*_engine); settings::PotentialSettings::setCoulombRadiusCutOff(4.0); diff --git a/tests/src/setup/testThermostatSetup.cpp b/tests/src/setup/testThermostatSetup.cpp index 6d57110ec..40bb97b61 100644 --- a/tests/src/setup/testThermostatSetup.cpp +++ b/tests/src/setup/testThermostatSetup.cpp @@ -142,7 +142,7 @@ TEST_F(TestSetup, rejectsEmptyTemperatureRamp) settings::ThermostatSettings::setStartTemperature(200); settings::ThermostatSettings::setTemperatureRampSteps(0); - EXPECT_THROW(thermostatSetup.setup(), customException::InputFileException); + EXPECT_THROW(thermostatSetup.setup(), exc::InputFileException); } TEST_F(TestSetup, rejectsZeroTemperatureRampFrequency) @@ -156,7 +156,7 @@ TEST_F(TestSetup, rejectsZeroTemperatureRampFrequency) settings::ThermostatSettings::setTemperatureRampSteps(10); settings::ThermostatSettings::setTemperatureRampFrequency(0); - EXPECT_THROW(thermostatSetup.setup(), customException::InputFileException); + EXPECT_THROW(thermostatSetup.setup(), exc::InputFileException); settings::ThermostatSettings::setTemperatureRampSteps(0); settings::ThermostatSettings::setTemperatureRampFrequency(1); diff --git a/tests/src/setup/testWaterModelSetup.cpp b/tests/src/setup/testWaterModelSetup.cpp index f7f4e9f95..9de2eebb4 100644 --- a/tests/src/setup/testWaterModelSetup.cpp +++ b/tests/src/setup/testWaterModelSetup.cpp @@ -40,8 +40,8 @@ #include "waterModelSettings.hpp" #include "waterModelSetup.hpp" -using customException::MolDescriptorException; -using customException::UserInputException; +using exc::MolDescriptorException; +using exc::UserInputException; using molsys::Atom; using molsys::Molecule; using molsys::MoleculeType; diff --git a/tests/src/thermostat/testThermostat.cpp b/tests/src/thermostat/testThermostat.cpp index 297e6884c..879a4e1f5 100644 --- a/tests/src/thermostat/testThermostat.cpp +++ b/tests/src/thermostat/testThermostat.cpp @@ -228,7 +228,7 @@ TEST_F(TestThermostat, berendsenRejectsPositiveTargetFromZero) EXPECT_THROW( _thermostat->applyThermostat(*_simulationBox, *_data), - customException::UserInputException + exc::UserInputException ); } @@ -260,7 +260,7 @@ TEST_F(TestThermostat, velocityRescalingRejectsPositiveTargetFromZero) EXPECT_THROW( _thermostat->applyThermostat(*_simulationBox, *_data), - customException::UserInputException + exc::UserInputException ); } diff --git a/tests/src/utilities/testStringUtilities.cpp b/tests/src/utilities/testStringUtilities.cpp index 6b4139dc5..3fcda6fd3 100644 --- a/tests/src/utilities/testStringUtilities.cpp +++ b/tests/src/utilities/testStringUtilities.cpp @@ -59,15 +59,9 @@ TEST(TestStringUtilities, removeComments) TEST(TestStringUtilities, getLineCommands) { std::string line2 = "test"; - EXPECT_THROW( - utilities::getLineCommands(line2, 0), - customException::InputFileException - ); + EXPECT_THROW(utilities::getLineCommands(line2, 0), exc::InputFileException); auto *line = "nstep = 1"; - ASSERT_THROW( - utilities::getLineCommands(line, 1), - customException::InputFileException - ); + ASSERT_THROW(utilities::getLineCommands(line, 1), exc::InputFileException); line = "nstep = 1;"; ASSERT_THAT( @@ -76,10 +70,7 @@ TEST(TestStringUtilities, getLineCommands) ); line = "nstep = 1; nstep = 2"; - ASSERT_THROW( - utilities::getLineCommands(line, 1), - customException::InputFileException - ); + ASSERT_THROW(utilities::getLineCommands(line, 1), exc::InputFileException); line = "nstep = 1; nstep = 2;"; ASSERT_THAT( @@ -147,7 +138,7 @@ TEST(TestStringUtilities, keywordToBool) line = {"keyword", "=", "notABool"}; ASSERT_THROW_MSG( utilities::keywordToBool(line), - customException::InputFileException, + exc::InputFileException, "Invalid boolean option \"notABool\" for keyword \"keyword\" in " "input file.\n" "Possible values are: on, yes, true, off, no, false."