Beispiel #1
0
        "Error: variable MCELL_PATH that is used to find the mcell library was not set."
    )
    sys.exit(1)

import mcell as m

model = m.Model()

a = m.Species('a', diffusion_constant_3d=1e-6)
model.add_species(a)
s1 = model.find_species('a')
assert s1 is not None and s1.name == 'a'
s2 = model.find_species('b')
assert s2 is None

r = m.ReactionRule('r', [a.inst()], [], 0)
model.add_reaction_rule(r)
r1 = model.find_reaction_rule('r')
assert r1 is not None and r1.name == 'r'
r2 = model.find_reaction_rule('s')
assert r2 is None

sc = m.SurfaceClass('sc',
                    type=m.SurfacePropertyType.TRANSPARENT,
                    affected_complex_pattern=a)
model.add_surface_class(sc)
sc1 = model.find_surface_class('sc')
assert sc1 is not None and sc1.name == 'sc'
sc2 = model.find_surface_class('scx')
assert sc2 is None
Beispiel #2
0
Sphere2.surface_compartment_name = 'PM2'

model.add_geometry_object(Sphere1)
model.add_geometry_object(Sphere2)

# load information on species and on our reaction
model.load_bngl('model.bngl')

# define reflective surface classes for our regions - same as in the lipid raft example so that
# our molecules don't diffuse away for the regions where the 'cells' touch
# when using the surface class, the molecules weirdly agreggate at its boundary,
# this is probably something to be checked.
# however in reality the whole object won't more so quickly so
# this might not be an issue
lipid_raft_A = m.SurfaceClass(name='lipid_raft_A',
                              type=m.SurfacePropertyType.REFLECTIVE,
                              affected_complex_pattern=m.Complex('A'))

lipid_raft_B = m.SurfaceClass(name='lipid_raft_B',
                              type=m.SurfacePropertyType.REFLECTIVE,
                              affected_complex_pattern=m.Complex('B'))
model.add_surface_class(lipid_raft_A)
model.add_surface_class(lipid_raft_B)

Sphere1_right.surface_class = lipid_raft_A
Sphere2_left.surface_class = lipid_raft_B

# release molecules in specified regions
rel_A = m.ReleaseSite(name='rel_A',
                      complex=m.Complex('A', orientation=m.Orientation.UP),
                      region=Sphere1_right,
Beispiel #3
0
import mcell as m

from parameters import *
from bngl_molecule_types_info import *

# ---- subsystem ----

cclamp_left = m.SurfaceClass(
    name='cclamp_left',
    type=m.SurfacePropertyType.CONCENTRATION_CLAMP,
    affected_complex_pattern=m.Complex(
        'a', orientation=m.Orientation.DOWN
    ),  # DOWN means towards the center of the object 
    concentration=1e-5)

cclamp_right = m.SurfaceClass(name='cclamp_right',
                              type=m.SurfacePropertyType.CONCENTRATION_CLAMP,
                              affected_complex_pattern=m.Complex(
                                  'a', orientation=m.Orientation.DOWN),
                              concentration=1e-7)

subsystem = m.Subsystem()
subsystem.add_surface_class(cclamp_left)
subsystem.add_surface_class(cclamp_right)

# load subsystem information from bngl file
subsystem.load_bngl_molecule_types_and_reaction_rules('model.bngl')
# set additional information such as diffusion constants for loaded elementary molecule types
set_bngl_molecule_types_info(subsystem)
Beispiel #4
0
import os

MCELL_PATH = os.environ.get('MCELL_PATH', '')
if MCELL_PATH:
    sys.path.append(os.path.join(MCELL_PATH, 'lib'))
else:
    print(
        "Error: variable MCELL_PATH that is used to find the mcell library was not set."
    )
    sys.exit(1)

import mcell as m

# single property
sc1 = m.SurfaceClass('sc',
                     type=m.SurfacePropertyType.REFLECTIVE,
                     affected_complex_pattern=m.Complex('X(y!1).Y(x!1)'))

sc2 = m.SurfaceClass('sc',
                     type=m.SurfacePropertyType.TRANSPARENT,
                     affected_complex_pattern=m.Complex('X(y!1).Y(x!1)'))

assert sc1 != sc2

sc3 = m.SurfaceClass('sc',
                     type=m.SurfacePropertyType.TRANSPARENT,
                     affected_complex_pattern=m.Complex('Y(x!1).X(y!1)'))

assert sc3 == sc2

# multiple properties
Beispiel #5
0
# WARNING: This is an automatically generated file and will be overwritten
#          by CellBlender on the next model export.

import os
import shared
import mcell as m

from parameters import *

# ---- subsystem ----

MODEL_PATH = os.path.dirname(os.path.abspath(__file__))

empty = m.SurfaceClass(name='empty', type=m.SurfacePropertyType.REACTIVE)

unnamed_reaction_rule_0 = m.ReactionRule(
    name='unnamed_reaction_rule_0',
    reactants=[
        m.Complex('vol1', orientation=m.Orientation.DOWN),
        m.Complex('empty', orientation=m.Orientation.UP)
    ],
    products=[m.Complex('vol2', orientation=m.Orientation.UP)],
    fwd_rate=1e7)

# ---- create subsystem object and add components ----

subsystem = m.Subsystem()
subsystem.add_surface_class(empty)
subsystem.add_reaction_rule(unnamed_reaction_rule_0)

# load subsystem information from bngl file
Beispiel #6
0
# WARNING: This is an automatically generated file and will be overwritten
#          by CellBlender on the next model export.

import os
import shared
import mcell as m

from parameters import *

# ---- subsystem ----

MODEL_PATH = os.path.dirname(os.path.abspath(__file__))

reflect_edge = m.SurfaceClass(name='reflect_edge',
                              type=m.SurfacePropertyType.REFLECTIVE,
                              affected_complex_pattern=m.AllSurfaceMolecules)

# ---- create subsystem object and add components ----

subsystem = m.Subsystem()
subsystem.add_surface_class(reflect_edge)

# load subsystem information from bngl file
subsystem.load_bngl_molecule_types_and_reaction_rules(
    os.path.join(MODEL_PATH, 'model.bngl'), shared.parameter_overrides)
Beispiel #7
0
import mcell as m

from parameters import *
from bngl_molecule_types_info import *

# ---- subsystem ----

transp = m.SurfaceClass(name='transp',
                        type=m.SurfacePropertyType.TRANSPARENT,
                        affected_complex_pattern=m.AllMolecules)

subsystem = m.Subsystem()
subsystem.add_surface_class(transp)

# load subsystem information from bngl file
subsystem.load_bngl_molecule_types_and_reaction_rules('model.bngl')
# set additional information such as diffusion constants for loaded elementary molecule types
set_bngl_molecule_types_info(subsystem)
Beispiel #8
0
model.config.total_iterations = ITERATIONS

model.config.partition_dimension = 10
model.config.subpartition_dimension = 2.5

# ---- default configuration overrides ----

# ---- add components ----

model.add_geometry_object(Cube)

model.load_bngl('model.bngl', '', Cube)


surf = m.SurfaceClass(
    name = 'surf',
    type = m.SurfacePropertyType.REACTIVE
)

rxn = m.ReactionRule(
    name = 'rxn',
    reactants = [ m.Complex('v', orientation = m.Orientation.DOWN), m.Complex('surf', orientation = m.Orientation.UP) ],
    products = [ m.Complex('s', orientation = m.Orientation.UP) ],
    fwd_rate = 1e+07
)

Cube_membrane.surface_class = surf

model.add_surface_class(surf)
model.add_reaction_rule(rxn)