espressomd / espresso

The ESPResSo package
https://espressomd.org
GNU General Public License v3.0
230 stars 188 forks source link

Bisection bugs in dipolar P3M #3915

Open jngrad opened 4 years ago

jngrad commented 4 years ago

The dipolar P3M algorithm fails for specific particle configurations. The bug depends on the box size and operating system. MWE:

import espressomd
import espressomd.magnetostatics
BOX_L = 1
system = espressomd.System(box_l=3*[BOX_L])
system.time_step = 0.01
system.part.add(pos=[[0, 0, 0], [0.5, 0.5, 0.5]], rotation=2 * [(1, 1, 1)], dip=2 * [(1, 0, 0)])
solver = espressomd.magnetostatics.DipolarP3M(prefactor=1, accuracy=1e-2)
system.actors.add(solver)

This issue makes the test_09_no_errors_dp3m_cpu() check in testsuite/python/p3m_tuning_exceptions.py fragile in CI, which prevents us from updating the ROCm image to Ubuntu 20.04.

RudolfWeeber commented 4 years ago

Assigned #3915 https://github.com/espressomd/espresso/issues/3915 to @RudolfWeeber https://github.com/RudolfWeeber .

I’m not sure, what to do about this. I do not understand the dipolar p3m code, unfortunately.

jngrad commented 4 years ago

It now fails on ICP computer sheep at random. This could be a problem during the summer school.

RudolfWeeber commented 4 years ago

My understanding is the following:

I assume that the previous tuning steps, which determins the number of mesh points, assignment order and r_cut doesn't handle the case where r_cut becomes bigger than half the local box properly. Unfortunately, this code is really hard to understand. Rather than digging further, we should probably rewrite this in a more functional style and clearly write down the pre- and postconditions for each step. While we are at it, we can introduce the possibility to inject artificial timings, so the entire thing can be tested. And include skin tuning for that matter.

@pkreissl, @pstaerk, where/under what condition did the issue occur in the tutorial?