Esempio n. 1
0
    def setUpClass(cls):
        cls.kernel_provider = api.KernelProvider.get()
        cls.kernel_provider.load_from_dir(putils.get_readdy_plugin_dir())
        cls.dir = tempfile.mkdtemp("test-config-io")
        cls.fname = os.path.join(cls.dir, "test_io_utils.h5")

        sim = api.Simulation()
        sim.set_kernel("CPU")
        sim.register_particle_type("A", 1., 0.)
        sim.register_particle_type("B", 2., 0.)
        sim.register_particle_type("C", 3., 0.)
        sim.register_reaction_conversion("mylabel", "A", "B", .00001)
        sim.register_reaction_conversion("A->B", "A", "B", 1.)
        fusion_rate = 0.4
        educt_distance = 0.2
        sim.register_reaction_fusion("B+C->A", "B", "C", "A", fusion_rate, educt_distance, .5, .5)
        with contextlib.closing(io.File(cls.fname, io.FileAction.CREATE, io.FileFlag.OVERWRITE)) as f:
            sim.run_scheme_readdy(True).write_config_to_file(f).configure_and_run(1, 0.1)
Esempio n. 2
0
    def setUpClass(cls):
        cls.dir = tempfile.mkdtemp("test-config-io")
        cls.fname = os.path.join(cls.dir, "test_io_utils.h5")

        context = api.Context()
        context.particle_types.add("A", 1.)
        context.particle_types.add("B", 2.)
        context.particle_types.add("C", 3.)
        context.reactions.add_conversion("mylabel", "A", "B", .00001)
        context.reactions.add_conversion("A->B", "A", "B", 1.)
        fusion_rate = 0.4
        educt_distance = 0.2
        context.reactions.add_fusion("B+C->A", "B", "C", "A", fusion_rate,
                                     educt_distance, .5, .5)
        sim = api.Simulation("CPU", context)
        with contextlib.closing(io.File.create(cls.fname)) as f:
            loop = sim.create_loop(.1)
            loop.write_config_to_file(f)
            loop.run(1)
Esempio n. 3
0
    def setUpClass(cls):
        cls.kernel_provider = api.KernelProvider.get()
        cls.kernel_provider.load_from_dir(putils.get_readdy_plugin_dir())
        cls.dir = tempfile.mkdtemp("test-config-io")
        cls.fname = os.path.join(cls.dir, "test_io_utils.h5")

        sim = api.Simulation("CPU")
        sim.context.particle_types.add("A", 1.)
        sim.context.particle_types.add("B", 2.)
        sim.context.particle_types.add("C", 3.)
        sim.context.reactions.add_conversion("mylabel", "A", "B", .00001)
        sim.context.reactions.add_conversion("A->B", "A", "B", 1.)
        fusion_rate = 0.4
        educt_distance = 0.2
        sim.context.reactions.add_fusion("B+C->A", "B", "C", "A", fusion_rate,
                                         educt_distance, .5, .5)
        with contextlib.closing(io.File.create(cls.fname)) as f:
            loop = sim.create_loop(.1)
            loop.write_config_to_file(f)
            loop.run(1)