Skip to content

Commit abf9e7b

Browse files
committed
Fix particles update to copy instead of referencing.
1 parent 487244b commit abf9e7b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

particles/particles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def update(self, coords_n_momenta_dict):
148148
raise ValueError("lengths of given phase space coordinate arrays" +
149149
" do not coincide with self.macroparticlenumber.")
150150
for coord, array in coords_n_momenta_dict.items():
151-
setattr(self, coord, array)
151+
setattr(self, coord, array.copy())
152152
self.coords_n_momenta.update(coords_n_momenta_dict.keys())
153153

154154
def add(self, coordinate, array):

0 commit comments

Comments
 (0)