Skip to content

Commit

Permalink
Use in samples and tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
pkreissl committed Feb 4, 2022
1 parent d162319 commit 9428e43
Show file tree
Hide file tree
Showing 22 changed files with 34 additions and 32 deletions.
2 changes: 1 addition & 1 deletion samples/chamber_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
# CELLSYSTEM

system.cell_system.skin = 3.0
system.cell_system.set_domain_decomposition(use_verlet_lists=False)
system.cell_system.set_regular_decomposition(use_verlet_lists=False)

# BONDS

Expand Down
2 changes: 1 addition & 1 deletion samples/visualization_cellsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
draw_cells=True)

system.time_step = 0.0005
system.cell_system.set_domain_decomposition(use_verlet_lists=True)
system.cell_system.set_regular_decomposition(use_verlet_lists=True)
system.cell_system.skin = 0.4
#system.cell_system.node_grid = [i, j, k]

Expand Down
2 changes: 1 addition & 1 deletion samples/visualization_charged.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

box = [40, 40, 40]
system = espressomd.System(box_l=box)
system.cell_system.set_domain_decomposition(use_verlet_lists=True)
system.cell_system.set_regular_decomposition(use_verlet_lists=True)
visualizer = espressomd.visualization_opengl.openGLLive(
system, background_color=[1, 1, 1], drag_enabled=True, drag_force=10)

Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ python_test(FILE nsquare.py MAX_NUM_PROC 4)
python_test(FILE virtual_sites_relative.py MAX_NUM_PROC 2)
python_test(FILE virtual_sites_tracers.py MAX_NUM_PROC 2)
python_test(FILE virtual_sites_tracers_gpu.py MAX_NUM_PROC 2 LABELS gpu)
python_test(FILE domain_decomposition.py MAX_NUM_PROC 4)
python_test(FILE regular_decomposition.py MAX_NUM_PROC 4)
python_test(FILE integrator_npt.py MAX_NUM_PROC 4)
python_test(FILE integrator_npt_stats.py MAX_NUM_PROC 4 LABELS long)
python_test(FILE integrator_steepest_descent.py MAX_NUM_PROC 4)
Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/brownian_dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class BrownianThermostat(ut.TestCase):

"""Test Brownian Dynamics"""
system = espressomd.System(box_l=[1.0, 1.0, 1.0])
system.cell_system.set_domain_decomposition(use_verlet_lists=True)
system.cell_system.set_regular_decomposition(use_verlet_lists=True)
system.cell_system.skin = 0
system.periodicity = [0, 0, 0]

Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/brownian_dynamics_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BrownianThermostat(ut.TestCase, thermostats_common.ThermostatsCommon):

"""Tests velocity distributions and diffusion for Brownian Dynamics"""
system = espressomd.System(box_l=[1.0, 1.0, 1.0])
system.cell_system.set_domain_decomposition(use_verlet_lists=True)
system.cell_system.set_regular_decomposition(use_verlet_lists=True)
system.cell_system.skin = 0
system.periodicity = [0, 0, 0]

Expand Down
7 changes: 4 additions & 3 deletions testsuite/python/cellsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ def test_cell_system(self):
self.system.cell_system.set_n_square(use_verlet_lists=False)
s = self.system.cell_system.get_state()
self.assertEqual([s['use_verlet_list'], s['type']], [0, "nsquare"])
self.system.cell_system.set_domain_decomposition(use_verlet_lists=True)
self.system.cell_system.set_regular_decomposition(
use_verlet_lists=True)
s = self.system.cell_system.get_state()
self.assertEqual(
[s['use_verlet_list'], s['type']], [1, "domain_decomposition"])
[s['use_verlet_list'], s['type']], [1, "regular_decomposition"])

@ut.skipIf(n_nodes == 1, "Skipping test: only runs for n_nodes >= 2")
def test_node_grid(self):
self.system.cell_system.set_domain_decomposition()
self.system.cell_system.set_regular_decomposition()
for i in range(3):
node_grid_ref = [1, 1, 1]
node_grid_ref[i] = self.n_nodes
Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/collision_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ def test_bind_three_particles(self):

