def makeModel(): # create container for model num = 1 # number of compartments model = moose.Neutral( '/model' ) compartment = moose.CylMesh( '/model/compartment' ) compartment.x1 = 1.0e-6 # Set it to a 1 micron single-voxel cylinder # create molecules and reactions s = moose.Pool( '/model/compartment/s' ) ##################################################################### # Put in endo compartment. Add molecule s endo = moose.EndoMesh( '/model/endo' ) endo.isMembraneBound = True endo.surround = compartment es = moose.Pool( '/model/endo/s' ) rXfer = moose.Reac( '/model/endo/rXfer' ) ##################################################################### moose.connect( rXfer, 'sub', s, 'reac' ) moose.connect( rXfer, 'prd', es, 'reac' ) volRatio = compartment.volume / endo.volume rXfer.Kf = 0.04 # 0.04/sec rXfer.Kb = 0.02 # 0.02/sec ##################################################################### fixXreacs.fixXreacs( '/model' ) #fixXreacs.restoreXreacs( '/model' ) #fixXreacs.fixXreacs( '/model' ) ##################################################################### # Make solvers ksolve = moose.Ksolve( '/model/compartment/ksolve' ) dsolve = moose.Dsolve( '/model/dsolve' ) eksolve = moose.Ksolve( '/model/endo/ksolve' ) edsolve = moose.Dsolve( '/model/endo/dsolve' ) stoich = moose.Stoich( '/model/compartment/stoich' ) stoich.compartment = compartment stoich.ksolve = ksolve stoich.dsolve = dsolve stoich.path = "/model/compartment/##" assert( dsolve.numPools == 1 ) s.vec.concInit = [1]*num estoich = moose.Stoich( '/model/endo/stoich' ) estoich.compartment = endo estoich.ksolve = eksolve estoich.dsolve = edsolve estoich.path = "/model/endo/##" assert( edsolve.numPools == 2 ) edsolve.buildMeshJunctions( dsolve ) plot1 = moose.Table2( '/model/plot1' ) plot2 = moose.Table2( '/model/plot2' ) moose.connect( '/model/plot1', 'requestOut', s, 'getN' ) moose.connect( '/model/plot2', 'requestOut', es, 'getN' ) plot3 = moose.Table2( '/model/plot3' ) plot4 = moose.Table2( '/model/plot4' ) moose.connect( '/model/plot3', 'requestOut', s, 'getConc' ) moose.connect( '/model/plot4', 'requestOut', es, 'getConc' )
def makeModel(): # create container for model num = 1 # number of compartments model = moose.Neutral('/model') compartment = moose.CylMesh('/model/compartment') compartment.x1 = 1.0e-6 # Set it to a 1 micron single-voxel cylinder # create molecules and reactions prd = moose.Pool('/model/compartment/prd') rXfer = moose.Reac('/model/compartment/rXfer') ##################################################################### # Put in endo compartment. Add molecule s endo = moose.EndoMesh('/model/endo') endo.isMembraneBound = True endo.surround = compartment sub = moose.Pool('/model/endo/sub') enzPool = moose.Pool('/model/endo/enzPool') enzPool.concInit = eInit enz = moose.MMenz('/model/endo/enzPool/enz') ##################################################################### moose.connect(enz, 'sub', sub, 'reac') moose.connect(enz, 'prd', prd, 'reac') moose.connect(enzPool, 'nOut', enz, 'enzDest') moose.connect(rXfer, 'sub', prd, 'reac') moose.connect(rXfer, 'prd', sub, 'reac') rXfer.Kf = Kf # 0.04/sec rXfer.Kb = 0.0 # 0.02/sec enz.Km = Km enz.kcat = kcat # v = es.kcat/(s+Km) # v = Kf * conc. ##################################################################### fixXreacs.fixXreacs('/model') fixXreacs.restoreXreacs('/model') fixXreacs.fixXreacs('/model') ##################################################################### # Make solvers ksolve = moose.Ksolve('/model/compartment/ksolve') dsolve = moose.Dsolve('/model/dsolve') eksolve = moose.Ksolve('/model/endo/ksolve') edsolve = moose.Dsolve('/model/endo/dsolve') stoich = moose.Stoich('/model/compartment/stoich') stoich.compartment = compartment stoich.ksolve = ksolve stoich.dsolve = dsolve stoich.path = "/model/compartment/##" assert (dsolve.numPools == 2) sub.vec.concInit = subInit enzPool.vec.concInit = eInit estoich = moose.Stoich('/model/endo/stoich') estoich.compartment = endo estoich.ksolve = eksolve estoich.dsolve = edsolve estoich.path = "/model/endo/##" assert (edsolve.numPools == 3) edsolve.buildMeshJunctions(dsolve) plot1 = moose.Table2('/model/plot1') plot2 = moose.Table2('/model/plot2') moose.connect('/model/plot1', 'requestOut', sub, 'getN') moose.connect('/model/plot2', 'requestOut', prd, 'getN') plot3 = moose.Table2('/model/plot3') plot4 = moose.Table2('/model/plot4') moose.connect('/model/plot3', 'requestOut', sub, 'getConc') moose.connect('/model/plot4', 'requestOut', prd, 'getConc')
def makeModel(): # create container for model num = 1 # number of compartments model = moose.Neutral('/model') compartment = moose.CylMesh('/model/compartment') compartment.x1 = 1.0e-6 # Set it to a 1 micron single-voxel cylinder # create molecules and reactions s = moose.Pool('/model/compartment/s') rXfer = moose.Reac('/model/compartment/rXfer') ##################################################################### # Put in endo compartment. Add molecule s endo = moose.EndoMesh('/model/endo') # Note that the chanPool must be on the 'In' compartment. #chanPool = moose.Pool( '/model/compartment/chanPool' ) #chan = moose.ConcChan( '/model/compartment/chanPool/chan' ) chanPool = moose.Pool('/model/endo/chanPool') chan = moose.ConcChan('/model/endo/chanPool/chan') endo.isMembraneBound = True endo.surround = compartment es = moose.Pool('/model/endo/s') ##################################################################### moose.connect(rXfer, 'sub', s, 'reac') moose.connect(rXfer, 'prd', es, 'reac') moose.connect(chanPool, 'nOut', chan, 'setNumChan') moose.connect(chan, 'out', s, 'reac') moose.connect(chan, 'in', es, 'reac') volRatio = compartment.volume / endo.volume rXfer.Kf = 0.0 # 0.02/sec rXfer.Kb = 0.0 # s.concInit = 0.001 chanPool.nInit = 1000.0 # Flux (mM/s) = permeability * N * (conc_out - conc_in ) chan.permeability = 0.1 * chanPool.volume * 6.022e23 / chanPool.nInit ##################################################################### fixXreacs.fixXreacs('/model') #fixXreacs.restoreXreacs( '/model' ) #fixXreacs.fixXreacs( '/model' ) ##################################################################### # Make solvers ksolve = moose.Ksolve('/model/compartment/ksolve') dsolve = moose.Dsolve('/model/dsolve') eksolve = moose.Ksolve('/model/endo/ksolve') edsolve = moose.Dsolve('/model/endo/dsolve') stoich = moose.Stoich('/model/compartment/stoich') stoich.compartment = compartment stoich.ksolve = ksolve stoich.dsolve = dsolve stoich.path = "/model/compartment/##" assert (dsolve.numPools == 2) estoich = moose.Stoich('/model/endo/stoich') estoich.compartment = endo estoich.ksolve = eksolve estoich.dsolve = edsolve estoich.path = "/model/endo/##" assert (edsolve.numPools == 2) edsolve.buildMeshJunctions(dsolve) plot1 = moose.Table2('/model/plot1') plot2 = moose.Table2('/model/plot2') plot3 = moose.Table2('/model/plot3') moose.connect('/model/plot1', 'requestOut', s, 'getN') moose.connect('/model/plot2', 'requestOut', es, 'getN') moose.connect('/model/plot3', 'requestOut', '/model/compartment/s_xfer_endo', 'getN') plot4 = moose.Table2('/model/plot4') plot5 = moose.Table2('/model/plot5') plot6 = moose.Table2('/model/plot6') moose.connect('/model/plot4', 'requestOut', s, 'getConc') moose.connect('/model/plot5', 'requestOut', es, 'getConc') moose.connect('/model/plot6', 'requestOut', '/model/compartment/s_xfer_endo', 'getConc')
def makeModel(): # create container for model num = 1 # number of compartments model = moose.Neutral( '/model' ) compartment = moose.CylMesh( '/model/compartment' ) compartment.x1 = 1.0e-6 # Set it to a 1 micron single-voxel cylinder # create molecules and reactions u = moose.Pool( '/model/compartment/u' ) ##################################################################### # Put in endo compartment. Add molecule s endo = moose.EndoMesh( '/model/endo' ) endo.isMembraneBound = True endo.surround = compartment rXfer = moose.Reac( '/model/endo/rXfer' ) et = moose.Pool( '/model/endo/t' ) es = moose.Pool( '/model/endo/s' ) ##################################################################### moose.connect( rXfer, 'sub', u, 'reac' ) moose.connect( rXfer, 'sub', et, 'reac' ) moose.connect( rXfer, 'prd', es, 'reac' ) u.concInit = 1.0 et.concInit = 1.0 ##################################################################### # [u0] = 1 in compt, [t0] = 1 in endo, [s0] = 0 # [u] + [s]/8 = [u0] ; [t] + [s] = [t0]; nu + ns = nu0, nt + ns = nt0 # At equil, numKf*nu*nt = numKb*ns # Express all # in terms of ns. # nu = nu0-ns; nt = nt0-ns Also, nu0 = 8*nt0 # So numKf*(nu0-ns)*(nt0-ns) = numKb*ns # Target level is nt = ns = nt0/2 # So numKf*( 8nt0 - nt0/2)*nt0/2 = numKb*nt0/2 # So 7.5*nt0 = numKb/numKf rXfer.numKb = 0.1 rXfer.numKf = 0.1/(7.5 * et.nInit) #print( "Rates = {}, {}".format( rXfer.Kf, rXfer.Kb )) ##################################################################### fixXreacs.fixXreacs( '/model' ) #fixXreacs.restoreXreacs( '/model' ) #fixXreacs.fixXreacs( '/model' ) ##################################################################### # Make solvers ksolve = moose.Ksolve( '/model/compartment/ksolve' ) dsolve = moose.Dsolve( '/model/compartment/dsolve' ) eksolve = moose.Ksolve( '/model/endo/ksolve' ) edsolve = moose.Dsolve( '/model/endo/dsolve' ) stoich = moose.Stoich( '/model/compartment/stoich' ) stoich.compartment = compartment stoich.ksolve = ksolve stoich.dsolve = dsolve stoich.path = "/model/compartment/##" assert( dsolve.numPools == 1 ) estoich = moose.Stoich( '/model/endo/stoich' ) estoich.compartment = endo estoich.ksolve = eksolve estoich.dsolve = edsolve estoich.path = "/model/endo/##" assert( edsolve.numPools == 3 ) edsolve.buildMeshJunctions( dsolve ) plot1 = moose.Table2( '/model/plot1' ) plot2 = moose.Table2( '/model/plot2' ) plot3 = moose.Table2( '/model/plot3' ) moose.connect( '/model/plot1', 'requestOut', u, 'getN' ) moose.connect( '/model/plot2', 'requestOut', et, 'getN' ) moose.connect( '/model/plot3', 'requestOut', es, 'getN' ) plot4 = moose.Table2( '/model/plot4' ) plot5 = moose.Table2( '/model/plot5' ) plot6 = moose.Table2( '/model/plot6' ) moose.connect( '/model/plot4', 'requestOut', u, 'getConc' ) moose.connect( '/model/plot5', 'requestOut', et, 'getConc' ) moose.connect( '/model/plot6', 'requestOut', es, 'getConc' )