From 7f21db236283d26f92d8ce22efb074476bc9ff7b Mon Sep 17 00:00:00 2001
From: lhausamm <loic_hausammann@hotmail.com>
Date: Fri, 5 Jan 2018 17:38:11 +0100
Subject: [PATCH] Fix Grackle structures

---
 pyswiftsim/structure.py | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/pyswiftsim/structure.py b/pyswiftsim/structure.py
index 666bd4d..f42e65e 100644
--- a/pyswiftsim/structure.py
+++ b/pyswiftsim/structure.py
@@ -152,10 +152,11 @@ class SwiftStruct(struct.Struct):
         txt = tab + "%s:\n" % type(self)
         for name in self.struct_name:
             d = getattr(self, name)
+            txt += tab + "\t%s: " % name
             if isinstance(d, SwiftStruct):
                 txt += d.__str__(tab+"\t")
             else:
-                txt += tab + "\t%s: %s\n" % (name, d)
+                txt += "%s\n" % d
         return txt
 
     def __getattr__(self, name):
@@ -252,7 +253,7 @@ class ArrayStruct(SwiftStruct):
     def __str__(self, tab=""):
         data = self.unpack(self.data)
         data = self._clean(data)
-        return tab + str(data)
+        return tab + str(data) + "\n"
         
         
     def getArray(self):
@@ -431,10 +432,7 @@ class GrackleUnits(SwiftStruct):
         super().__init__(self.struct_format, data, parent)
     
 class GrackleChemistryData(SwiftStruct):
-    """
-    WARNING, class quickly done, may contain error when accessing it directly
-    """
-    _format = "iiiiipidiidiiiiiiidddiiddiddiiddddddiiiiiid"
+    _format = "iiiiiPidiidiiiiiiidddiiddiddiiddddddiiiiii"
     _name = [
         'use_grackle',
         'with_radiative_cooling',
@@ -478,7 +476,6 @@ class GrackleChemistryData(SwiftStruct):
         'radiative_transfer_hydrogen_only',
         'self_shielding_method',
         'H2_self_shielding',
-        "omp"
     ]
 
     def __init__(self, data, parent=None):
-- 
GitLab