system.part.add(id=4, pos=e)
system.part.add(id=1, pos=b)
system.cell_system.set_domain_decomposition()
system.cell_system.set_regular_decomposition()
system.integrator.run(1, recalc_forces=True)
self.verify_triangle_binding(cutoff, system.bonded_inter[2], res)
system.cell_system.set_n_square()
Expand Down
4 changes: 2 additions & 2 deletions testsuite/python/coulomb_mixed_periodicity.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_elc(self):
for p in self.system.part:
assert p.pos[2] >= 0. and p.pos[2] <= 9., f'particle {p.id} in gap'

self.system.cell_system.set_domain_decomposition()
self.system.cell_system.set_regular_decomposition()
self.system.cell_system.node_grid = sorted(
self.system.cell_system.node_grid, key=lambda x: -x)
self.system.periodicity = [1, 1, 1]
Expand All @@ -95,7 +95,7 @@ def test_elc(self):
'Skipping test: missing feature SCAFACOS or p2nfft method')
def test_scafacos_p2nfft(self):
self.system.periodicity = [1, 1, 0]
self.system.cell_system.set_domain_decomposition()
self.system.cell_system.set_regular_decomposition()

scafacos = espressomd.electrostatics.Scafacos(
prefactor=1,
Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/ek_eof_one_species.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def bisection():
pntm = pnt0 + size
else:
sys.exit("Bisection method fails:\n"
"Tuning of domain boundaries may be required.")
"Tuning of regular boundaries may be required.")
return pntm


Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/elc_vs_analytic.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_elc(self):
q=-self.q[0])

