Пример #1
0
def test_pickling(simulation_factory, two_particle_snapshot_factory):
    """Test that RemoveDrift objects are picklable."""
    sim = simulation_factory(two_particle_snapshot_factory())
    remove_drift = hoomd.update.RemoveDrift(trigger=hoomd.trigger.Periodic(5),
                                            reference_positions=[(0, 0, 1),
                                                                 (-1, 0, 1)])
    operation_pickling_check(remove_drift, sim)
Пример #2
0
def test_pickling(simulation_factory, two_particle_snapshot_factory):
    """Test pickling `hoomd.tune.ParticleSorter`."""
    sim = simulation_factory(two_particle_snapshot_factory())
    # need to remove tuner since operation_pickling_check adds operation to
    # simulation
    sorter = sim.operations.tuners.pop()
    operation_pickling_check(sorter, sim)
Пример #3
0
def test_pickling(box_move, simulation_factory, two_particle_snapshot_factory):
    boxmc = hoomd.hpmc.update.BoxMC(betaP=hoomd.variant.Constant(3))
    setattr(boxmc, box_move['move'], box_move['params'])
    sim = simulation_factory(two_particle_snapshot_factory())
    mc = hoomd.hpmc.integrate.Sphere()
    mc.shape['A'] = dict(diameter=1)
    sim.operations.integrator = mc
    operation_pickling_check(boxmc, sim)
Пример #4
0
def test_pickling(simulation_factory, two_particle_snapshot_factory):
    """Test that QuickCompress objects are picklable."""
    qc = hoomd.hpmc.update.QuickCompress(trigger=hoomd.trigger.Periodic(10),
                                         target_box=hoomd.Box.square(10.))

    sim = simulation_factory(two_particle_snapshot_factory())
    mc = hoomd.hpmc.integrate.Sphere(default_d=0.05)
    mc.shape['A'] = dict(diameter=1)
    sim.operations.integrator = mc
    operation_pickling_check(qc, sim)
Пример #5
0
def test_pickling(simulation_factory, two_particle_snapshot_factory):
    """Test that Cluster objects are picklable."""
    sim = simulation_factory(two_particle_snapshot_factory())
    mc = hoomd.hpmc.integrate.Sphere(default_d=0.1, default_a=0.1)
    mc.shape['A'] = dict(diameter=1.1)
    mc.shape['B'] = dict(diameter=1.3)
    sim.operations.integrator = mc

    cl = hoomd.hpmc.update.Clusters(trigger=hoomd.trigger.Periodic(5),
                                    pivot_move_probability=0.1)
    operation_pickling_check(cl, sim)
def test_pickling(lattice_snapshot_factory, simulation_factory):
    """Assert the minimizer can be pickled when attached/unattached."""
    snap = lattice_snapshot_factory(a=1.5, n=5)
    sim = simulation_factory(snap)

    nve = md.methods.NVE(hoomd.filter.All())

    fire = md.minimize.FIRE(dt=0.0025,
                            force_tol=1e-1,
                            angmom_tol=1e-1,
                            energy_tol=1e-5,
                            methods=[nve])

    operation_pickling_check(fire, sim)
Пример #7
0
def test_pickling(valid_args, simulation_factory,
                  two_particle_snapshot_factory):
    integrator = valid_args[0]
    args = valid_args[1]
    # Need to unpack union integrators
    if isinstance(integrator, tuple):
        inner_integrator = integrator[0]
        integrator = integrator[1]
        inner_mc = inner_integrator()
        for i in range(len(args["shapes"])):
            # This will fill in default values for the inner shape objects
            inner_mc.shape["A"] = args["shapes"][i]
            args["shapes"][i] = inner_mc.shape["A"]
    mc = integrator()
    mc.shape["A"] = args
    # L needs to be ridiculously large as to not be too small for the domain
    # decomposition of some of the shapes definitions in valid_args which have
    # shapes with large extent in at least one dimension.
    sim = simulation_factory(two_particle_snapshot_factory(L=1000))
    operation_pickling_check(mc, sim)
Пример #8
0
 def test_pickling(self, move_size_tuner, simulation):
     operation_pickling_check(move_size_tuner, simulation)
Пример #9
0
def test_pickling(simulation_factory, two_particle_snapshot_factory, logger):
    sim = simulation_factory(two_particle_snapshot_factory())
    table = hoomd.write.Table(1, logger)
    operation_pickling_check(table, sim)
Пример #10
0
def test_pickling(simulation_factory, two_particle_snapshot_factory, tmp_path):
    filename = tmp_path / "temporary_test_file.dcd"
    sim = simulation_factory(two_particle_snapshot_factory())
    dcd_dump = hoomd.write.DCD(filename, hoomd.trigger.Periodic(1))
    operation_pickling_check(dcd_dump, sim)
Пример #11
0
def test_pickling(simulation_factory, two_particle_snapshot_factory,
                  box_resize):
    sim = simulation_factory(two_particle_snapshot_factory())
    operation_pickling_check(box_resize, sim)
Пример #12
0
def test_pickling(integrator_cls, integrator_args, shape, simulation_factory,
                  two_particle_snapshot_factory):
    mc = integrator_cls(**integrator_args)
    mc.shape["A"] = shape
    sim = simulation_factory(two_particle_snapshot_factory(L=1000))
    operation_pickling_check(mc, sim)
Пример #13
0
def test_pickling(simulation_factory, two_particle_snapshot_factory):
    filter_ = hoomd.filter.All()
    thermo = hoomd.md.compute.ThermodynamicQuantities(filter_)
    sim = simulation_factory(two_particle_snapshot_factory())
    operation_pickling_check(thermo, sim)
Пример #14
0
 def test_pickling(self, boxmc_with_tuner, simulation):
     _, move_size_tuner = boxmc_with_tuner
     operation_pickling_check(move_size_tuner, simulation)