#!/usr/bin/env python3 # based on pymcell4_positive/2030_rule_eq 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 # must not print a warning s1 = m.Subsystem() s1.load_bngl_molecule_types_and_reaction_rules('test1.bngl') assert len(s1.reaction_rules) == 2 # must not cause an error s2 = m.Subsystem() s2.load_bngl_molecule_types_and_reaction_rules('test2.bngl')
import mcell as m params = m.bngl_utils.load_bngl_parameters('test.bngl') MCELL_NO_COMPARTMENT_SIZE = params['MCELL_NO_COMPARTMENT_SIZE'] assert(float(MCELL_NO_COMPARTMENT_SIZE) == 0.0625) ITERATIONS = int(params['ITERATIONS']) assert(ITERATIONS == 10) SEED = 1 TIME_STEP = 1e-6 # mcell3r converter does not handle this yet subsystem = m.Subsystem() subsystem.load_bngl_molecule_types_and_reaction_rules('test.bngl') box_no_compartment = m.geometry_utils.create_box( 'box_no_compartment', MCELL_NO_COMPARTMENT_SIZE ) instantiation = m.Instantiation() instantiation.load_bngl_compartments_and_seed_species('test.bngl', box_no_compartment) instantiation.add_geometry_object(box_no_compartment) assert(len(instantiation.release_sites) == 2) viz_output = m.VizOutput( mode = m.VizMode.ASCII, output_files_prefix = './viz_data/seed_' + str(SEED).zfill(5) + '/Scene',
"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)')) sub1 = m.Subsystem() sub1.add_surface_class(sc1) # error try: sub1.add_surface_class(sc2) assert False except ValueError as err: print(err) sc3 = m.SurfaceClass('sc', type=m.SurfacePropertyType.TRANSPARENT, affected_complex_pattern=m.Complex('Y(x!1).X(y!1)')) sub2 = m.Subsystem() sub2.add_surface_class(sc2) # warning