self.system.box_l = [self.box_l, self.box_l, self.box_l + self.elc_gap]
self.system.cell_system.set_domain_decomposition(
self.system.cell_system.set_regular_decomposition(
use_verlet_lists=True)
self.system.periodicity = [1, 1, 1]
p3m = espressomd.electrostatics.P3M(prefactor=self.prefactor,
Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/langevin_thermostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class LangevinThermostat(ut.TestCase):

"""Test Langevin Dynamics"""
system = espressomd.System(box_l=[1.0, 1.0, 1.0])
system.cell_system.set_domain_decomposition(use_verlet_lists=True)
system.cell_system.set_regular_decomposition(use_verlet_lists=True)
system.cell_system.skin = 0
system.periodicity = [0, 0, 0]

Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/langevin_thermostat_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class LangevinThermostat(ut.TestCase, thermostats_common.ThermostatsCommon):

"""Tests velocity distributions and diffusion for Langevin Dynamics"""
system = espressomd.System(box_l=[1.0, 1.0, 1.0])
system.cell_system.set_domain_decomposition(use_verlet_lists=True)
system.cell_system.set_regular_decomposition(use_verlet_lists=True)
system.cell_system.skin = 0
system.periodicity = [0, 0, 0]

Expand Down
5 changes: 3 additions & 2 deletions testsuite/python/lj.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ def check(self):
self.assertLess(max_deviation, 1e-5)

def test_dd(self):
self.system.cell_system.set_domain_decomposition(
self.system.cell_system.set_regular_decomposition(
use_verlet_lists=False)
self.system.integrator.run(recalc_forces=True, steps=0)

self.check()

def test_dd_vl(self):
self.system.cell_system.set_domain_decomposition(use_verlet_lists=True)
self.system.cell_system.set_regular_decomposition(
use_verlet_lists=True)
# Build VL and calc ia
self.system.integrator.run(recalc_forces=True, steps=0)

Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/mass-and-rinertia_per_particle.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ThermoTest(ut.TestCase):
@classmethod
def setUpClass(cls):
np.random.seed(seed=15)
cls.system.cell_system.set_domain_decomposition(use_verlet_lists=True)
cls.system.cell_system.set_regular_decomposition(use_verlet_lists=True)
cls.system.cell_system.skin = 5.0

def setUp(self):
Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/mmm1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_exceptions(self):
if self.MMM1D is espressomd.electrostatics.MMM1D:
with self.assertRaisesRegex(Exception, "MMM1D requires the N-square cellsystem"):
mmm1d = self.MMM1D(prefactor=1.0, maxPWerror=1e-2)
self.system.cell_system.set_domain_decomposition()
self.system.cell_system.set_regular_decomposition()
self.system.actors.add(mmm1d)
self.system.cell_system.set_n_square()
self.system.actors.clear()
Expand Down
8 changes: 4 additions & 4 deletions testsuite/python/p3m_tuning_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ def test_04_invalid_params_p3m_cpu(self):
self.system.periodicity = (1, 1, 1)

# check cell system exceptions
with self.assertRaisesRegex(Exception, "P3M requires the domain decomposition cell system"):
with self.assertRaisesRegex(Exception, "P3M requires the regular decomposition cell system"):
self.system.cell_system.set_n_square()
self.system.analysis.energy()
self.system.cell_system.set_domain_decomposition()
self.system.cell_system.set_regular_decomposition()
self.system.actors.clear()

@utx.skipIfMissingGPU()
Expand Down Expand Up @@ -259,10 +259,10 @@ def test_04_invalid_params_dp3m_cpu(self):
self.system.periodicity = (1, 1, 1)

# check cell system exceptions
with self.assertRaisesRegex(Exception, "dipolar P3M requires the domain decomposition cell system"):
with self.assertRaisesRegex(Exception, "dipolar P3M requires the regular decomposition cell system"):
self.system.cell_system.set_n_square()
self.system.analysis.energy()
self.system.cell_system.set_domain_decomposition()
self.system.cell_system.set_regular_decomposition()
self.system.actors.clear()

@utx.skipIfMissingFeatures("P3M")
Expand Down
4 changes: 2 additions & 2 deletions testsuite/python/pairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ def test_nsquare_partial_z(self):
self.run_and_check()

def test_dd(self):
self.system.cell_system.set_domain_decomposition()
self.system.cell_system.set_regular_decomposition()
self.system.periodicity = [1, 1, 1]
self.run_and_check()
self.check_range_exception()

def test_dd_partial_z(self):
self.system.cell_system.set_domain_decomposition()
self.system.cell_system.set_regular_decomposition()
self.system.periodicity = [1, 1, 0]
self.run_and_check()
self.check_range_exception()
Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/particle.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def test_zz_remove_all(self):
def test_coord_fold_corner_cases(self):
system = self.system
system.time_step = .5
system.cell_system.set_domain_decomposition(use_verlet_lists=False)
system.cell_system.set_regular_decomposition(use_verlet_lists=False)
system.cell_system.skin = 0
system.min_global_cut = 3
system.part.clear()
Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/random_pairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def check_pairs(self, n2_pairs):
self.assertEqual(n2_pairs ^ set(cs_pairs), set())

def check_dd(self, n2_pairs):
self.system.cell_system.set_domain_decomposition()
self.system.cell_system.set_regular_decomposition()
self.check_pairs(n2_pairs)

def check_n_squared(self, n2_pairs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
np.random.seed(42)


class DomainDecomposition(ut.TestCase):
class RegularDecomposition(ut.TestCase):
system = espressomd.System(box_l=3 * [50.0])
original_node_grid = tuple(system.cell_system.node_grid)

def setUp(self):
self.system.cell_system.set_domain_decomposition(
self.system.cell_system.set_regular_decomposition(
use_verlet_lists=False)
self.system.cell_system.node_grid = self.original_node_grid
self.system.time_step = 1e-3
Expand Down
4 changes: 2 additions & 2 deletions testsuite/python/virtual_sites_relative.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ def test_lj(self):
system.cell_system.skin = 0.4
system.cell_system.set_n_square(use_verlet_lists=True)
self.run_test_lj()
system.cell_system.set_domain_decomposition(use_verlet_lists=True)
system.cell_system.set_regular_decomposition(use_verlet_lists=True)
self.run_test_lj()
system.cell_system.set_domain_decomposition(use_verlet_lists=False)
system.cell_system.set_regular_decomposition(use_verlet_lists=False)
self.run_test_lj()

@utx.skipIfMissingFeatures("EXTERNAL_FORCES")
Expand Down

0 comments on commit 9428e43

Please sign in to comment.