Esempio n. 1
0
def test_pickling(simulation_factory, two_particle_snapshot_factory):
    sim = simulation_factory(two_particle_snapshot_factory())
    active = hoomd.md.force.Active(filter=hoomd.filter.All())
    pickling_check(active)
    integrator = hoomd.md.Integrator(
        .05,
        methods=[hoomd.md.methods.Langevin(hoomd.filter.All(), kT=0)],
        forces=[active])
    sim.operations.integrator = integrator
    sim.run(0)
    pickling_check(active)
Esempio n. 2
0
def test_pickling(manifold_base_params, simulation_factory,
                  two_particle_snapshot_factory):
    sim = simulation_factory(two_particle_snapshot_factory())
    manifold = manifold_base_params.surface(
        **manifold_base_params.setup_params)
    nve = hoomd.md.methods.NVE(filter=hoomd.filter.All(),
                               manifold_constraint=manifold)
    integrator = hoomd.md.Integrator(0.005, methods=[nve])
    sim.operations += integrator
    pickling_check(manifold)
    sim.run(0)
    pickling_check(manifold)
Esempio n. 3
0
def test_pickling(make_two_particle_simulation, pair_potential_spec):
    pair_potential = pair_potential_spec.cls(nlist=md.nlist.Cell(), r_cut=2.5)
    for key, value in pair_potential_spec.type_parameters.items():
        setattr(pair_potential, key, value)
        assert _equivalent_data_structures(value, getattr(pair_potential, key))

    sim = make_two_particle_simulation(types=['A', 'B'],
                                       dimensions=3,
                                       d=0.5,
                                       force=pair_potential)
    pickling_check(pair_potential)
    sim.run(0)
    pickling_check(pair_potential)
Esempio n. 4
0
def test_pickling(make_two_particle_simulation, pair_potential_spec):
    pair_potential = pair_potential_spec.cls(nlist=md.nlist.Cell(buffer=0.4),
                                             default_r_cut=2.5)
    for key, value in pair_potential_spec.type_parameters.items():
        setattr(pair_potential, key, value)

    sim = make_two_particle_simulation(types=['A', 'B'],
                                       dimensions=3,
                                       d=0.5,
                                       force=pair_potential)
    pickling_check(pair_potential)
    sim.run(0)
    pickling_check(pair_potential)
Esempio n. 5
0
def test_pickling(simulation_factory, two_particle_snapshot_factory,
                  valid_params):
    sim = simulation_factory(two_particle_snapshot_factory())
    _skip_if_triplet_gpu_mpi(sim, valid_params.pair_potential)
    pot = valid_params.pair_potential(**valid_params.extra_args,
                                      nlist=md.nlist.Cell(),
                                      default_r_cut=2.5)
    for pair in valid_params.pair_potential_params:
        pot.params[pair] = valid_params.pair_potential_params[pair]
    pickling_check(pot)
    integrator = hoomd.md.Integrator(0.05, forces=[pot])
    sim.operations.integrator = integrator
    sim.run(0)
    pickling_check(pot)
Esempio n. 6
0
def test_pickling(simulation_factory, polymer_snapshot_factory):
    """Test that md.constrain.Distance can be pickled and unpickled."""
    # detached
    d = hoomd.md.constrain.Distance(tolerance=1e-5)
    pickling_check(d)

    # attached
    sim = simulation_factory(polymer_snapshot_factory())
    integrator = hoomd.md.Integrator(dt=0.005)
    nve = hoomd.md.methods.NVE(filter=hoomd.filter.All())
    integrator.methods.append(nve)
    integrator.constraints.append(d)

    sim.run(0)
    pickling_check(d)
