diff options
-rw-r--r-- | Python/pywarpx/PGroup.py | 13 | ||||
-rw-r--r-- | Python/pywarpx/WarpInterface.py | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/Python/pywarpx/PGroup.py b/Python/pywarpx/PGroup.py index ae9e6800a..7383c88ef 100644 --- a/Python/pywarpx/PGroup.py +++ b/Python/pywarpx/PGroup.py @@ -28,7 +28,7 @@ class PGroup(object): self.sm = np.zeros(self.ns) # Species mass [kg] self.sq = np.zeros(self.ns) # Species charge [C] - self.sw = np.zeros(self.ns) # Species weight, (real particles per simulation particles) + self.sw = np.ones(self.ns) # Species weight, (real particles per simulation particles) self.sid = np.arange(self.ns, dtype=int) # Global species index for each species self.ndts = np.ones(self.ns, dtype=int) # Stride for time step advance for each species @@ -110,11 +110,12 @@ class PGroup(object): return _libwarpx.get_particle_uz(self.ispecie, self.level)[self.igroup] uzp = property(getuzp) - def getpid(self): - id = _libwarpx.get_particle_id(self.ispecie, self.level)[self.igroup] - pid = np.array([id]).T - return pid - pid = property(getpid) + def getw(self): + return _libwarpx.get_particle_weight(self.ispecie, self.level)[self.igroup] + + def getpid(self, id): + pid = _libwarpx.get_particle_arrays(self.ispecie, id, self.level)[self.igroup] + return np.array([pid]).T def getgaminv(self): uxp = self.getuxp() diff --git a/Python/pywarpx/WarpInterface.py b/Python/pywarpx/WarpInterface.py index 8a3823959..91217ef1e 100644 --- a/Python/pywarpx/WarpInterface.py +++ b/Python/pywarpx/WarpInterface.py @@ -8,6 +8,8 @@ import warp from . import fields from pywarpx import PGroup +# The particle weight is always the first pid +warp.top.wpid = 1 def warp_species(warp_type, picmi_species, level=0): """Returns a Warp species that has a reference to the WarpX particles. |