Formatting.

parent e2b3f5f9
Pipeline #4489 canceled with stages
in 34 minutes and 30 seconds
......@@ -1811,7 +1811,10 @@ cdef class ParticleList(object):
for particle_number in params.keys():
params[particle_number]["id"] = particle_number
IF EXCLUSIONS:
exclusions[particle_number] = params[particle_number]["exclusions"]
exclusions[
particle_number] = params[
particle_number][
"exclusions"]
del params[particle_number]["exclusions"]
self._place_new_particle(params[particle_number])
IF EXCLUSIONS:
......
......@@ -40,7 +40,7 @@ if espressomd.has_features('LB'):
system.part.add(pos=[1.0] * 3)
system.part.add(pos=[1.0, 1.0, 2.0])
system.part.add(pos=[2.0]*3, exclusions=[0,1])
system.part.add(pos=[2.0] * 3, exclusions=[0, 1])
if espressomd.has_features('ELECTROSTATICS'):
system.part[0].q = 1
system.part[1].q = -1
......
......@@ -23,6 +23,7 @@ import espressomd.checkpointing
import espressomd.virtual_sites
import tests_common
class CheckpointTest(ut.TestCase):
@classmethod
......@@ -122,9 +123,12 @@ class CheckpointTest(ut.TestCase):
@ut.skipIf(not espressomd.has_features("EXCLUSIONS"), "Skipped because feature EXCLUSIONS missing.")
def test_exclusions(self):
self.assertTrue(tests_common.lists_contain_same_elements(system.part[0].exclusions, [2]))
self.assertTrue(tests_common.lists_contain_same_elements(system.part[1].exclusions, [2]))
self.assertTrue(tests_common.lists_contain_same_elements(system.part[2].exclusions, [0,1]))
self.assertTrue(
tests_common.lists_contain_same_elements(system.part[0].exclusions, [2]))
self.assertTrue(
tests_common.lists_contain_same_elements(system.part[1].exclusions, [2]))
self.assertTrue(
tests_common.lists_contain_same_elements(system.part[2].exclusions, [0, 1]))
if __name__ == '__main__':
......
......@@ -595,5 +595,6 @@ def single_component_maxwell(x1, x2, kT):
x = np.linspace(x1, x2, 1000)
return np.trapz(np.exp(-x**2 / (2. * kT)), x) / np.sqrt(2. * np.pi * kT)
def lists_contain_same_elements(list1, list2):
return len(list1) == len(list2) and sorted(list1) == sorted(list2)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment