Kappa-Dev / KappaTools

Tool suite for kappa models. Documentation and binaries can be found in the release section. Try it online at
http://kappalanguage.org/
GNU Lesser General Public License v3.0
113 stars 41 forks source link

Zero activity, all rules dead, no events, never-ending simulation #563

Closed hmedina closed 5 years ago

hmedina commented 5 years ago

The following model, with extreme parameters, produces a "simulation" that has zero activity, where all rules are dead, where there is nothing to do, and yet the simulation will never end.

Invokation: KaSim -i model.ka -var scale 1e-4

Model:

%var: 'Avo' 6.022e23            %var: 'Vol' 2.25e-12 * 'scale'

%var: 'AV' 'Avo' * 'Vol'        %var: 'A0' 0.07e-9 * 'AV'
%var: 'Keq' 1.0e12              %var: 'Γeq' 'Keq' / 'AV'
%var: 'k+' 1.0e8                %var: 'γ+' 'k+' / 'AV'
%var: 'k-' 'k+' / 'Keq'         %var: 'γ-' 'k-'
// Xenopus Axin concentration, mammalian volume, picoMolar affinity
%agent: A(m, n)     %init: 'A0' A()
A(m[./1]), A(n[./1]) @ 'γ+' {0}
A(m[1/.]), A(n[1/.]) @ 'γ-'

%obs: 'γ^+' 'γ+'
%obs: 'γ^-' 'γ-'
%obs: 'Γ_{eq}' 'Γeq'
%obs: 'A.m!n.A' |A(m[1]), A(n[1])|
%obs: 'A.m!.' |A(m[.])|
%obs: 'A.n!.' |A(n[.])|
%obs: 'Γ_{eq}/A_t' 'Γeq' / 'A0'
%plot: 'A0'

%mod: alarm 1.0 ([T] > 100) do $SNAPSHOT ; repeat [true]
%mod: [T] > 1100 do $STOP ;

Stdout:

Parsing model.ka...
done
+ simulation parameters
+ Sanity checks
+ Compiling...
+ Building initial simulation conditions...
         -variable declarations
         -rules
         -interventions
         -observables
         -update_domain construction
         4 (sub)observables 0 navigation steps
         -initial conditions
+ Self seeding...
+ Building initial state (1 agents)
Done
+ Command line to rerun is: 'KaSim' '-i' 'model.ka' '-var' 'scale' '1e-4' '-d' '-4' -seed 83065570
2126.00 time units in 0 events

What is keeping the simulation alive? It got to a time that was greater than 1100, and yet it didn't trigger the $STOP perturbation...