From d697a70efa401600ad5dd7d7d0f1f87c1f6ce3d5 Mon Sep 17 00:00:00 2001 From: Patrick Kreissl Date: Thu, 21 Sep 2017 11:57:34 +0200 Subject: [PATCH 1/2] Ignore non shape-based Constraints. --- src/python/espressomd/visualization_opengl.pyx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/python/espressomd/visualization_opengl.pyx b/src/python/espressomd/visualization_opengl.pyx index b6a92bfd6c8..8aca8eff032 100644 --- a/src/python/espressomd/visualization_opengl.pyx +++ b/src/python/espressomd/visualization_opengl.pyx @@ -220,13 +220,14 @@ class openGLLive(object): # Collect shapes and interaction type (for coloring) from constraints coll_shape_obj = collections.defaultdict(list) for c in self.system.constraints.call_method('get_elements'): - t = c.get_parameter('particle_type') - s = c.get_parameter('shape') - n = s.name() - if n in ['Shapes::Wall', 'Shapes::Cylinder', 'Shapes::Sphere', 'Shapes::SpheroCylinder']: - coll_shape_obj[n].append([s, t]) - else: - coll_shape_obj['Shapes::Misc'].append([s, t]) + if type(c) == espressomd.constraints.ShapeBasedConstraint: + t = c.get_parameter('particle_type') + s = c.get_parameter('shape') + n = s.name() + if n in ['Shapes::Wall', 'Shapes::Cylinder', 'Shapes::Sphere', 'Shapes::SpheroCylinder']: + coll_shape_obj[n].append([s, t]) + else: + coll_shape_obj['Shapes::Misc'].append([s, t]) # TODO: get shapes from lbboundaries for s in coll_shape_obj['Shapes::Wall']: From aa9f0118476e1a9321c678cc043627226fd87c2d Mon Sep 17 00:00:00 2001 From: Patrick Kreissl Date: Thu, 21 Sep 2017 12:18:36 +0200 Subject: [PATCH 2/2] Iterate over contraints directly. --- src/python/espressomd/visualization_opengl.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/espressomd/visualization_opengl.pyx b/src/python/espressomd/visualization_opengl.pyx index 8aca8eff032..3cc90048ced 100644 --- a/src/python/espressomd/visualization_opengl.pyx +++ b/src/python/espressomd/visualization_opengl.pyx @@ -219,7 +219,7 @@ class openGLLive(object): # Collect shapes and interaction type (for coloring) from constraints coll_shape_obj = collections.defaultdict(list) - for c in self.system.constraints.call_method('get_elements'): + for c in self.system.constraints: if type(c) == espressomd.constraints.ShapeBasedConstraint: t = c.get_parameter('particle_type') s = c.get_parameter('shape')