Skip to content

Commit

Permalink
Merge pull request espressomd#2241 from KaiSzuttor/lb_ext_force
Browse files Browse the repository at this point in the history
lb gpu: call apply_force independent on EXTERNAL_FORCES.
  • Loading branch information
fweik authored and RudolfWeeber committed Oct 15, 2018
1 parent bf9086b commit 0c553d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/core/lbgpu_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -3592,10 +3592,7 @@ __global__ void integrate(LB_nodes_gpu n_a, LB_nodes_gpu n_b, LB_rho_v_gpu *d_v,
if (para.fluct) {
thermalize_modes(mode, index, &rng);
}
#if defined(EXTERNAL_FORCES) || defined(SHANCHEN)
/**if external force is used apply node force */
apply_forces(index, mode, node_f, d_v);
#endif
/**lb_calc_n_from_modes_push*/
normalize_modes(mode);
/**calc of velocity densities and streaming with pbc*/
Expand Down
6 changes: 6 additions & 0 deletions src/core/virtual_sites/lb_inertialess_tracers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,17 @@ void IBM_UpdateParticlePositions(ParticleRange particles) {
Particle *const p = cell->part;
for (int j = 0; j < cell->n; j++)
if (p[j].p.is_virtual) {
#ifdef EXTERNAL_FORCES
if (!(p[j].p.ext_flag & 2))
#endif
p[j].r.p[0] = p[j].r.p[0] + p[j].m.v[0] * time_step;
#ifdef EXTERNAL_FORCES
if (!(p[j].p.ext_flag & 4))
#endif
p[j].r.p[1] = p[j].r.p[1] + p[j].m.v[1] * time_step;
#ifdef EXTERNAL_FORCES
if (!(p[j].p.ext_flag & 8))
#endif
p[j].r.p[2] = p[j].r.p[2] + p[j].m.v[2] * time_step;

// Check if the particle might have crossed a box border (criterion see
Expand Down
2 changes: 2 additions & 0 deletions testsuite/lb.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ def test_viscous_coupling(self):
np.testing.assert_allclose(
np.copy(self.system.part[0].f), -self.params['friction'] * (v_part - v_fluid), atol=1E-6)

@ut.skipIf(not espressomd.has_features("EXTERNAL_FORCES"),
"Features not available, skipping test!")
def test_a_ext_force_density(self):
self.system.thermostat.turn_off()
self.system.actors.clear()
Expand Down

0 comments on commit 0c553d8

Please sign in to comment.