From cf249d7fd0f640a1b2cf59fcbd3535b4daedf46d Mon Sep 17 00:00:00 2001 From: Reiher Research Group Date: Thu, 23 Jun 2022 09:01:58 +0200 Subject: [PATCH] Release 3.0.1 --- CHANGELOG.rst | 5 ++++ CMakeLists.txt | 2 +- CONTRIBUTING.rst | 2 +- conanfile.py | 13 +++++++--- dev | 2 +- manual/sparrow_manual.tex | 12 ++++----- src/Sparrow/App/main.cpp | 3 ++- src/Sparrow/App/parser.cpp | 26 ------------------- src/Sparrow/CMakeLists.txt | 12 ++++++--- src/Sparrow/Python/sphinx/index.rst | 3 ++- .../Dftb/Dftb0/Wrapper/DFTB0Settings.h | 5 ++++ .../Dftb/Dftb2/Wrapper/DFTB2Settings.h | 5 ++++ .../Dftb/Dftb3/Wrapper/DFTB3Settings.h | 5 ++++ .../TimeDependent/LinearResponse/TDDFTBData.h | 3 ++- .../Implementations/GenericMethodWrapper.cpp | 17 ++++++++++++ .../Implementations/GenericMethodWrapper.h | 2 ++ .../Nddo/Am1/Wrapper/AM1Settings.h | 18 +++++++++++++ .../Nddo/Mndo/Wrapper/MNDOSettings.h | 5 ++++ .../Nddo/Pm6/Wrapper/PM6Settings.h | 5 ++++ 19 files changed, 99 insertions(+), 46 deletions(-) delete mode 100644 src/Sparrow/App/parser.cpp diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 25b71ce..9a86ca3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ Changelog ========= +Release 3.0.1 +------------- + +- Various bugfixes and improvements + Release 3.0.0 ------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index dd71c09..34f365e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.9) # tree must then provide a properly namespaced target with the same name as # your project. project(Sparrow - VERSION 3.0.0 + VERSION 3.0.1 DESCRIPTION "Library for fast and agile quantum chemical calculations with semiempirical methods." ) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 7d4bb9b..8a585df 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -27,4 +27,4 @@ from members of the Reiher research group. Further Contributors -------------------- -So far, no one else has contributed to this repository. +- Sebastian Ehlert (`@awvwgk `_), University of Bonn (various bug reports) diff --git a/conanfile.py b/conanfile.py index 1505093..f7a1143 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,9 +1,10 @@ +import sys from dev.conan.base import ScineConan class ScineSparrowConan(ScineConan): name = "scine_sparrow" - version = "3.0.0" + version = "3.0.1" url = "https://github.com/qcscine/sparrow" description = """Sparrow is a code for fast semiemprical quantum chemical calculations. It provides the methods such as MNDO, AM1, RM1, PM3, PM6, DFTB0, DFTB2, and DFTB3. @@ -12,20 +13,24 @@ class ScineSparrowConan(ScineConan): "python": [True, False], "tests": [True, False], "coverage": [True, False], - "microarch": ["detect", "none"] + "microarch": ["detect", "none"], + "python_version": "ANY" } + python_version_string = str(sys.version_info.major) + \ + "." + str(sys.version_info.minor) default_options = { "python": False, "tests": False, "coverage": False, - "microarch": "none" + "microarch": "none", + "python_version": python_version_string } exports = "dev/conan/*.py" exports_sources = ["dev/cmake/*", "src/*", "CMakeLists.txt", "README.rst", "LICENSE.txt", "dev/conan/hook.cmake", "dev/conan/glue/*"] build_requires = "cereal/1.3.0" - requires = "scine_utilities/[~=4.0.0]" + requires = "scine_utilities/[=5.0.0]" cmake_name = "Sparrow" def package_info(self): diff --git a/dev b/dev index 413ce8a..abb0acc 160000 --- a/dev +++ b/dev @@ -1 +1 @@ -Subproject commit 413ce8aa2ccd1cdcdcd49366f493c90627fad5c7 +Subproject commit abb0acc9e1bb05da2a8dd4c5804d415b7f596e1a diff --git a/manual/sparrow_manual.tex b/manual/sparrow_manual.tex index 2457fa5..ae3292e 100644 --- a/manual/sparrow_manual.tex +++ b/manual/sparrow_manual.tex @@ -21,7 +21,7 @@ %\savebox{\scineimage}{\includegraphics[height=5\baselineskip]{scine_darkblue.png}} -\title[SCINE Sparrow manual]{User Manual \vskip 0.5em {\setlength{\parindent}{0pt} \Huge SCINE Sparrow 3.0.0}} +\title[SCINE Sparrow manual]{User Manual \vskip 0.5em {\setlength{\parindent}{0pt} \Huge SCINE Sparrow 3.0.1}} \author[The SCINE Sparrow Developers]{The SCINE Sparrow Developers: \newline \noindent Francesco Bosia, Tamara Husch, Charlotte H.~M\"uller, Severin Polonius, Jan-Grimo Sobez, Miguel Steiner, Jan P.~Unsleber, Alain C.~Vaucher, Thomas Weymuth, and Markus Reiher} \publisher{ETH Z\"urich} @@ -235,7 +235,7 @@ \chapter{Introduction} \textsc{Interactive}, SCINE \textsc{ReaDuct}, and SCINE \textsc{Chemoton}. However, as with all SCINE modules it is also a stand-alone program which can be applied on its own or easily interfaced to other programs. -SCINE \textsc{Sparrow} is a command-line tool that implements many popular semiempirical models. SCINE \textsc{Sparrow} 3.0.0 +SCINE \textsc{Sparrow} is a command-line tool that implements many popular semiempirical models. SCINE \textsc{Sparrow} 3.0.1 provides the \texttt{MNDO}, \texttt{AM1}, \texttt{RM1}, \texttt{PM3}, \texttt{PM6}, non-SCC DFTB (\texttt{DFTB0}), \texttt{DFTB2}, and \texttt{DFTB3} methods (open- and closed-shell formalisms are implemented). The application of semiempirical models usually allows for rapid calculation of electronic energies and energy gradients @@ -266,7 +266,7 @@ \section{System Requirements} \textsc{Sparrow} is distributed as an open source code. In order to compile \textsc{Sparrow} from this source code, you need \begin{itemize} - \item A C++ compiler supporting the C++14 standard, + \item A C++ compiler supporting the C++17 standard, \item cmake (at least version 3.9), \item the Boost library (at least version 1.65.0), and \item the Eigen3 library (at least version 3.3.2). @@ -356,7 +356,7 @@ \section{Command Line Arguments} modes and the vibrational frequencies. This option has no effect if the Hessian is not calculated (see above). \item \texttt{-{}-bond\_orders}, \texttt{-B}: If given, the bond order matrix will be calculated. \item \texttt{-{}-method}, \texttt{-M}: With this option, the desired calculation method can be set. Options in -\textsc{Sparrow} 3.0.0 are \texttt{MNDO}, \texttt{AM1}, \texttt{RM1}, \texttt{PM3}, \texttt{PM6}, \texttt{DFTB0}, \texttt{DFTB2}, and +\textsc{Sparrow} 3.0.1 are \texttt{MNDO}, \texttt{AM1}, \texttt{RM1}, \texttt{PM3}, \texttt{PM6}, \texttt{DFTB0}, \texttt{DFTB2}, and \texttt{DFTB3}. By default, \texttt{PM6} is selected. \item \texttt{-{}-output\_to\_file}, \texttt{-o}: If this option is given, the output will not only be printed to the screen, but also to files. By default, the energy is stored in a file named ``energy.dat'', the nuclear gradients in a file named @@ -705,8 +705,8 @@ \chapter{References} \vspace{1.0cm} \begin{itemize} -\item Primary reference for Sparrow 3.0.0: -F.~Bosia, T.~Husch, C.~H.~M\"uller, S.~Polonius, J.-G.~Sobez, M.~Steiner, J.~P.~Unsleber, A.~C.~Vaucher, T.~Weymuth, M.~Reiher, \href{https://doi.org/10.5281/zenodo.3244105}{"qcscine/sparrow: Release 3.0.0 (Version 3.0.0)"}, Zenodo, 2021. +\item Primary reference for Sparrow 3.0.1: +F.~Bosia, T.~Husch, C.~H.~M\"uller, S.~Polonius, J.-G.~Sobez, M.~Steiner, J.~P.~Unsleber, A.~C.~Vaucher, T.~Weymuth, M.~Reiher, \href{https://doi.org/10.5281/zenodo.3244105}{"qcscine/sparrow: Release 3.0.1 (Version 3.0.1)"}, Zenodo, 2022. \item Presentation of the formalism of MNDO-type and OMx models: \newline T.~Husch, A.~C.~Vaucher, M.~Reiher \href{https://doi.org/10.1002/qua.25799}{"Semiempirical Molecular Orbital Models Based on the Neglect of Diatomic Differential Overlap Approximation"}, \textit{Int.~J.~Quantum Chem.}, \textbf{2018}, \textit{118}, e25799. \item Presentation of DFTB approaches: \newline diff --git a/src/Sparrow/App/main.cpp b/src/Sparrow/App/main.cpp index 6724736..b929f7d 100644 --- a/src/Sparrow/App/main.cpp +++ b/src/Sparrow/App/main.cpp @@ -28,8 +28,9 @@ int main(int argc, char* argv[]) { CalculationHandler calculationHandler(commandLineParser); calculationHandler.calculate(std::cout); } - catch (MethodNotAvailableException& e) { + catch (const std::exception& e) { std::cout << e.what() << std::endl; + return 1; } return 0; diff --git a/src/Sparrow/App/parser.cpp b/src/Sparrow/App/parser.cpp deleted file mode 100644 index ef2c278..0000000 --- a/src/Sparrow/App/parser.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @file - * @copyright This code is licensed under the 3-clause BSD license.\n - * Copyright ETH Zurich, Laboratory of Physical Chemistry, Reiher Group.\n - * See LICENSE.txt for details. - */ - -#include -#include -#include -#include -#include - -int main() { - auto traj = - Scine::Utils::MolecularTrajectoryIO::read(Scine::Utils::MolecularTrajectoryIO::format::xyz, - "/scratch/severinp/workdir/Report/BergmanTraj/trajBergmanAll.xyz"); - auto el = traj.getElementTypes(); - int i = 0; - for (auto struc : traj) { - std::string filename = "/scratch/severinp/workdir/Report/BergmanTraj/trajBergmanAll" + std::to_string(i) + ".xyz"; - Scine::Utils::ChemicalFileHandler::write(filename, {el, struc}); - ++i; - } - return 0; -} diff --git a/src/Sparrow/CMakeLists.txt b/src/Sparrow/CMakeLists.txt index 3d67744..468e123 100644 --- a/src/Sparrow/CMakeLists.txt +++ b/src/Sparrow/CMakeLists.txt @@ -73,6 +73,10 @@ scine_install_component_cmake_files( EXPORT_NAME sparrowTargets ) +if(SCINE_BUILD_TESTS OR SCINE_BUILD_PYTHON_BINDINGS) + find_package(PythonInterp REQUIRED) +endif() + # Tests if(SCINE_BUILD_TESTS) include(ImportGTest) @@ -87,7 +91,6 @@ if(SCINE_BUILD_TESTS) ${CMAKE_DL_LIBS} ) add_test(NAME Sparrow COMMAND Sparrow_tests) - find_package(PythonInterp REQUIRED) if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") set(TEST_SELECTION "::TestSparrowFast") else() @@ -103,7 +106,7 @@ if(SCINE_BUILD_TESTS) set_tests_properties(Sparrow_App PROPERTIES ENVIRONMENT SCINE_MODULE_PATH=${CMAKE_CURRENT_BINARY_DIR}:$ENV{SCINE_MODULE_PATH} ENVIRONMENT PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}:$ENV{PYTHONPATH} - ENVIRONMENT PATH=${CMAKE_CURRENT_BINARY_DIR}:$ENV{PATH} + ENVIRONMENT PATH=${CMAKE_CURRENT_BINARY_DIR}:${PROJECT_BINARY_DIR}:$ENV{PATH} ) endif() @@ -120,6 +123,9 @@ add_executable(SparrowApp ${SPARROW_APP_FILES}) add_executable(Scine::SparrowApp ALIAS SparrowApp) set_target_properties(SparrowApp PROPERTIES OUTPUT_NAME sparrow) +if(APPLE) + set_target_properties(SparrowApp PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) +endif() target_link_libraries(SparrowApp PRIVATE Boost::program_options @@ -240,8 +246,6 @@ if(SCINE_BUILD_PYTHON_BINDINGS) SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Python/sphinx OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/doc-py LINK UtilsPythonDoc - DOCTEST - DOCTEST_REQUIRES scine_utilities ) endif() diff --git a/src/Sparrow/Python/sphinx/index.rst b/src/Sparrow/Python/sphinx/index.rst index 593a56e..7e29a49 100644 --- a/src/Sparrow/Python/sphinx/index.rst +++ b/src/Sparrow/Python/sphinx/index.rst @@ -6,7 +6,8 @@ User Manual The user manuals are available for download as PDF files: -- :download:`Download Latest User Manual PDF ` +- :download:`Download Latest User Manual PDF ` +- :download:`Download User Manual PDF v3.0.1 ` - :download:`Download User Manual PDF v3.0.0 ` - :download:`Download User Manual PDF v2.0.1 ` - :download:`Download User Manual PDF v2.0.0 ` diff --git a/src/Sparrow/Sparrow/Implementations/Dftb/Dftb0/Wrapper/DFTB0Settings.h b/src/Sparrow/Sparrow/Implementations/Dftb/Dftb0/Wrapper/DFTB0Settings.h index 0a6e5e1..dcfbc76 100644 --- a/src/Sparrow/Sparrow/Implementations/Dftb/Dftb0/Wrapper/DFTB0Settings.h +++ b/src/Sparrow/Sparrow/Implementations/Dftb/Dftb0/Wrapper/DFTB0Settings.h @@ -26,6 +26,11 @@ class DFTB0Settings : public Scine::Utils::Settings { Utils::UniversalSettings::SettingPopulator::populateLcaoSettings(_fields); Utils::UniversalSettings::SettingPopulator::populateSemiEmpiricalSettings(_fields, "3ob-3-1"); + // Method + Utils::UniversalSettings::StringDescriptor method("The method to be used."); + method.setDefaultValue("dftb0"); + _fields.push_back(Utils::SettingsNames::method, method); + resetToDefaults(); }; }; diff --git a/src/Sparrow/Sparrow/Implementations/Dftb/Dftb2/Wrapper/DFTB2Settings.h b/src/Sparrow/Sparrow/Implementations/Dftb/Dftb2/Wrapper/DFTB2Settings.h index 020598c..7db7f5e 100644 --- a/src/Sparrow/Sparrow/Implementations/Dftb/Dftb2/Wrapper/DFTB2Settings.h +++ b/src/Sparrow/Sparrow/Implementations/Dftb/Dftb2/Wrapper/DFTB2Settings.h @@ -25,6 +25,11 @@ class DFTB2Settings : public Scine::Utils::Settings { Utils::UniversalSettings::SettingPopulator::populateScfSettings(_fields); Utils::UniversalSettings::SettingPopulator::populateSemiEmpiricalSettings(_fields, "mio-1-1"); + // Method + Utils::UniversalSettings::StringDescriptor method("The method to be used."); + method.setDefaultValue("dftb2"); + _fields.push_back(Utils::SettingsNames::method, method); + resetToDefaults(); }; }; diff --git a/src/Sparrow/Sparrow/Implementations/Dftb/Dftb3/Wrapper/DFTB3Settings.h b/src/Sparrow/Sparrow/Implementations/Dftb/Dftb3/Wrapper/DFTB3Settings.h index 944a68e..8606cb4 100644 --- a/src/Sparrow/Sparrow/Implementations/Dftb/Dftb3/Wrapper/DFTB3Settings.h +++ b/src/Sparrow/Sparrow/Implementations/Dftb/Dftb3/Wrapper/DFTB3Settings.h @@ -25,6 +25,11 @@ class DFTB3Settings : public Scine::Utils::Settings { Utils::UniversalSettings::SettingPopulator::populateScfSettings(_fields); Utils::UniversalSettings::SettingPopulator::populateSemiEmpiricalSettings(_fields, "3ob-3-1"); + // Method + Utils::UniversalSettings::StringDescriptor method("The method to be used."); + method.setDefaultValue("dftb3"); + _fields.push_back(Utils::SettingsNames::method, method); + resetToDefaults(); } }; diff --git a/src/Sparrow/Sparrow/Implementations/Dftb/TimeDependent/LinearResponse/TDDFTBData.h b/src/Sparrow/Sparrow/Implementations/Dftb/TimeDependent/LinearResponse/TDDFTBData.h index 99e17e2..209f210 100644 --- a/src/Sparrow/Sparrow/Implementations/Dftb/TimeDependent/LinearResponse/TDDFTBData.h +++ b/src/Sparrow/Sparrow/Implementations/Dftb/TimeDependent/LinearResponse/TDDFTBData.h @@ -24,7 +24,8 @@ namespace Sparrow { * Right now the data needed to perform TD-SCC-DFTB are present. In order to implement * TD-DFTB3 other data might be needed. */ -struct TDDFTBData : public LinearResponseData { +class TDDFTBData : public LinearResponseData { + public: /// @brief Gamma parameters size: nAtoms x nAtoms std::shared_ptr gammaMatrix; /// @brief Magnetic Hubbard parameters (spin constants) size: nAtoms diff --git a/src/Sparrow/Sparrow/Implementations/GenericMethodWrapper.cpp b/src/Sparrow/Sparrow/Implementations/GenericMethodWrapper.cpp index d859f5c..fa064eb 100644 --- a/src/Sparrow/Sparrow/Implementations/GenericMethodWrapper.cpp +++ b/src/Sparrow/Sparrow/Implementations/GenericMethodWrapper.cpp @@ -66,6 +66,8 @@ const Utils::Results& GenericMethodWrapper::calculate(std::string description) { if (dipoleMatrixCalculator_) dipoleMatrixCalculator_->invalidate(); applySettings(); + // Check method and basis set fields + checkBasicSettings(); calculateImpl(requiredDerivative); // If you want the Hessian, but cannot calculate it analytically, @@ -152,6 +154,21 @@ Utils::Derivative GenericMethodWrapper::highestDerivativeRequired() const { return requiredDerivative; } +void GenericMethodWrapper::checkBasicSettings() { + Utils::Settings settingsCopy(*(this->settings_)); + settingsCopy.resetToDefaults(); + auto methodDefault = settingsCopy.getString(Utils::SettingsNames::method); + auto currentMethod = this->settings_->getString(Utils::SettingsNames::method); + + // Check selected method + std::transform(currentMethod.begin(), currentMethod.end(), currentMethod.begin(), + [](unsigned char c) { return std::tolower(c); }); + if (currentMethod != methodDefault && currentMethod != "any") { + throw std::runtime_error("This calculator does not provide the requested method."); + } + settings_->modifyString(Utils::SettingsNames::method, methodDefault); +} + void GenericMethodWrapper::assembleResults(const std::string& description) { results_.set(description); results_.set(getLcaoMethod().getEnergy()); diff --git a/src/Sparrow/Sparrow/Implementations/GenericMethodWrapper.h b/src/Sparrow/Sparrow/Implementations/GenericMethodWrapper.h index ecf08d2..aff5c14 100644 --- a/src/Sparrow/Sparrow/Implementations/GenericMethodWrapper.h +++ b/src/Sparrow/Sparrow/Implementations/GenericMethodWrapper.h @@ -143,6 +143,8 @@ class GenericMethodWrapper : public Utils::CloneInterface