Largely inspired by @ianmkenney's feedback, it would be useful to have a built-in thermodynamic consistency checker which verifies rates are internally consistent for each cycle in a kinetic diagram. If such a function can be written that is sufficiently low cost, it could be checked by a user at any time, and forced to run before any calculations are executed.
Proposed Solution(s)
We discussed a few solutions, each with their own difficulties:
Use sum of free energy differences around the cycle to check thermodynamic consistency. Since the sum of free energy differences around a kinetic cycle must be equal to zero, this would be one way to handle it. Something like this has already been implemented in the EmrE thermodynamic consistency module.
Another method would be to require a user to input units into their expressions and use SymPy units to find intrinsic rates based on their units. The external parameters should be easy to find since they should be the only rates expressed in units of molar concentration.
Potential Pitfalls
Solution 1 has a caveat -- I think the functions used for EmrE are operating on substitution dictionaries (for SymPy) which do not contain the external concentrations. A general approach would need to distinguish between internal/external parameters on its own so a user can implement complicated external parameters (e.g. membrane potential) without breaking the thermodynamic consistency checker. This might require us to make our API more explicit about internal/external parameters, which we make no distinction between at the moment.
Solution 2 may prove to be cumbersome if users have to input units for all expressions since the expressions will eventually have to be simplified by SymPy, which is already very costly.
Motivation
Largely inspired by @ianmkenney's feedback, it would be useful to have a built-in thermodynamic consistency checker which verifies rates are internally consistent for each cycle in a kinetic diagram. If such a function can be written that is sufficiently low cost, it could be checked by a user at any time, and forced to run before any calculations are executed.
Proposed Solution(s)
We discussed a few solutions, each with their own difficulties:
SymPy
units to find intrinsic rates based on their units. The external parameters should be easy to find since they should be the only rates expressed in units of molar concentration.Potential Pitfalls
Solution 1 has a caveat -- I think the functions used for EmrE are operating on substitution dictionaries (for
SymPy
) which do not contain the external concentrations. A general approach would need to distinguish between internal/external parameters on its own so a user can implement complicated external parameters (e.g. membrane potential) without breaking the thermodynamic consistency checker. This might require us to make our API more explicit about internal/external parameters, which we make no distinction between at the moment.Solution 2 may prove to be cumbersome if users have to input units for all expressions since the expressions will eventually have to be simplified by
SymPy
, which is already very costly.