Skip to content

Commit

Permalink
fix for bidirectional reactions (#10)
Browse files Browse the repository at this point in the history
* update index.md with shorthand for reaction keywords

* debugging

* found error

* remove commented out line

[skip ci]
  • Loading branch information
slwu89 authored Mar 2, 2023
1 parent 046e0bf commit 6712f42
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 16 deletions.
30 changes: 15 additions & 15 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@

## Modify a model

We list common transition attributes:

| attribute | interpretation |
| :----- | :----- |
| `transPriority` | priority of a transition (influences resource allocation) |
| `transProbOfSuccess` | probability that a transition terminates successfully |
| `transCapacity` | maximum number of concurrent instances of the transition |
| `transCycleTime` | duration of a transition's instance (adjusted by resource allocation) |
| `transMaxLifeTime` | maximal duration of a transition's instance |
| `transPostAction` | action to be executed once a transition's instance terminates |
| `transName` | name of a transition |
We list common transition attributes. When being specified using the `@ReactionNetwork` macro they can be conveniently referred to using their shorthand description.

| attribute | shorthand | interpretation |
| :----- | :----- | :----- |
| `transPriority` | `priority` | priority of a transition (influences resource allocation) |
| `transProbOfSuccess` | `probability` `prob` `pos` | probability that a transition terminates successfully |
| `transCapacity` | `cap` `capacity` | maximum number of concurrent instances of the transition |
| `transCycleTime` | `ct` `cycletime` | duration of a transition's instance (adjusted by resource allocation) |
| `transMaxLifeTime` | `lifetime` `maxlifetime` `maxtime` `timetolive` | maximal duration of a transition's instance |
| `transPostAction` | `postAction` `post` | action to be executed once a transition's instance terminates |
| `transName` | `name` `interpretation` | name of a transition, either a string or unquoted text |

We list common species attributes:

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

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, ...`.

Expand Down
2 changes: 1 addition & 1 deletion src/interface/create.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function get_transitions!(trans, reactants, pcs, exs)
(rate, r_line) = exs[1:2]
rxs = prune_reaction_line!(pcs, reactants, r_line)
rate = expand_rate(rate)
rxs = rxs isa Tuple ? tuple.(rate.args, rxs) : ((rate, rxs),)
rxs = rxs isa Tuple ? tuple.(fill(rate, length(rxs)), rxs) : ((rate, rxs),)

exs = exs[3:end]
empty!(args)
Expand Down
21 changes: 21 additions & 0 deletions tutorial/basics.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using ReactiveDynamics

# acs = @ReactionNetwork begin
# 1.0, X ⟺ Y
# end

acs = @ReactionNetwork begin 1.0, X Y, name => "transition1" end

@prob_init acs X=10 Y=20
@prob_params acs
@prob_meta acs tspan=250 dt=0.1

prob = @problematize acs

# sol = ReactiveDynamics.solve(prob)

sol = @solve prob trajectories=20

using Plots

@plot sol plot_type=summary

0 comments on commit 6712f42

Please sign in to comment.