def main(): a = m.Species("a", dc=1e-6) reg = m.Region("tube_reg", tube.reg_indices) tube_obj = m.MeshObject("tube", tube.verts, tube.faces, [reg]) mesh_objs = [tube_obj] sim = m.Simulation(dt=1e-6, meshes=mesh_objs) sim.create_molecules_reg(a, reg, 100) sim.run_iterations(100)
def main(): a = m.Species("a", dc=1e-6) plane_top = m.create_plane("top", 1.0, (0, 0, 0.1)) plane_bottom = m.create_plane("bottom", 1.0, (0, 0, -0.1)) mesh_objs = [plane_top, plane_bottom] sim = m.Simulation(dt=1e-6, meshes=mesh_objs) for i in range(-10, 11): sim.create_molecule(a, (i*0.1, 0, 0)) sim.run_iterations(100)
def main(): a = m.Species("a", volume=False, dc=1e-6) box = m.create_box("box", 1.0, (0, 0, 0)) sim = m.Simulation(dt=1e-6, meshes=[box]) sim.create_molecules_reg(a, box.regions["top"], 100, conc_dens=True, orient=m.Orient.up) sim.run_iterations(100)
def main(): a = m.Species("a", dc=1e-6) b = m.Species("b", volume=False, dc=1e-6) c = m.Species("c", volume=False, dc=1e-6) a_mix = (a, m.Orient.mix) b_up = (b, m.Orient.up) c_up = (c, m.Orient.up) bimol_irrev = m.Reaction([a_mix, b_up], [c_up], rate=1e4) box = m.import_obj(Path("./box.obj")) sim = m.Simulation(dt=1e-6, meshes=[box], reactions=[bimol_irrev]) sim.create_molecules_obj(a, box, 100) sim.create_molecules_obj(b, box, 100) sim.run_iterations(100)
def main(): a = m.Species("a", dc=1e-6) a_up = (a, m.Orient.up) a_down = (a, m.Orient.down) transp_a = m.SurfaceProperty("transp_a", m.SP.transp, a_down) absorb_a = m.SurfaceProperty("absorb_a", m.SP.absorb, a_down) clamp_a = m.SurfaceProperty("clamp_a", m.SP.clamp, a_up, clamp_val=1e-8) box = m.create_box("box", 1.0, (0, 0, 0)) box.add_surface_property(transp_a, box.regions["left"]) box.add_surface_property(absorb_a, box.regions["right"]) box.add_surface_property(clamp_a, box.regions["top"]) box.add_surface_property(absorb_a, box.regions["top"]) sim = m.Simulation(dt=1e-6, meshes=[box]) sim.create_molecules_obj(a, box, 100) sim.run_iterations(100)
def main(): a = m.Species("a", dc=1e-6) b = m.Species("b", dc=1e-6) c = m.Species("c", dc=1e-6) a_mix = (a, m.Orient.mix) b_mix = (b, m.Orient.mix) c_mix = (c, m.Orient.mix) bimol_irrev = m.Reaction([a_mix, b_mix], [c_mix], rate=0) box = m.create_box("box", 1.0, (0, 0, 0)) sim = m.Simulation(dt=1e-6, meshes=[box], reactions=[bimol_irrev]) sim.create_molecules_obj(a, box, 100) sim.create_molecules_obj(b, box, 100) for i in range(100): offs = 1e6 bimol_irrev.rate = math.sin(i * 0.1) * offs + offs sim.run_iteration()
def main(): a = m.Species("a", dc=1e-6) b = m.Species("b", dc=1e-6) c = m.Species("c", dc=1e-6) a_mix = (a, m.Orient.mix) b_mix = (b, m.Orient.mix) c_mix = (c, m.Orient.mix) unimol1 = m.Reaction([a_mix], [b_mix], rate=1e4) unimol2 = m.Reaction([a_mix], rate=1e4) bimol_irrev = m.Reaction([a_mix, b_mix], [c_mix], rate=1e4) bimol_rev = m.Reaction([a_mix, b_mix], [c_mix], reversible=True, rate=1e4) rxns = [unimol1, unimol2, bimol_irrev, bimol_rev] box = m.import_obj(Path("./box.obj")) sim = m.Simulation(dt=1e-6, meshes=[box], reactions=rxns) sim.create_molecules_obj(a, box, 100) sim.create_molecules_obj(b, box, 100) sim.run_iterations(100)
def main(): a = m.Species("a", dc=1e-6) b = m.Species("b", dc=1e-6) c = m.Species("c", dc=1e-6) a_mix = (a, m.Orient.mix) b_mix = (b, m.Orient.mix) c_mix = (c, m.Orient.mix) bimol_irrev = m.Reaction([a_mix, b_mix], [c_mix], rate=1e4, name="rxn") box = m.create_box("box", 1.0, (0, 0, 0)) count_a_box = m.CountMolecules(a, box) count_a_rxn = m.CountReaction(bimol_irrev, box) sim_counts = [count_a_box, count_a_rxn] sim = m.Simulation(dt=1e-6, meshes=[box], reactions=[bimol_irrev], counts=sim_counts) sim.create_molecules_obj(a, box, 100) sim.create_molecules_obj(b, box, 100) sim.run_iterations(100)
def main(): a = m.Species("a", dc=1e-6) sim = m.Simulation(dt=1e-6) sim.create_molecules_shape(a, 100, (0, 0, 0)) sim.run_iterations(100)
def main(): a = m.Species("a", dc=1e-6) box = m.create_box("box", 1.0, (0, 0, 0)) sim = m.Simulation(dt=1e-6) sim.create_molecules_obj(a, box, 100) sim.run_iterations(100)