Skip to content

Commit 6722ec4

Browse files
committed
Try to save the properties
1 parent d505dcd commit 6722ec4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Modules/Ensemble.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ def save_bin(self, data_dir, population_id = 1):
781781

782782
self.dyn_0.save_qe("%s/dyn_gen_pop%d_" % (data_dir, population_id))
783783

784-
if np.all(x is not None for x in self.all_properties):
784+
if np.all(len(list(x)) > 0 for x in self.all_properties):
785785
print('YES PROPERTIES')
786786
with open(os.path.join(data_dir, "all_properties_pop%d.json" % population_id), "w") as fp:
787787
json.dump({"properties" : self.all_properties}, fp, cls=NumpyEncoder)
@@ -985,7 +985,7 @@ def load_bin(self, data_dir, population_id = 1, avoid_loading_dyn = False):
985985
else:
986986
warnings.warn("WARNING: found file {} but not able to load the properties keyword.".format(all_prop_fname))
987987
else:
988-
self.all_properties = [None] * self.N
988+
self.all_properties = [{}] * self.N
989989

990990

991991
def init_from_structures(self, structures):
@@ -1036,7 +1036,7 @@ def init_from_structures(self, structures):
10361036
self.force_computed = np.zeros(self.N, dtype = bool)
10371037

10381038
# Setup the all properties
1039-
self.all_properties = [None] * self.N
1039+
self.all_properties = [{}] * self.N
10401040

10411041

10421042
def generate(self, N, evenodd = True, project_on_modes = None):

0 commit comments

Comments
 (0)