Skip to content

Commit 6712f42

Browse files
authored
fix for bidirectional reactions (#10)
* update index.md with shorthand for reaction keywords * debugging * found error * remove commented out line [skip ci]
1 parent 046e0bf commit 6712f42

File tree

3 files changed

+37
-16
lines changed

3 files changed

+37
-16
lines changed

docs/src/index.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@
77

88
## Modify a model
99

10-
We list common transition attributes:
11-
12-
| attribute | interpretation |
13-
| :----- | :----- |
14-
| `transPriority` | priority of a transition (influences resource allocation) |
15-
| `transProbOfSuccess` | probability that a transition terminates successfully |
16-
| `transCapacity` | maximum number of concurrent instances of the transition |
17-
| `transCycleTime` | duration of a transition's instance (adjusted by resource allocation) |
18-
| `transMaxLifeTime` | maximal duration of a transition's instance |
19-
| `transPostAction` | action to be executed once a transition's instance terminates |
20-
| `transName` | name of a transition |
10+
We list common transition attributes. When being specified using the `@ReactionNetwork` macro they can be conveniently referred to using their shorthand description.
11+
12+
| attribute | shorthand | interpretation |
13+
| :----- | :----- | :----- |
14+
| `transPriority` | `priority` | priority of a transition (influences resource allocation) |
15+
| `transProbOfSuccess` | `probability` `prob` `pos` | probability that a transition terminates successfully |
16+
| `transCapacity` | `cap` `capacity` | maximum number of concurrent instances of the transition |
17+
| `transCycleTime` | `ct` `cycletime` | duration of a transition's instance (adjusted by resource allocation) |
18+
| `transMaxLifeTime` | `lifetime` `maxlifetime` `maxtime` `timetolive` | maximal duration of a transition's instance |
19+
| `transPostAction` | `postAction` `post` | action to be executed once a transition's instance terminates |
20+
| `transName` | `name` `interpretation` | name of a transition, either a string or unquoted text |
2121

2222
We list common species attributes:
2323

24-
| attribute | interpretation |
25-
| :----- | :----- |
26-
| `specInitUncertainty` | uncertainty about variable's initial state (modelled as Gaussian standard deviation) |
27-
| `specInitVal` | initial value of a variable |
24+
| attribute | shorthand | interpretation |
25+
| :----- | :----- | :----- |
26+
| `specInitUncertainty` | `uncertainty` `stoch` `stochasticity` | uncertainty about variable's initial state (modelled as Gaussian standard deviation) |
27+
| `specInitVal` | | initial value of a variable |
2828

2929
Moreover, it is possible to specify the semantics of the "rate" term. By default, at each time step `n ~ Poisson(rate * dt)` instances of a given transition will be spawned. If you want to specify the rate in terms of a cycle time, you may want to use `@ct(cycle_time)`, e.g., `@ct(ex), A --> B, ...`. This is a shorthand for `1/ex, A --> B, ...`.
3030

src/interface/create.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function get_transitions!(trans, reactants, pcs, exs)
173173
(rate, r_line) = exs[1:2]
174174
rxs = prune_reaction_line!(pcs, reactants, r_line)
175175
rate = expand_rate(rate)
176-
rxs = rxs isa Tuple ? tuple.(rate.args, rxs) : ((rate, rxs),)
176+
rxs = rxs isa Tuple ? tuple.(fill(rate, length(rxs)), rxs) : ((rate, rxs),)
177177

178178
exs = exs[3:end]
179179
empty!(args)

tutorial/basics.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using ReactiveDynamics
2+
3+
# acs = @ReactionNetwork begin
4+
# 1.0, X ⟺ Y
5+
# end
6+
7+
acs = @ReactionNetwork begin 1.0, X Y, name => "transition1" end
8+
9+
@prob_init acs X=10 Y=20
10+
@prob_params acs
11+
@prob_meta acs tspan=250 dt=0.1
12+
13+
prob = @problematize acs
14+
15+
# sol = ReactiveDynamics.solve(prob)
16+
17+
sol = @solve prob trajectories=20
18+
19+
using Plots
20+
21+
@plot sol plot_type=summary

0 commit comments

Comments
 (0)