Permalink
Browse files

core: Updated simulation time at the correct place

  • Loading branch information...
fweik committed Feb 6, 2019
1 parent 31d8fe4 commit 8e60c78fe7b95749861a794f8117b89ae69c0846
Showing with 6 additions and 11 deletions.
  1. +6 −3 src/core/integrate.cpp
  2. +0 −8 testsuite/python/field_test.py
@@ -320,11 +320,17 @@ void integrate_vv(int n_steps, int reuse_forces) {
if (integ_switch == INTEG_METHOD_NPT_ISO) {
propagate_vel();
propagate_pos();

/* Propagate time: t = t+dt */
sim_time += time_step;
} else if (integ_switch == INTEG_METHOD_STEEPEST_DESCENT) {
if (steepest_descent_step())
break;
} else {
propagate_vel_pos();

/* Propagate time: t = t+dt */
sim_time += time_step;
}

#ifdef BOND_CONSTRAINT
@@ -433,9 +439,6 @@ void integrate_vv(int n_steps, int reuse_forces) {
#endif

if (integ_switch != INTEG_METHOD_STEEPEST_DESCENT) {
/* Propagate time: t = t+dt */
sim_time += time_step;

#ifdef COLLISION_DETECTION
handle_collisions();
#endif
@@ -108,18 +108,10 @@ 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_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))

0 comments on commit 8e60c78

Please sign in to comment.