Skip to content

Commit

Permalink
Merge pull request espressomd#2341 from RudolfWeeber/vs_tracers_witho…
Browse files Browse the repository at this point in the history
…ut_lb

Core: VS tracers: don't complain about missing lb for non-virtual par…
  • Loading branch information
fweik authored and RudolfWeeber committed Oct 29, 2018
1 parent 4039dd1 commit bd77ae2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/virtual_sites/VirtualSitesInertialessTracers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "errorhandling.hpp"
#include "lattice.hpp"
#include "virtual_sites/lb_inertialess_tracers.hpp"
#include <algorithm>

void VirtualSitesInertialessTracers::after_force_calc() {
// Now the forces are computed and need to go into the LB fluid
Expand All @@ -39,7 +40,13 @@ void VirtualSitesInertialessTracers::after_force_calc() {
return;
}
#endif
runtimeErrorMsg() << "Inertialess Tracers: No LB method was active.";
if (std::any_of(local_cells.particles().begin(),
local_cells.particles().end(),
[](Particle &p) { return p.p.is_virtual != 0; })) {
runtimeErrorMsg() << "Inertialess Tracers: No LB method was active but "
"virtual sites present.";
return;
}
}

void VirtualSitesInertialessTracers::after_lb_propagation() {
Expand Down
15 changes: 15 additions & 0 deletions testsuite/python/virtual_sites_tracers_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,18 @@ def test_triel(self):
self.assertGreater(dist2non, 2)
self.assertAlmostEqual(dist2weak, np.sqrt(2), delta=0.3)
self.assertAlmostEqual(dist2strong, np.sqrt(2), delta=0.1)

def test_zz_without_lb(self):
"""Check behaviour without lb. Ignore non-virtual particles, complain on
virutal ones.
"""
system = self.system
system.virtual_sites = VirtualSitesInertialessTracers()
system.actors.clear()
system.part.clear()
p = system.part.add(pos=(0, 0, 0))
system.integrator.run(1)
p.virtual = 1
with(self.assertRaises(Exception)):
system.integrator.run(1)

0 comments on commit bd77ae2

Please sign in to comment.