Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Apr 23, 2024
1 parent 4fd7a30 commit d3c4fc4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion python/sdist/amici/de_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,8 @@ def _compute_equation(self, name: str) -> None:
if not s.has_conservation_law()
),
self.sym("dx"),
strict=True,
# dx contains extra elements for algebraic states
strict=False,
)
]
+ [eq.get_val() for eq in self._algebraic_equations]
Expand Down
6 changes: 5 additions & 1 deletion python/sdist/amici/sbml_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,13 @@ 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)

# correct time derivatives for compartment changes
for ix, ((species_id, species), formula) in enumerate(
zip(self.symbols[SymbolId.SPECIES].items(), dxdt, strict=True)
zip(self.symbols[SymbolId.SPECIES].items(), dxdt, strict=False)
):
# rate rules and amount species don't need to be updated
if "dt" in species:
Expand Down

0 comments on commit d3c4fc4

Please sign in to comment.