コード例 #1
0
    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

cplx = m.Complex('A(x~0)')
   
assert str(cplx) == 'A(x~0)'
   
assert "elementary_molecule_type=(ElementaryMoleculeType 'A'" in cplx.__str__(all_details=True) 


# species 
spec = m.Species('A', diffusion_constant_3d = 1e-6)

assert str(spec) == 'A'

assert "diffusion_constant_3d=1e-06" in spec.__str__(True) 

# geometry object
box = m.geometry_utils.create_box('box', 1)

#print(len(str(box)))
assert len(str(box)) < 150
   
#print(len(box.__str__(True)))
assert len(box.__str__(True)) > 150

コード例 #2
0
ファイル: subsystem.py プロジェクト: mcellteam/mcell_tests
import mcell as m

from parameters import *

# ---- subsystem ----

b = m.Species(name='b', diffusion_constant_2d=5.00000000000000024e-05)

a = m.Species(name='a', diffusion_constant_3d=9.99999999999999955e-07)

c = m.Species(name='c', diffusion_constant_3d=9.99999999999999955e-07)

react_a_and_b = m.ReactionRule(name='react_a_and_b',
                               reactants=[
                                   a.inst(orientation=m.Orientation.DOWN),
                                   b.inst(orientation=m.Orientation.UP)
                               ],
                               products=[],
                               fwd_rate=1e+08)

subsystem = m.Subsystem()
subsystem.add_species(b)
subsystem.add_species(a)
subsystem.add_species(c)
subsystem.add_reaction_rule(react_a_and_b)
コード例 #3
0
import mcell as m

from parameters import *

# ---- subsystem ----

b = m.Species(name='b', diffusion_constant_3d=4.99999999999999977e-07)

a = m.Species(name='a', diffusion_constant_3d=9.99999999999999955e-07)

c = m.Species(name='c', diffusion_constant_3d=9.99999999999999955e-07)

react_a_and_b = m.ReactionRule(name='react_a_and_b',
                               reactants=[a.inst(), b.inst()],
                               products=[],
                               fwd_rate=5e+08)

subsystem = m.Subsystem()
subsystem.add_species(b)
subsystem.add_species(a)
subsystem.add_species(c)
subsystem.add_reaction_rule(react_a_and_b)
コード例 #4
0
import mcell as m

from parameters import *

# ---- subsystem ----

a = m.Species(name='a', diffusion_constant_3d=9.99999999999999955e-07)

subsystem = m.Subsystem()
subsystem.add_species(a)
コード例 #5
0
ファイル: model.py プロジェクト: mcellteam/mcell_tests
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

subsystem = m.Subsystem()
model = m.Model()

for o, c in [(subsystem, 's'), (model, 'm')]:
    o.add_species(m.Species('A' + c, diffusion_constant_3d=1e-6))

    # must give a warning
    o.add_species(m.Species('A' + c, diffusion_constant_3d=1e-6))
    assert len(o.species) == 1

    try:
        o.add_species(m.Species('A' + c, diffusion_constant_3d=1e-7))
        assert False
    except ValueError as err:
        print(err)

    assert len(o.species) == 1
コード例 #6
0
ファイル: model.py プロジェクト: mcellteam/mcell_tests
import sys
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

C = m.Species(name='C(a)')

assert C.to_bngl_str() == 'C(a)'

# there was a bug where setting compartment name in instantiation changed
# the compartment name for Species
inst = C.inst(compartment_name='EC')
assert inst.to_bngl_str() == 'C(a)@EC'

assert C.to_bngl_str() == 'C(a)'

inst = C.inst(compartment_name='EC')
inst.elementary_molecules[0].compartment_name = 'XX'
assert inst.to_bngl_str() == 'C(a)@XX'

assert C.to_bngl_str() == 'C(a)'
コード例 #7
0
ファイル: subsystem.py プロジェクト: mcellteam/mcell_tests
# 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__))

vm = m.Species(name='vm', diffusion_constant_3d=5.00000000000000024e-05)

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

subsystem = m.Subsystem()
subsystem.add_species(vm)
コード例 #8
0
ファイル: subsystem.py プロジェクト: mcellteam/mcell_tests
import mcell as m

from parameters import *

# ---- subsystem ----

vm = m.Species(name='vm', diffusion_constant_3d=1e-05)

subsystem = m.Subsystem()
subsystem.add_species(vm)
コード例 #9
0
ファイル: model.py プロジェクト: mcellteam/mcell_tests
    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

subsystem = m.Subsystem()
model = m.Model()

for o, c in [(subsystem, 's'), (model, 'm')]:
    # just declarations, expecting that the elementary molecule type
    # will be defined before initialization
    o.add_species(m.Species('B' + c + '(a,b)'))

    # in theory this should not give a warning or error
    # but for consistency, we are reporting an error as well
    try:
        o.add_species(m.Species('B' + c + '(b,a)'))
        assert False
    except ValueError as err:
        print(err)

    # this is ok
    o.add_species(m.Species('C' + c + '(b,a)'))

# also check that initialization fails
# because we don't know the diffusion constant
try:
コード例 #10
0
ファイル: model.py プロジェクト: mcellteam/mcell_tests
import mcell as m

c1_1 = m.ComponentType('C', ['0', '1', 'Z'])
c1_2 = m.ComponentType('C', ['1', '0', 'Z'])
b1 = m.ComponentType('B', ['0', '1', 'Q'])

mt1_1 = m.ElementaryMoleculeType('M', [c1_1, b1], diffusion_constant_3d=1e-6)
mt1_2 = m.ElementaryMoleculeType('M', [b1, c1_2])
mt2 = m.ElementaryMoleculeType('M', [b1, c1_2], diffusion_constant_3d=1e-5)

mt4 = m.ElementaryMoleculeType('N', [b1, b1, c1_1])
mt5 = m.ElementaryMoleculeType('O', [b1, c1_2])

s1_1 = m.Species(
    elementary_molecules=[mt1_1.inst([c1_1.inst('0'),
                                      b1.inst('Q')])])
s1_2 = m.Species(
    elementary_molecules=[mt1_1.inst([b1.inst('Q'),
                                      c1_1.inst('0')])])
assert s1_1 == s1_2

s1_3 = m.Species(
    elementary_molecules=[mt1_2.inst([b1.inst('Q'),
                                      c1_2.inst('0')])])
assert s1_1 == s1_3

