Catalyst.jl icon indicating copy to clipboard operation
Catalyst.jl copied to clipboard

disallow repeated substrates or products in reactions

Open isaacsas opened this issue 2 years ago • 2 comments

From https://discourse.julialang.org/t/read-in-network-does-not-match-hard-coded-network/81997/5

rx = @reaction k, A+A --> B
@parameters k
@variables t A(t) B(t)
rx2 = Reaction(k, [A,A], [B], [1,1], [1])
rx != rx2   # true

We need an error check here (perhaps with a kwarg to disable), or need to detect this and correct the substrates/products.

isaacsas avatar May 31 '22 14:05 isaacsas

While I agree

rx = @reaction k, 2A --> B

is much better than

rx = @reaction k, A+A --> B

is there a strong reason to disallow the latter?

TorkelE avatar Aug 01 '22 08:08 TorkelE

We support both notations via the DSL. The issue is in symbolically building Reactions -- they currently assume their inputs are unique, and I think they should stay that way for internal use. So we either need an error check in their constructor or we need to normalize them in the constructor by merging repeated species.

isaacsas avatar Aug 01 '22 11:08 isaacsas