Permalink
Browse files

core: Forces recalc of forces if the time has changed.

  • Loading branch information...
fweik committed Feb 6, 2019
1 parent d43482b commit 31d8fe456875584b5ff170a94c5a221b0a74d3d3
Showing with 17 additions and 1 deletion.
  1. +3 −0 src/core/initialize.cpp
  2. +14 −1 testsuite/python/field_test.py
@@ -668,6 +668,9 @@ void on_parameter_change(int field) {
/* Thermalized distance bonds needs ghost velocities */
on_ghost_flags_change();
break;
case FIELD_SIMTIME:
recalc_forces = 1;
break;
}
}

@@ -109,7 +109,20 @@ def test_electric_plane_wave(self):
self.system.integrator.run(0)

np.testing.assert_almost_equal(np.copy(p.f),
p.q * E0 * np.sin(np.dot(k, p.pos) - omega * self.system.time + phi))
p.q * E0 * np.sin(np.dot(k, p.pos_folded) - omega * self.system.time + phi))

self.system.time = 118.

self.system.integrator.run(0)

np.testing.assert_almost_equal(np.copy(p.f),
p.q * E0 * np.sin(np.dot(k, p.pos_folded) - omega * self.system.time + phi))

self.system.integrator.run(10)
self.system.integrator.run(0, recalc_forces=True)

np.testing.assert_almost_equal(np.copy(p.f),
p.q * E0 * np.sin(np.dot(k, p.pos_folded) - omega * self.system.time + phi))

def test_homogeneous_flow_field(self):
u = np.array([1., 2., 3.])

0 comments on commit 31d8fe4

Please sign in to comment.