Skip to content

Commit 3178849

Browse files
committed
Now the properties are at least saved
1 parent 1ca3d6a commit 3178849

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

Modules/Cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ def compute_ensemble_batch(self, ensemble, cellconstructor_calc, get_stress = Tr
14511451

14521452
# Setup if the ensemble has the stress
14531453
ensemble.has_stress = get_stress
1454-
ensemble.all_properties = [None] * ensemble.N
1454+
#ensemble.all_properties = [None] * ensemble.N
14551455

14561456
# Check if the working directory exists
14571457
if not os.path.isdir(self.local_workdir):

Modules/Ensemble.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -781,10 +781,13 @@ 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 len(self.all_properties):
784+
if np.all(x is not None for x in self.all_properties):
785+
print('YES PROPERTIES')
785786
with open(os.path.join(data_dir, "all_properties_pop%d.json" % population_id), "w") as fp:
786787
json.dump({"properties" : self.all_properties}, fp, cls=NumpyEncoder)
787-
788+
else:
789+
print('NOOO WHAT IS HAPPENING')
790+
print(self.all_properties)
788791
def save_enhanced_xyz(self, filename, append_mode = True, stress_key = "virial", forces_key = "force", energy_key = "energy"):
789792
"""
790793
Save the ensemble as an enhanced xyz.
@@ -981,7 +984,8 @@ def load_bin(self, data_dir, population_id = 1, avoid_loading_dyn = False):
981984
self.all_properties = props["properties"]
982985
else:
983986
warnings.warn("WARNING: found file {} but not able to load the properties keyword.".format(all_prop_fname))
984-
987+
else:
988+
self.all_properties = [None] * self.N
985989

986990

987991
def init_from_structures(self, structures):
@@ -1031,6 +1035,9 @@ def init_from_structures(self, structures):
10311035
self.stress_computed = np.zeros(self.N, dtype = bool)
10321036
self.force_computed = np.zeros(self.N, dtype = bool)
10331037

1038+
# Setup the all properties
1039+
self.all_properties = [None] * self.N
1040+
10341041

10351042
def generate(self, N, evenodd = True, project_on_modes = None):
10361043
"""
@@ -2962,6 +2969,8 @@ def compute_ensemble(self, calculator, compute_stress = True, stress_numerical =
29622969

29632970
if is_cluster:
29642971
cluster.compute_ensemble(computing_ensemble, calculator, compute_stress)
2972+
2973+
print('ENSEMBLE ALL PROPERTIES:', self.all_properties)
29652974
else:
29662975
computing_ensemble.get_energy_forces(calculator, compute_stress, stress_numerical, verbose = verbose)
29672976

0 commit comments

Comments
 (0)