From 2dcd19a853041bf24a3d53ebe358305bd7b0fb8c Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 23 Apr 2024 13:17:09 +0200 Subject: [PATCH] .. --- python/sdist/amici/sbml_import.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/python/sdist/amici/sbml_import.py b/python/sdist/amici/sbml_import.py index a54f8ebe0b..d207ffbf9a 100644 --- a/python/sdist/amici/sbml_import.py +++ b/python/sdist/amici/sbml_import.py @@ -556,9 +556,14 @@ def _build_ode_model( dxdt = smart_multiply( self.stoichiometric_matrix, MutableDenseMatrix(fluxes) ) - # there may be an additional 0-entry at the end of the - # stoichiometric matrix / flux vector - assert dxdt.shape[0] - len(self.symbols[SymbolId.SPECIES]) in (0, 1) + # dxdt has algebraic states at the end + assert dxdt.shape[0] - len(self.symbols[SymbolId.SPECIES]) == len( + self.symbols.get(SymbolId.ALGEBRAIC_STATE, []) + ), ( + self.symbols[SymbolId.SPECIES], + dxdt, + self.symbols[SymbolId.SPECIES], + ) # correct time derivatives for compartment changes for ix, ((species_id, species), formula) in enumerate(