Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions hoomd/mpcd/pytest/test_collide.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def test_run(self, small_snap, simulation_factory, cls, init_args):
"angmom_rigid", [[0, 0, 0, 0], [0, 2, 3, 4]], ids=["Nonrotating", "Rotating"]
)
@pytest.mark.parametrize(
"pos_rigid", [[0, 0, 0], [10, 10, 10]], ids=["center", "edge"]
"pos_rigid", [[0, 0, 0], [5, 5, 5]], ids=["center", "edge"]
)
@pytest.mark.parametrize(
"def_rigid,properties_rigid",
Expand Down Expand Up @@ -208,6 +208,7 @@ def test_rigid_collide(
):
if "kT" not in init_args:
init_args["kT"] = 1.0
L = 11 # length of box

N_mpcd = len(def_rigid["constituent_types"])
rng = np.random.default_rng(seed=42)
Expand All @@ -216,7 +217,7 @@ def test_rigid_collide(

# create simulation
initial_snap = one_particle_snapshot_factory(
particle_types=["A", "B"], position=pos_rigid, L=21
particle_types=["A", "B"], position=pos_rigid, L=L
)
total_mass = properties_rigid["mass"][0]
if initial_snap.communicator.rank == 0:
Expand All @@ -225,10 +226,13 @@ def test_rigid_collide(
initial_snap.particles.velocity[:] = [velo_rigid]
initial_snap.particles.angmom[:] = [angmom_rigid]

# place the mpcd particles on top of constituents
# place the mpcd particles on top of constituents, accounting for PBCs
positions = np.add(def_rigid["positions"], pos_rigid)
positions[positions < -L * 0.5] = positions[positions < -L * 0.5] + L
positions[positions > L * 0.5] = positions[positions > L * 0.5] - L
initial_snap.mpcd.N = N_mpcd
initial_snap.mpcd.types = ["C"]
initial_snap.mpcd.position[:] = def_rigid["positions"]
initial_snap.mpcd.position[:] = positions
initial_snap.mpcd.velocity[:] = velo_mpcd

sim = simulation_factory(initial_snap)
Expand Down Expand Up @@ -338,7 +342,7 @@ def test_rigid_collide_free(
# create simulation
total_mass = properties_rigid["mass"][0]
initial_snap = two_particle_snapshot_factory(
particle_types=["A", "B", "C", "D"], L=21
particle_types=["A", "B", "C", "D"], L=11
)
if initial_snap.communicator.rank == 0:
# put a free particle that doesn't participate in collision on top of
Expand Down
Loading