diff --git a/src/python/espressomd/magnetostatics.py b/src/python/espressomd/magnetostatics.py index bfe30d2e3c..a43e19a84d 100644 --- a/src/python/espressomd/magnetostatics.py +++ b/src/python/espressomd/magnetostatics.py @@ -160,7 +160,7 @@ def validate_params(self, params): raise TypeError("Parameter 'tune' has to be a boolean") def required_keys(self): - return {"accuracy"} + return {"prefactor", "accuracy"} def default_params(self): return {"cao": -1, diff --git a/testsuite/python/dipolar_interface.py b/testsuite/python/dipolar_interface.py index 22cc14e905..636fd6c95b 100644 --- a/testsuite/python/dipolar_interface.py +++ b/testsuite/python/dipolar_interface.py @@ -128,6 +128,10 @@ def test_exceptions_p3m(self): MDLC = espressomd.magnetostatics.DLC dp3m_params = dict(prefactor=1., epsilon=0.1, accuracy=1e-6, mesh=[49, 49, 49], cao=7, r_cut=4.5, alpha=0.9) + with self.assertRaisesRegex(RuntimeError, "Parameter 'prefactor' is missing"): + espressomd.magnetostatics.DipolarP3M( + **{key: value for key, value in dp3m_params.items() + if key != 'prefactor'}) with self.assertRaisesRegex(ValueError, "Parameter 'prefactor' must be > 0"): espressomd.magnetostatics.DipolarP3M( **{**dp3m_params, 'prefactor': -2.})