SciML / Catalyst.jl

Chemical reaction network and systems biology interface for scientific machine learning (SciML). High performance, GPU-parallelized, and O(1) solvers in open source software.
https://docs.sciml.ai/Catalyst/stable/
Other
463 stars 78 forks source link

use MTK macro processing code instead of writing custom DSL code #1023

Open isaacsas opened 3 months ago

isaacsas commented 3 months ago

On a quick skim, it appears subsets of our DSL macro processing code overlap with MTK macro processing code. We should switch to MTK's code as much as possible to avoid needing to maintain our own macros (for example @equation), and to ensure feature compatibility with MTK.

edit: Perhaps this isn't possible but it would be good to really make sure we can't reuse their code (similar to how we defined @species using their code as a base).

TorkelE commented 3 months ago

We do go through some MTK stuff, i.e. use the ModelingToolkit.parse_equations! for the equations. The rest of the equation code is basically just extracting differentials and variables from D(X).

Especially when MTK have settled down though, we should do a pass through everything to ensure that we are non unnecessarily re-implementing anything. Let's keep this open until we get there.

isaacsas commented 3 months ago

OK, good. I missed that we use parse_equations! now (there is a lot of DSL code at this point...).

TorkelE commented 3 months ago

yeah, the DSL code has gotten increasingly messy over the last while. I tried to clean it up a bit in https://github.com/SciML/Catalyst.jl/pull/985, but even after that more could probably be done to get it up to the standard of the rest of the package.