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
460 stars 76 forks source link

Calculate chemical equilibrium for system with equilibrium constants? #525

Open ctessum opened 2 years ago

ctessum commented 2 years ago

Hello,

I have a system of chemical reactions that describe the thermodynamic equilibrium of a system. It is described as a system of reactions, and each reaction has an equilibrium constant. (The specific system in question is Table 2 in this paper.)

This use case seems a little different than the Catalyst documentation and examples, i.e. the reaction constants represent equilibrium (unitless) rather than rate (1/s) and the system should end up being a NonlinearSystem of equations instead of an ODESystem. Is there a way to represent this type of reaction system using Catalyst? Thanks for your help!

cc @jialinl6

TorkelE commented 2 years ago

I am not sure I understand fully, but:

isaacsas commented 2 years ago

Catalyst doesn't currently have functionality to solve for the equilibrium of the system as you'd want it, or anything built in to understand most thermodynamic rate quantities you might want to manipulate or use in model formulation (beyond seeing them as parameters or symbolic variables of the system). Catalyst can currently generate a system of nonlinear equations that correspond to steady-states of the mass action ODE model associated with the reactions, but not the stricter set of equations that arise from using detailed balance and reversibility. I also don't think you could correctly formulate the reaction model in Catalyst when only knowing equilibrium constants (though I guess you could include symbolic forward and reverse rates, and then substitute one of them out before doing a steady-state calculation).

That said, we should definitely think about offering a way to do some equilibrium analysis on Catalyst models longer term.

ctessum commented 2 years ago

Thanks for the responses! I think we can implement our system as a NonlinearSystem for now, but we would be a user of this feature if it ever gets implemented :)

isaacsas commented 2 years ago

I'm going to leave this open as a reminder that we could at least try to make something work for fully reversible systems.

isaacsas commented 2 years ago

Also, I'd be interested in seeing the form of the nonlinear system you want to solve. Just to make sure I understand the equations you are expecting.

ctessum commented 2 years ago

Sure, we can share the system once we have something put together.