In [ ]:
%matplotlib inline
import moose
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy
In [ ]:
def displayPlots():
'''Plotting concentration of reacting entities over time.'''
for x in moose.wildcardFind( '/model/graphs/conc#/#' ):
t = numpy.arange( 0, x.vector.size, 1 ) #sec
plt.plot( t, x.vector, label=x.name )
plt.xlabel("Time (s)")
plt.ylabel("Concentration (mM)")
plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
ncol=3, mode="expand", borderaxespad=0.)
plt.show()
In [ ]:
solver = "gsl" # Pick any of gsl, gssa, ee..
#moose.seed(124) # Important for stochastic simulation
mfile = 'M1719.g'
runtime = 100.0 #s
volume = 0.2e-18 #m^3
In [ ]:
moose.loadModel( mfile, '/model', solver )
In [ ]:
compartment = moose.element( 'model/kinetics' )
compartment.volume = volume #
r = moose.element( '/model/kinetics/equil' )
moose.reinit()
moose.start( runtime )
r.Kf *= 1.1 # small tap to break symmetry
moose.start( runtime )
r.Kf = r.Kb
moose.start( runtime )
r.Kb *= 2.0 # Moderate push does not tip it back.
moose.start( runtime )
r.Kb = r.Kf
moose.start( runtime )
r.Kb *= 5.0 # Strong push does tip it over
moose.start( runtime )
r.Kb = r.Kf
moose.start( runtime )
r.Kf *= 5.0 # Strong push tips it back.
moose.start( runtime )
r.Kf = r.Kb
moose.start( runtime )
displayPlots()
In [ ]: