コード例 #1
0
from parameters import *
from subsystem import *
from geometry import *
MODEL_PATH = os.path.dirname(os.path.abspath(__file__))

# ---- observables ----

viz_output = m.VizOutput(mode=m.VizMode.ASCII,
                         output_files_prefix='./viz_data/seed_' +
                         str(SEED).zfill(5) + '/Scene',
                         every_n_timesteps=1)

rxn = subsystem.find_reaction_rule('a_plus_b')
assert rxn

count_all = m.Count(expression=m.CountTerm(reaction_rule=rxn),
                    file_name='./react_data/seed_' + str(SEED).zfill(5) +
                    '/rxn.all.dat',
                    every_n_timesteps=1)

count_box1 = m.Count(expression=m.CountTerm(reaction_rule=rxn, region=box1),
                     file_name='./react_data/seed_' + str(SEED).zfill(5) +
                     '/rxn.box1.dat',
                     every_n_timesteps=1)

count_box1_sr1 = m.Count(expression=m.CountTerm(reaction_rule=rxn,
                                                region=box1_sr1),
                         file_name='./react_data/seed_' + str(SEED).zfill(5) +
                         '/rxn.box1_sr1.dat',
                         every_n_timesteps=1)
コード例 #2
0
# ---- default configuration overrides ----

if customization and 'custom_config' in dir(customization):
    # user-defined model configuration
    customization.custom_config(model)

# ---- add components ----

viz_output = m.VizOutput(mode=m.VizMode.ASCII,
                         output_files_prefix='./viz_data/seed_' +
                         str(parameters.SEED).zfill(5) + '/Scene',
                         every_n_timesteps=1)
model.add_viz_output(viz_output)

count_Syk_CP = m.Count(
    expression=m.CountTerm(molecules_pattern=m.Complex('Syk@CP')),
    file_name='./react_data/seed_' + str(parameters.SEED).zfill(5) +
    '/Syk.dat',
    every_n_timesteps=1)
model.add_count(count_Syk_CP)

model.add_subsystem(subsystem.subsystem)
model.add_instantiation(instantiation.instantiation)

# ---- initialization and execution ----

if customization and 'custom_init_and_run' in dir(customization):
    customization.custom_init_and_run(model)
else:
    model.initialize()
コード例 #3
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

params = m.bngl_utils.load_bngl_parameters('test.bngl')

box1 = m.geometry_utils.create_box('box1', 0.5)
box2 = m.geometry_utils.create_box('box2', 1)
box3 = m.geometry_utils.create_box('box3', 1.5)

ct_box2 = m.CountTerm(species_pattern=m.Complex('A'), region=box2)
ct_box1 = m.CountTerm(species_pattern=m.Complex('A'), region=box1)

ct_box2_minus_ct_box1 = ct_box2 - ct_box1

# setting region that will be ignored
ct_box2_minus_ct_box1.region = box3

count = m.Count(name='z', expression=ct_box2_minus_ct_box1, file_name='x.dat')

# ---- load bngl file ----

# must be checked during initialization
model = m.Model()

model.load_bngl('test.bngl')
コード例 #4
0
ファイル: observables.py プロジェクト: mcellteam/mcell_tests
import shared
import mcell as m

from parameters import *
from subsystem import *
from geometry import *
MODEL_PATH = os.path.dirname(os.path.abspath(__file__))

# ---- observables ----

viz_output = m.VizOutput(mode=m.VizMode.ASCII,
                         output_files_prefix='./viz_data/seed_' +
                         str(SEED).zfill(5) + '/Scene',
                         every_n_timesteps=1)

count_all = m.Count(expression=m.CountTerm(species_pattern=sm.inst()),
                    file_name='./react_data/seed_' + str(SEED).zfill(5) +
                    '/sm.all.dat',
                    every_n_timesteps=1)

count_box1 = m.Count(expression=m.CountTerm(species_pattern=sm.inst(),
                                            region=box1),
                     file_name='./react_data/seed_' + str(SEED).zfill(5) +
                     '/sm.box1.dat',
                     every_n_timesteps=1)

count_box1_sr1 = m.Count(expression=m.CountTerm(species_pattern=sm.inst(),
                                                region=box1_sr1),
                         file_name='./react_data/seed_' + str(SEED).zfill(5) +
                         '/sm.box1_sr1.dat',
                         every_n_timesteps=1)
コード例 #5
0
assert ct.states == ['0']
assert ct2.states == ['X', 'Y']

# vector2
ct3 = m.ComponentType('u', states=['0', '1'])

ct4 = copy.copy(ct3)
ct4.states[0] = 'X'

assert ct3.states == ['0', '1']
assert ct4.states == ['X', '1']

# object that has all defaults set but requires
# to be set to pass sematic check
# checking only that cloning passes
cnt = m.Count(expression=m.CountTerm(species_pattern=m.Complex('Z')),
              file_name='x.dat')
cnt2 = copy.copy(cnt)

# checking that we are not doing deep copy
rs = m.ReleaseSite(name='test',
                   complex=m.Complex('A'),
                   shape=m.Shape.SPHERICAL,
                   location=(1, 2, 3),
                   number_to_release=1000)

rs2 = copy.copy(rs)
rs2.complex.name = 'B'

# both variants must stay the same
assert rs.complex.name == 'B'
コード例 #6
0
import mcell as m

from parameters import *
from subsystem import *
from geometry import *

# ---- observables ----

viz_output = m.VizOutput(mode=m.VizMode.ASCII,
                         output_files_prefix='./viz_data/seed_' +
                         str(get_seed()).zfill(5) + '/Scene',
                         every_n_timesteps=1)

# declaration of rxn rules defined in BNGL and used in counts

count_react_a_plus_b = m.Count(
    expression=m.CountTerm(
        reaction_rule=subsystem.find_reaction_rule('a_plus_b')),
    file_name='./react_data/seed_' + str(get_seed()).zfill(5) +
    '/react_a_plus_b.World.dat',
    every_n_timesteps=9.99999999999999955e-07 / 1e-06)

observables = m.Observables()
observables.add_viz_output(viz_output)
observables.add_count(count_react_a_plus_b)
コード例 #7
0
ファイル: observables.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 mcell as m

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

from parameters import *
from subsystem import *
from geometry import *

# ---- observables ----

viz_output = m.VizOutput(mode=m.VizMode.ASCII,
                         output_files_prefix='./viz_data/seed_' +
                         str(SEED).zfill(5) + '/Scene',
                         every_n_timesteps=1)

count_a = m.Count(expression=m.CountTerm(species_pattern=m.Complex('a')),
                  file_name='./react_data/seed_' + str(SEED).zfill(5) +
                  '/a.dat')

# ---- create observables object and add components ----

observables = m.Observables()
observables.add_count(count_a)
observables.add_viz_output(viz_output)
コード例 #8
0
    location=(0, 0, 0),
    site_diameter=0,
    number_to_release=2)

model.add_release_site(rel_a)

viz_output = m.VizOutput(mode=m.VizMode.ASCII,
                         output_files_prefix='./viz_data/seed_' +
                         str(parameters.SEED).zfill(5) + '/Scene',
                         every_n_timesteps=1)
model.add_viz_output(viz_output)

count = m.Count(name='a',
                file_name='./react_data/seed_' +
                str(parameters.SEED).zfill(5) + '/a.gdat',
                expression=m.CountTerm(species_pattern=a.inst(), ))
model.add_count(count)

# ---- configuration ----

model.config.time_step = parameters.TIME_STEP
model.config.seed = parameters.SEED
model.config.total_iterations = parameters.ITERATIONS

model.notifications.rxn_and_species_report = True

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

# ---- default configuration overrides ----
コード例 #9
0
from geometry import *
MODEL_PATH = os.path.dirname(os.path.abspath(__file__))


# ---- observables ----

viz_output = m.VizOutput(
    mode = m.VizMode.ASCII,
    output_files_prefix = './viz_data/seed_' + str(SEED).zfill(5) + '/Scene',
    every_n_timesteps = 1
)

# ---- declaration of rxn rules defined in BNGL and used in counts ----

cterm_count_react_a_plus_b = m.CountTerm(
    reaction_rule = react_a_plus_b
)

count_react_a_plus_b_World = m.Count(
    name = 'react_a_plus_b.World',
    expression = cterm_count_react_a_plus_b,
    file_name = './react_data/seed_' + str(SEED).zfill(5) + '/react_a_plus_b.World.dat',
    every_n_timesteps = 9.99999999999999955e-07/1e-06
)

# ---- create observables object and add components ----

observables = m.Observables()
observables.add_viz_output(viz_output)
observables.add_count(count_react_a_plus_b_World)
コード例 #10
0
ファイル: observables.py プロジェクト: mcellteam/mcell_tests
import mcell as m

from parameters import *
from subsystem import *
from geometry import *

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

# ---- observables ----

viz_output = m.VizOutput(mode=m.VizMode.ASCII,
                         output_files_prefix='./viz_data/seed_' +
                         str(SEED).zfill(5) + '/Scene',
                         every_n_timesteps=1)

count_all = m.Count(expression=m.CountTerm(species_pattern=vm.inst()),
                    file_name='./react_data/seed_' + str(SEED).zfill(5) +
                    '/vm.all.dat',
                    every_n_timesteps=1)

count_box1 = m.Count(expression=m.CountTerm(species_pattern=vm.inst(),
                                            region=box1),
                     file_name='./react_data/seed_' + str(SEED).zfill(5) +
                     '/vm.box1.dat',
                     every_n_timesteps=1)

count_box2 = m.Count(expression=m.CountTerm(species_pattern=vm.inst(),
                                            region=box2),
                     file_name='./react_data/seed_' + str(SEED).zfill(5) +
                     '/vm.box2.dat',
                     every_n_timesteps=1)
コード例 #11
0
ファイル: observables.py プロジェクト: mcellteam/mcell_tests
from parameters import *
from subsystem import *
from geometry import *
MODEL_PATH = os.path.dirname(os.path.abspath(__file__))

# ---- observables ----

viz_output = m.VizOutput(mode=m.VizMode.ASCII,
                         output_files_prefix='./viz_data/seed_' +
                         str(SEED).zfill(5) + '/Scene',
                         every_n_timesteps=1)

rxn = subsystem.find_reaction_rule('a_plus_b')
assert rxn

count_all = m.Count(expression=m.CountTerm(reaction_rule=rxn),
                    file_name='./react_data/seed_' + str(SEED).zfill(5) +
                    '/rxn.all.dat',
                    every_n_timesteps=1)

count_box1 = m.Count(expression=m.CountTerm(reaction_rule=rxn, region=box1),
                     file_name='./react_data/seed_' + str(SEED).zfill(5) +
                     '/rxn.box1.dat',
                     every_n_timesteps=1)

count_box2 = m.Count(expression=m.CountTerm(reaction_rule=rxn, region=box2),
                     file_name='./react_data/seed_' + str(SEED).zfill(5) +
                     '/rxn.box2.dat',
                     every_n_timesteps=1)

count_only_box1 = m.Count(expression=m.CountTerm(reaction_rule=rxn,
コード例 #12
0
# ---- observables ----

viz_output = m.VizOutput(mode=m.VizMode.ASCII,
                         output_files_prefix='./viz_data/seed_' +
                         str(get_seed()).zfill(5) + '/Scene',
                         every_n_timesteps=1)

# declaration of rxn rules defined in BNGL and used in counts
react_a_plus_b = subsystem.find_reaction_rule('react_a_plus_b')
assert react_a_plus_b, "Reaction rule 'react_a_plus_b' was not found"

react_b_plus_c = subsystem.find_reaction_rule('react_b_plus_c')
assert react_b_plus_c, "Reaction rule 'react_b_plus_c' was not found"

count_a_Cube1 = m.Count(
    expression=m.CountTerm(molecules_pattern=m.Complex('a'), region=Cube1),
    file_name='./react_data/seed_' + str(get_seed()).zfill(5) + '/a.Cube1.dat',
    every_n_timesteps=0  # used only manually
)

count_a_Cube2 = m.Count(
    expression=m.CountTerm(molecules_pattern=m.Complex('a'), region=Cube2),
    file_name='./react_data/seed_' + str(get_seed()).zfill(5) + '/a.Cube2.dat',
    every_n_timesteps=0  # used only manually
)

count_a_Cube3 = m.Count(
    expression=m.CountTerm(molecules_pattern=m.Complex('a'), region=Cube3),
    file_name='./react_data/seed_' + str(get_seed()).zfill(5) + '/a.Cube3.dat',
    every_n_timesteps=0  # used only manually
)