Skip to content

Commit 40ffa15

Browse files
committed
Fixed the print of the ensemble in a correct way in raw format
1 parent a79f669 commit 40ffa15

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

Modules/Ensemble.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -848,10 +848,10 @@ def save_raw(self, root_directory, type_dict = None):
848848

849849
# Save only if the current processor is the master
850850
if Parallel.am_i_the_master():
851-
if not os.path.exist(root_directory):
851+
if not os.path.exists(root_directory):
852852
os.makedirs(root_directory)
853853

854-
if not os.isdir(root_directory):
854+
if not os.path.isdir(root_directory):
855855
raise IOError("Error, save_raw expects a directory, but '{}' is not a directory.".format(root_directory))
856856

857857
# Save the energies
@@ -871,11 +871,15 @@ def save_raw(self, root_directory, type_dict = None):
871871

872872
# Save the types
873873
ss = self.current_dyn.structure.generate_supercell(self.current_dyn.GetSupercell())
874-
np.savetxt(os.path.join(root_directory, "type.raw"), [type_dict[x] for x in ss.atoms])
875874

876875
with open(os.path.join(root_directory, "type_map.raw"), "w") as fp:
877-
line = " ".join([inv_dict[x] for x in arange(len(type_dict))])
876+
line = " ".join([inv_dict[x] for x in np.arange(len(type_dict))])
878877
fp.write(line + "\n")
878+
879+
with open(os.path.join(root_directory, "type.raw"), "w") as fp:
880+
line = " ".join([str(type_dict[x]) for x in ss.atoms])
881+
fp.write(line + "\n")
882+
879883

880884

881885
# Force other processors to wait for the master

0 commit comments

Comments
 (0)