aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx/WarpX.py
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pywarpx/WarpX.py')
-rw-r--r--Python/pywarpx/WarpX.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/pywarpx/WarpX.py b/Python/pywarpx/WarpX.py
index 7a05c40fb..d7a37a6fa 100644
--- a/Python/pywarpx/WarpX.py
+++ b/Python/pywarpx/WarpX.py
@@ -29,10 +29,10 @@ class WarpX(Bucket):
argv += particles.attrlist()
argv += laser.attrlist()
- if not particles_list:
- # --- This is needed in case only species_names has been set,
- # --- assuming that only the built in particle types are being used.
- for pstring in particles.species_names.split(' '):
+ # --- Search through species_names and add any predefined particle objects in the list.
+ # --- assuming that only the built in particle types are being used.
+ for pstring in particles.species_names.split(' '):
+ if hasattr(Particles, pstring):
particles_list.append(getattr(Particles, pstring))
for particle in particles_list: