diff options
-rw-r--r-- | Python/pywarpx/PGroup.py | 6 | ||||
-rwxr-xr-x | Python/pywarpx/_libwarpx.py | 3 | ||||
-rw-r--r-- | Source/Make.WarpX | 1 |
3 files changed, 9 insertions, 1 deletions
diff --git a/Python/pywarpx/PGroup.py b/Python/pywarpx/PGroup.py index 92f6b4484..bb8ad11e2 100644 --- a/Python/pywarpx/PGroup.py +++ b/Python/pywarpx/PGroup.py @@ -55,6 +55,10 @@ class PGroup(object): def addspecies(self): pass + def getnpid(self): + # --- The -3 is because the comps include the velocites + return _labwarpx.warpx_nComps() - 3 + npid = property(getnpid) def getnps(self): return np.array([len(self.xp)], dtype='l') @@ -104,7 +108,7 @@ class PGroup(object): uxp = self.getuxp(js) uyp = self.getuyp(js) uzp = self.getuzp(js) - return sqrt(1. - (uxp**2 + uyp**2 + uzp**2)/warpxC.c**2) + return np.sqrt(1. - (uxp**2 + uyp**2 + uzp**2)/_libwarpx.clight**2) gaminv = property(getgaminv) def getex(self, js=0): diff --git a/Python/pywarpx/_libwarpx.py b/Python/pywarpx/_libwarpx.py index 07caa6763..183fe315e 100755 --- a/Python/pywarpx/_libwarpx.py +++ b/Python/pywarpx/_libwarpx.py @@ -6,6 +6,9 @@ from ctypes.util import find_library import numpy as np from numpy.ctypeslib import ndpointer +# --- Is there a better way of handling constants? +clight = 2.99792458e+8 # m/s + def get_package_root(): ''' Get the path to the installation location (where libwarpx.so would be installed). diff --git a/Source/Make.WarpX b/Source/Make.WarpX index 39c11914c..ff98457a6 100644 --- a/Source/Make.WarpX +++ b/Source/Make.WarpX @@ -70,6 +70,7 @@ clean:: $(SILENT) $(RM) -rf build $(SILENT) $(RM) -f libwarpx.a $(SILENT) $(RM) -f libwarpx.so + $(SILENT) $(RM) -f pywarpx/libwarpx.so else |