From 07f633ee4fea2d1ddfc6c6779827272394781047 Mon Sep 17 00:00:00 2001 From: Patrick Kreissl Date: Mon, 3 Aug 2020 16:08:20 +0200 Subject: [PATCH] Fix regression in CPU LB thermalization. --- src/core/grid_based_algorithms/lb.cpp | 2 +- testsuite/python/lb_pressure_tensor_acf.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/grid_based_algorithms/lb.cpp b/src/core/grid_based_algorithms/lb.cpp index f465eebb450..ecab6bf6b0e 100644 --- a/src/core/grid_based_algorithms/lb.cpp +++ b/src/core/grid_based_algorithms/lb.cpp @@ -853,7 +853,7 @@ lb_thermalize_modes(Lattice::index_t index, const std::array &modes, rng_type{}(c, {{static_cast(index), 2ul}}), rng_type{}(c, {{static_cast(index), 3ul}})}; - auto rng = [&](int i) { return uniform(noise[i / 4][i % 4]); }; + auto rng = [&](int i) { return uniform(noise[i / 4][i % 4]) - 0.5; }; return {/* conserved modes */ {modes[0], modes[1], modes[2], modes[3], diff --git a/testsuite/python/lb_pressure_tensor_acf.py b/testsuite/python/lb_pressure_tensor_acf.py index 771c4819625..9aaaafd3cd7 100644 --- a/testsuite/python/lb_pressure_tensor_acf.py +++ b/testsuite/python/lb_pressure_tensor_acf.py @@ -52,7 +52,7 @@ def test(self): lb = self.lb_class(agrid=AGRID, dens=DENS, visc=VISC, tau=TAU, kT=KT, seed=SEED) system.actors.add(lb) - system.thermostat.set_lb(LB_fluid=lb, seed=2) + system.thermostat.set_lb(LB_fluid=lb, seed=SEED + 1) # Warmup system.integrator.run(500) @@ -78,7 +78,7 @@ def test(self): for i in range(3): for j in range(i + 1, 3): avg_ij = np.average(p_node[:, i, j]) - avg_ji = np.average(p_node[:, i, j]) + avg_ji = np.average(p_node[:, j, i]) self.assertEqual(avg_ij, avg_ji) self.assertLess(avg_ij, tol_node) @@ -87,7 +87,7 @@ def test(self): for i in range(3): for j in range(i + 1, 3): avg_ij = np.average(p_global[:, i, j]) - avg_ji = np.average(p_global[:, i, j]) + avg_ji = np.average(p_global[:, j, i]) self.assertEqual(avg_ij, avg_ji) self.assertLess(avg_ij, tol_global) @@ -126,13 +126,13 @@ def f(x, a, b): return a * np.exp(-b * x) self.assertAlmostEqual(np.average(all_viscs), VISC * DENS, delta=VISC * DENS * .07) + # DISABLE CPU TEST UNTIL #3804 IS SOLVED -# class TestLBPressureACFCPU(TestLBPressureACF, ut.TestCase): -# -# def setUp(self): -# self.lb_class = espressomd.lb.LBFluid -# -# +class TestLBPressureACFCPU(TestLBPressureACF, ut.TestCase): + + def setUp(self): + self.lb_class = espressomd.lb.LBFluid + @utx.skipIfMissingGPU()