Esempio n. 7
0
def test_pickling(method_base_params, simulation_factory,
                  two_particle_snapshot_factory):
    method = method_base_params.method(**method_base_params.setup_params,
                                       filter=hoomd.filter.All())

    pickling_check(method)
    sim = simulation_factory(two_particle_snapshot_factory())
    if (method_base_params.method == hoomd.md.methods.Berendsen
            and sim.device.communicator.num_ranks > 1):
        pytest.skip("Berendsen method does not support multiple processor "
                    "configurations.")
    integrator = hoomd.md.Integrator(0.05, methods=[method])
    sim.operations.integrator = integrator
    sim.run(0)
    pickling_check(method)
Esempio n. 8
0
def test_pickling_potential(simulation_factory, two_particle_snapshot_factory,
                            alchemical_potential):
    """Test that md.constrain.Distance can be pickled and unpickled."""
    # detached
    nlist = hoomd.md.nlist.Cell(buffer=0.4)
    ljg = alchemical_potential(nlist, default_r_cut=3.0)
    ljg.params[('A', 'A')] = dict(epsilon=1., sigma=0.02, r0=1.8)
    pickling_check(ljg)

    # attached
    sim = simulation_factory(two_particle_snapshot_factory(dimensions=3, d=1))
    integrator = hoomd.md.Integrator(dt=0.005)
    integrator.forces.append(ljg)
    sim.operations.integrator = integrator
    sim.run(0)
    pickling_check(ljg)
Esempio n. 9
0
def test_pickling(simulation_factory, two_particle_snapshot_factory):
    nlist = Cell(0.4)
    pickling_check(nlist)
    lj = hoomd.md.pair.LJ(nlist, default_r_cut=1.1)
    lj.params[('A', 'A')] = dict(epsilon=1, sigma=1)
    lj.params[('A', 'B')] = dict(epsilon=1, sigma=1)
    lj.params[('B', 'B')] = dict(epsilon=1, sigma=1)
    integrator = hoomd.md.Integrator(0.005, forces=[lj])
    integrator.methods.append(
        hoomd.md.methods.Langevin(hoomd.filter.All(), kT=1))

    sim = simulation_factory(
        two_particle_snapshot_factory(particle_types=["A", "B"], d=2.0))
    sim.operations.integrator = integrator
    sim.run(0)
    pickling_check(nlist)
def test_pickling(simulation_factory, two_charged_particle_snapshot_factory):
    """Test that md.long_range.pppm.Coulomb can be pickled and unpickled."""
    # detached
    nlist = hoomd.md.nlist.Cell(buffer=0.4)
    ewald, coulomb = hoomd.md.long_range.pppm.make_pppm_coulomb_forces(
        nlist=nlist, resolution=(64, 64, 64), order=6, r_cut=3.0, alpha=0)
    pickling_check(coulomb)

    # attached
    sim = simulation_factory(two_charged_particle_snapshot_factory())
    integrator = hoomd.md.Integrator(dt=0.005)
    nve = hoomd.md.methods.NVE(filter=hoomd.filter.All())
    integrator.methods.append(nve)
    integrator.forces.extend([ewald, coulomb])
    sim.operations.integrator = integrator

    sim.run(0)

    assert ewald._attached
    assert coulomb._attached

    pickling_check(coulomb)
Esempio n. 11
0
def test_pickling(typedict_pair_keys, attached_param_dict):
    pickling_check(typedict_pair_keys)
    pickling_check(attached_param_dict)
Esempio n. 12
0
def test_pickling(all_, attached):
    pickling_check(all_)
    pickling_check(attached)
Esempio n. 13
0
def test_pickling(slist):
    pickling_check(slist)
Esempio n. 14
0
 def test_pickling(self, blank_logger, logged_obj):
     blank_logger.add(logged_obj)
     pickling_check(blank_logger)
 def test_pickling(self, populated_collection):
     test_list, _ = populated_collection
     pickling_check(test_list)
Esempio n. 16
0
def test_pickling(full_op, attached):
    pickling_check(full_op)
    pickling_check(attached)
Esempio n. 17
0
def test_pickling(variant):
    # This also tests equality of objects with the same attributes
    pickling_check(variant)
 def test_pickling(self, populated_collection):
     pickling_check(populated_collection[0])