Skip to content

Commit

Permalink
allow add_particles to be called with empty numpy arrays i.e. injec…
Browse files Browse the repository at this point in the history
…ting zero particles (ECP-WarpX#2808)
  • Loading branch information
roelof-groenewald authored Feb 1, 2022
1 parent 0f96915 commit 6cf7d7b
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions Python/pywarpx/_libwarpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,6 @@ def add_particles(self, species_name, x=None, y=None, z=None, ux=None, uy=None,
for key, val in kwargs.items():
assert np.size(val)==1 or len(val)==maxlen, f"Length of {key} doesn't match len of others"

# --- If the length of the input is zero, then quietly return
# --- This is not an error - it just means that no particles are to be injected.
if maxlen == 0:
return

# --- Broadcast scalars into appropriate length arrays
# --- If the parameter was not supplied, use the default value
if lenx == 1:
Expand Down

0 comments on commit 6cf7d7b

Please sign in to comment.