From c038ff5264bc384e737d5aeee7f2411493fe2c22 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 18 Oct 2023 14:10:13 +0200 Subject: [PATCH 1/3] Fix incorrect path in LICENSE.md --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index d504f8447a..4dadbc28a9 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -27,7 +27,7 @@ The AMICI logo is released under the Creative Commons CC0 1.0 Universal * Parts of the *SUNDIALS* solver suite are redistributed under the BSD 3-Clause License (BSD-3-Clause) with terms given in - `ThirdParty/SuiteSparse/LICENSE.txt` + `ThirdParty/sundials/LICENSE` * Parts of *SuiteSparse* are redistributed under the various licenses with the terms given in `ThirdParty/SuiteSparse/LICENSE.txt` * *gsl-lite* is redistributed under the MIT License (MIT) with the terms given From fb2a101647eb4ebd0c04bf929ade862f2be927de Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 30 Oct 2023 10:54:10 +0100 Subject: [PATCH 2/3] Fix CMake cmake_minimum_required deprecation warning (#2183) Fixes ``` CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions. ``` --- tests/cpp/CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cpp/CMakeLists.txt.in b/tests/cpp/CMakeLists.txt.in index 0704ae5d1e..a93f5955c2 100644 --- a/tests/cpp/CMakeLists.txt.in +++ b/tests/cpp/CMakeLists.txt.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.15) project(googletest-download NONE) From 492e48056d99ebaf8435706a6e144c8899d46975 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 30 Oct 2023 13:07:07 +0100 Subject: [PATCH 3/3] Fix Fix misleading preequilibration failure messages (#2181) When preequilibration (or finding a steadystate in general) fails, `SteadystateProblem::handleSteadyStateFailure` produced `AMICI simulation failed: Steady state computation failed. First run of Newton solver failed. Simulation to steady state failed: No convergence was achieved. Second run of Newton solver failed.`, even in cases where no Newton solve or no simulation was attempted. This is confusing and is changed here, so that the message now reflects what has actually happened. Closes #2178 --- include/amici/steadystateproblem.h | 11 ++++++++-- src/steadystateproblem.cpp | 34 +++++++++++++++++++----------- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/include/amici/steadystateproblem.h b/include/amici/steadystateproblem.h index b3af55c20a..dc19c014c4 100644 --- a/include/amici/steadystateproblem.h +++ b/include/amici/steadystateproblem.h @@ -208,8 +208,15 @@ class SteadystateProblem { /** * @brief Stores state and throws an exception if equilibration failed - */ - [[noreturn]] void handleSteadyStateFailure(); + * @param tried_newton_1 Whether any Newton step was attempted before + * simulation + * @param tried_simulation Whether simulation was attempted + * @param tried_newton_2 Whether any Newton step was attempted after + * simulation + */ + [[noreturn]] void handleSteadyStateFailure( + bool tried_newton_1, bool tried_simulation, bool tried_newton_2 + ); /** * @brief Assembles the error message to be thrown. diff --git a/src/steadystateproblem.cpp b/src/steadystateproblem.cpp index 816d0a4c53..c655b9b386 100644 --- a/src/steadystateproblem.cpp +++ b/src/steadystateproblem.cpp @@ -60,9 +60,9 @@ SteadystateProblem::SteadystateProblem(Solver const& solver, Model const& model) "sensitivities during simulation"); if (solver.getSensitivityMethod() == SensitivityMethod::forward && model.getSteadyStateComputationMode() - == SteadyStateComputationMode::newtonOnly + == SteadyStateComputationMode::newtonOnly && model.getSteadyStateSensitivityMode() - == SteadyStateSensitivityMode::integrationOnly) + == SteadyStateSensitivityMode::integrationOnly) throw AmiException("For forward sensitivity analysis steady-state " "computation mode 'newtonOnly' and steady-state " "sensitivity mode 'integrationOnly' are not " @@ -152,7 +152,10 @@ void SteadystateProblem::findSteadyState( /* Nothing worked, throw an as informative error as possible */ if (!checkSteadyStateSuccess()) - handleSteadyStateFailure(); + handleSteadyStateFailure( + !turnOffNewton, !turnOffSimulation, + !turnOffNewton && !turnOffSimulation + ); } void SteadystateProblem::findSteadyStateByNewtonsMethod( @@ -394,16 +397,23 @@ void SteadystateProblem::getQuadratureBySimulation( } } -[[noreturn]] void SteadystateProblem::handleSteadyStateFailure() { +[[noreturn]] void SteadystateProblem::handleSteadyStateFailure( + bool tried_newton_1, bool tried_simulation, bool tried_newton_2 +) { /* Throw error message according to error codes */ - std::string errorString = "Steady state computation failed. " - "First run of Newton solver failed"; - writeErrorString(&errorString, steady_state_status_[0]); - errorString.append(" Simulation to steady state failed"); - writeErrorString(&errorString, steady_state_status_[1]); - errorString.append(" Second run of Newton solver failed"); - writeErrorString(&errorString, steady_state_status_[2]); - + std::string errorString = "Steady state computation failed."; + if (tried_newton_1) { + errorString.append(" First run of Newton solver failed"); + writeErrorString(&errorString, steady_state_status_[0]); + } + if (tried_simulation) { + errorString.append(" Simulation to steady state failed"); + writeErrorString(&errorString, steady_state_status_[1]); + } + if (tried_newton_2) { + errorString.append(" Second run of Newton solver failed"); + writeErrorString(&errorString, steady_state_status_[2]); + } throw AmiException(errorString.c_str()); }