s2_1 = m.Species(elementary_molecules=[
    mt1_1.inst([c1_1.inst('0'), b1.inst('Q', bond=1)]),
    mt4.inst([b1.inst('0'), b1.inst('Q', bond=1),
              c1_1.inst('0')])
コード例 #11
0
ファイル: model.py プロジェクト: mcellteam/mcell_tests
        print("Error: Python module mcell.so or mcell.pyd was not found in "
              "directory '" + lib_path + "' constructed from system variable "
              "MCELL_PATH.")
        sys.exit(1)
else:
    print("Error: system variable MCELL_PATH that is used to find the mcell "
          "library was not set.")
    sys.exit(1)



import mcell as m

subsystem = m.Subsystem()
a = m.Species(
    name = 'a',                        # this species will be called 'a'  
    diffusion_constant_3d = 1e-6       # 'a' is a volume molecule (diffuses in 3d space)
)
subsystem.add_species(a)

instantiation = m.Instantiation()
rel_a = m.ReleaseSite(         # ReleaseSite defines molecule releases
    name = 'rel_a',
    complex = a,
    number_to_release = 10,            # 10  
    location = (0, 0, 0)               # all molecules will be released at origin 
)
instantiation.add_release_site(rel_a)  

model = m.Model()
model.add_subsystem(subsystem)         # include information on species 
model.add_instantiation(instantiation) # include information on molecule releases
コード例 #12
0
ファイル: model.py プロジェクト: mcellteam/mcell_tests
cplx_inst = m.Complex(elementary_molecules=[
    CaM.inst([C.inst(2, 1), N.inst(bond=2)]),
    CaM.inst([C.inst('Z', 1), N.inst(bond=2)])
])
assert cplx_inst.to_bngl_str() == 'CaM(C~2!1,N!2).CaM(C~Z!1,N!2)'

cplx2 = m.Complex('Ca', compartment_name='CP')
assert cplx2.to_bngl_str() == 'Ca@CP'

cplx3 = m.Complex('A(a!1).B(b!1)', compartment_name='CP')
assert cplx3.to_bngl_str() == '@CP:A(a!1).B(b!1)'

cplx4 = m.Complex('A(a!1)@IN.B(b!1)')
assert cplx4.to_bngl_str() == 'A(a!1)@IN.B(b!1)'

CaMC0N1_species = m.Species(
    elementary_molecules=[CaM.inst([C.inst(0), N.inst(1)])])
assert CaMC0N1_species.to_bngl_str() == 'CaM(C~0,N~1)'

d = m.ComponentType('d')  # no states
l = m.ComponentType('l')
r = m.ComponentType('r')
Y286 = m.ComponentType('Y286', ['0', 'P'])
S306 = m.ComponentType('S306', ['0', 'P'])
cam = m.ComponentType('cam')

CaMKII = m.ElementaryMoleculeType('CaMKII', [d, r, l, Y286, S306],
                                  diffusion_constant_3d=1e-6)

V = 0.125 * 1e-15  # um^3 -> liters
NA = 6.022e23 / 1e6
k_onCaMKII = 50 / (NA * V)  #1/uM 1/s
コード例 #13
0
import mcell as m

from parameters import *

# ---- subsystem ----

sm = m.Species(name='sm', diffusion_constant_2d=1e-7)

subsystem = m.Subsystem()
subsystem.add_species(sm)
コード例 #14
0
ファイル: model.py プロジェクト: mcellteam/mcell_tests
import sys
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

c1_1 = m.ComponentType('C', ['0', '1', 'Z'])
c1_2 = m.ComponentType('C', ['1', '0', 'Z'])
b1 = m.ComponentType('B', ['0', '1', 'Q'])

mt1_1 = m.ElementaryMoleculeType('M', [c1_1, b1], diffusion_constant_3d=1e-6)
mt2 = m.ElementaryMoleculeType('M', [b1, c1_2], diffusion_constant_3d=1e-5)

# different diffusion constant of used mol type
s5_1 = m.Species(
    elementary_molecules=[mt1_1.inst([c1_1.inst('0'),
                                      b1.inst('Q')])])
s5_2 = m.Species(
    elementary_molecules=[mt2.inst([c1_1.inst('0'),
                                    b1.inst('Q')])])
assert s5_1 != s5_2
コード例 #15
0
#0000-2)
MCELL_PATH = os.environ.get('MCELL_PATH', '')
if MCELL_PATH:
    lib_path = os.path.join(MCELL_PATH, 'lib')
    sys.path.append(lib_path)
else:
    print("Error: system variable MCELL_PATH that is used to find the mcell "
          "library was not set.")
    sys.exit(1)

#0000-3)
import mcell as m

#0000-4)
species_a = m.Species(name='a', diffusion_constant_3d=1e-6)

#0000-5)
release_site_a = m.ReleaseSite(name='rel_a',
                               complex=species_a,
                               location=(0, 0, 0),
                               number_to_release=1)

#0000-6)
viz_output = m.VizOutput(output_files_prefix='./viz_data/seed_00001/Scene', )

#0010-1)
"""
0020-1)
In the previous section we created a simple box inside the 
simulation. Simple primitives (cube and icosphere) can
コード例 #16
0
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

ITERATIONS = 1000
TIME_STEP = 1e-06

model = m.Model()

a = m.Species(name='a', diffusion_constant_3d=0)

rel_a = m.ReleaseSite(name='rel_a',
                      complex=a.inst(),
                      shape=m.Shape.SPHERICAL,
                      location=(0, 0, 0),
                      site_diameter=0,
                      number_to_release=100000)

# ---- configuration ----

model.config.total_iterations = ITERATIONS
model.add_species(a)

model.config.memory_limit_gb = 1
コード例 #17
0
ファイル: model.py プロジェクト: mcellteam/mcell_tests
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

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,
コード例 #18
0
    print(
        "Error: variable MCELL_PATH that is used to find the mcell library was not set."
    )
    sys.exit(1)

import mcell as m

from parameters import *

SEED = 1
ITERATIONS = 20

model = m.Model()

# subsystem
species_a = m.Species(name='a', diffusion_constant_3d=1e-06)

species_b = m.Species(name='b', diffusion_constant_3d=1e-06)

subsystem = m.Subsystem()
model.add_species(species_a)
model.add_species(species_b)

# geometry
box_inner = m.geometry_utils.create_box('box_inner', 0.3)
box_outer = m.geometry_utils.create_box('box_outer', 0.6)

model.add_geometry_object(box_inner)
model.add_geometry_object(box_outer)

# instantiation