diff --git a/testsuite/python/lees_edwards.py b/testsuite/python/lees_edwards.py index bf8500a404..b2797c058e 100644 --- a/testsuite/python/lees_edwards.py +++ b/testsuite/python/lees_edwards.py @@ -738,13 +738,15 @@ def test_le_breaking_bonds(self): 'initial_pos_offset': -np.sqrt(0.1)} @utx.skipIfMissingFeatures("LENNARD_JONES") - def run_lj_pair_visibility(self): + def run_lj_pair_visibility(self, shear_direction, shear_plane_normal): """ Simulate an LJ liquid under linear shear and verify forces. This is to make sure that no pairs get lost or are outdated in the short range loop. To have deterministic forces, velocity capping is used rather than a thermostat. """ + shear_axis, normal_axis = axis( + shear_direction), axis(shear_plane_normal) system = self.system system.part.clear() system.time = 0 @@ -753,13 +755,13 @@ def run_lj_pair_visibility(self): protocol = espressomd.lees_edwards.LinearShear( shear_velocity=3, initial_pos_offset=5) system.lees_edwards.set_boundary_conditions( - shear_direction="z", shear_plane_normal="x", protocol=protocol) + shear_direction=shear_direction, shear_plane_normal=shear_plane_normal, protocol=protocol) system.cell_system.skin = 0.2 system.non_bonded_inter[0, 0].lennard_jones.set_params( epsilon=1E-6, sigma=1, cutoff=1.2, shift="auto") system.part.add( - pos=((0.1, 0, 0.0), (-0.8, 0, 0)), - v=((0, 0, 1), (0, 0, -.3))) + pos=(0.1 * normal_axis, -0.8 * normal_axis), + v=(1.0 * shear_axis, -0.3 * shear_axis)) assert np.all(system.part.all().f == 0.) tests_common.check_non_bonded_loop_trace(self, system) @@ -780,19 +782,30 @@ def test_zz_lj_pair_visibility(self): # check that regular decomposition without fully connected doesn't catch the particle system = self.system with self.assertRaises(AssertionError): - system.cell_system.set_regular_decomposition() - self.run_lj_pair_visibility() + system.cell_system.set_regular_decomposition( + fully_connected_boundary=None) + n_nodes = system.cell_system.get_state()["n_nodes"] + system.cell_system.node_grid = [1, n_nodes, 1] + self.run_lj_pair_visibility("x", "y") for verlet in False, True: - system.cell_system.set_n_square(use_verlet_lists=verlet) - self.run_lj_pair_visibility() + for shear_direction, shear_plane_normal in self.direction_permutations: + system.cell_system.set_n_square(use_verlet_lists=verlet) + self.run_lj_pair_visibility( + shear_direction, shear_plane_normal) for verlet in False, True: - n_nodes = system.cell_system.get_state()["n_nodes"] - system.cell_system.node_grid = [n_nodes, 1, 1] - system.cell_system.set_regular_decomposition( - fully_connected_boundary={"boundary": "x", "direction": "z"}, use_verlet_lists=verlet) - self.run_lj_pair_visibility() + for shear_direction, shear_plane_normal in self.direction_permutations: + system.cell_system.set_regular_decomposition( + fully_connected_boundary=None) + n_nodes = system.cell_system.get_state()["n_nodes"] + normal_axis = axis(shear_plane_normal) + system.cell_system.node_grid = [ + n_nodes if normal_axis[i] == 1 else 1 for i in range(3)] + system.cell_system.set_regular_decomposition( + fully_connected_boundary={"boundary": shear_plane_normal, "direction": shear_direction}, use_verlet_lists=verlet) + self.run_lj_pair_visibility( + shear_direction, shear_plane_normal) if __name__ == "__main__": diff --git a/testsuite/python/regular_decomposition.py b/testsuite/python/regular_decomposition.py index 755a72568e..a15f8694aa 100644 --- a/testsuite/python/regular_decomposition.py +++ b/testsuite/python/regular_decomposition.py @@ -17,6 +17,7 @@ # along with this program. If not, see . # import unittest as ut +import unittest_decorators as utx import espressomd import numpy as np import itertools @@ -106,7 +107,8 @@ def test_position_rounding(self): self.system.part.add(pos=[25, 25, 0]) self.assertEqual(1, len(self.system.part)) - def test_00_fully_connected_boundary(self): + @utx.skipIfMissingFeatures("LENNARD_JONES") + def test_fully_connected_boundary(self): system = self.system system.part.clear() if system.cell_system.node_grid[1] != 1: @@ -126,6 +128,7 @@ def test_00_fully_connected_boundary(self): system.cell_system.min_global_cut = system.box_l / 4.1 self.assertEqual(system.cell_system.get_params()[ "fully_connected_boundary"], dict(direction="y", boundary="z")) + # Check that particle visibility # Place particles on a cubic lattice and use the # non_bonded_loop_trace() to check that all pairs are seen