diff --git a/src/python/espressomd/particle_data.pyx b/src/python/espressomd/particle_data.pyx index 7fdfd1903d9..7fdfc3db255 100644 --- a/src/python/espressomd/particle_data.pyx +++ b/src/python/espressomd/particle_data.pyx @@ -1931,9 +1931,8 @@ Set quat and scalar dipole moment (dipm) instead.") n = 0 for p in self: - for t in types: - if p.type == t or t == "all": - n += 1 + if types == 'all' or p.type in types: + n += 1 with open(fname, "w") as vtk: vtk.write("# vtk DataFile Version 2.0\n") @@ -1942,17 +1941,15 @@ Set quat and scalar dipole moment (dipm) instead.") vtk.write("DATASET UNSTRUCTURED_GRID\n") vtk.write("POINTS {} floats\n".format(n)) for p in self: - for t in types: - if p.type == t or t == "all": - vtk.write("{} {} {}\n".format(*(p.pos_folded))) + if types == 'all' or p.type in types: + vtk.write("{} {} {}\n".format(*(p.pos_folded))) vtk.write("POINT_DATA {}\n".format(n)) vtk.write("SCALARS velocity float 3\n") vtk.write("LOOKUP_TABLE default\n") for p in self: - for t in types: - if p.type == t or t == "all": - vtk.write("{} {} {}\n".format(*p.v)) + if types == 'all' or p.type in types: + vtk.write("{} {} {}\n".format(*p.v)) property highest_particle_id: """