You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:(ReactionSystem(Reaction[], t, [], []; name =$(QuoteNode(name)))))
215
209
end
216
210
211
+
### Internal DSL Structures ###
217
212
218
-
### Macros used for manipulating, and successively builing up, reaction systems. ###
219
-
@docraw"""
220
-
@reaction
221
-
222
-
Generates a single [`Reaction`](@ref) object.
223
-
224
-
Examples:
225
-
```julia
226
-
rx = @reaction k*v, A + B --> C + D
227
-
228
-
# is equivalent to
229
-
t = default_t()
230
-
@parameters k v
231
-
@species A(t) B(t) C(t) D(t)
232
-
rx == Reaction(k*v, [A,B], [C,D])
233
-
```
234
-
Here `k` and `v` will be parameters and `A`, `B`, `C` and `D` will be variables.
235
-
Interpolation of existing parameters/variables also works
236
-
```julia
237
-
t = default_t()
238
-
@parameters k b
239
-
@species A(t)
240
-
ex = k*A^2 + t
241
-
rx = @reaction b*$ex*$A, $A --> C
242
-
```
243
-
244
-
Notes:
245
-
- Any symbols arising in the rate expression that aren't interpolated are treated as
246
-
parameters. In the reaction part (`α*A + B --> C + D`), coefficients are treated as
247
-
parameters, e.g. `α`, and rightmost symbols as species, e.g. `A,B,C,D`.
248
-
- Works with any *single* arrow types supported by [`@reaction_network`](@ref).
249
-
- Interpolation of Julia variables into the macro works similar to the `@reaction_network`
250
-
macro. See [The Reaction DSL](@ref dsl_description) tutorial for more details.
251
-
"""
252
-
macroreaction(ex)
253
-
make_reaction(ex)
254
-
end
255
-
256
-
257
-
### Internal DSL structures for representing reactants and reactions. ###
258
-
259
-
#Structure containing information about one reactant in one reaction.
213
+
# Structure containing information about one reactant in one reaction.
260
214
struct ReactantStruct
261
215
reactant::Union{Symbol, Expr}
262
216
stoichiometry::ExprValues
263
217
end
264
-
#Structure containing information about one Reaction. Contain all its substrates and products as well as its rate. Contains a specialized constructor.
218
+
219
+
# Structure containing information about one Reaction. Contain all its substrates and products as well as its rate. Contains a specialized constructor.
265
220
struct ReactionStruct
266
221
substrates::Vector{ReactantStruct}
267
222
products::Vector{ReactantStruct}
@@ -279,23 +234,6 @@ end
279
234
280
235
### Functions rephrasing the macro input as a ReactionSystem structure. ###
0 commit comments