From 8f8bcf5f7b330574047105015d04e6027e852858 Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Thu, 24 Oct 2019 16:17:32 -0600 Subject: [PATCH 1/2] Fixes bug in extract_compute() python method --- python/lammps.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/python/lammps.py b/python/lammps.py index 36cf2d2fdd..f23268cd60 100644 --- a/python/lammps.py +++ b/python/lammps.py @@ -399,14 +399,9 @@ class lammps(object): ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type) return ptr if type == 2: - if style == 0: - self.lib.lammps_extract_compute.restype = POINTER(c_int) - ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type) - return ptr[0] - else: - self.lib.lammps_extract_compute.restype = POINTER(POINTER(c_double)) - ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type) - return ptr + self.lib.lammps_extract_compute.restype = POINTER(POINTER(c_double)) + ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type) + return ptr return None # extract fix info From f21b059cd4db85a443a7667bded8e5ce79b83206 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 25 Oct 2019 16:16:39 -0400 Subject: [PATCH 2/2] fix another bug in extract_compute() method of LAMMPS python module --- python/lammps.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/python/lammps.py b/python/lammps.py index f23268cd60..bcf24a3fb1 100644 --- a/python/lammps.py +++ b/python/lammps.py @@ -390,10 +390,15 @@ class lammps(object): def extract_compute(self,id,style,type): if id: id = id.encode() if type == 0: - if style > 0: return None - self.lib.lammps_extract_compute.restype = POINTER(c_double) - ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type) - return ptr[0] + if style == 0: + self.lib.lammps_extract_compute.restype = POINTER(c_double) + ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type) + return ptr[0] + else if style == 1: + return None + else if style == 2: + self.lib.lammps_extract_compute.restype = POINTER(c_int) + return ptr[0] if type == 1: self.lib.lammps_extract_compute.restype = POINTER(c_double) ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type)