Skip to content

Commit 2e7e2e4

Browse files
committed
dealing with 132.0 files
1 parent 92cf2a2 commit 2e7e2e4

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

atomate/qchem/firetasks/parse_outputs.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import json
22
import os
33
import shutil
4+
import struct
45
from monty.io import zopen
56

67
from fireworks import FiretaskBase, FWAction, explicit_serialize
@@ -130,18 +131,28 @@ def run_task(self, fw_spec):
130131
for subfilename in os.listdir(os.path.join(calc_dir, "scratch")):
131132
if "HESS" in subfilename:
132133
hess_files.append("scratch/" + subfilename)
134+
elif subfilename == "132.0":
135+
hess_files.append("scratch/" + subfilename)
133136

134137
if len(hess_files) == 0:
135138
task_doc["warnings"]["hess_file_missing"] = True
136139
else:
137140
hess_data = {}
138141
for hess_name in hess_files:
139-
with zopen(
140-
os.path.join(calc_dir, hess_name),
141-
mode="rt",
142-
encoding="ISO-8859-1",
143-
) as f:
144-
hess_data[hess_name] = f.readlines()
142+
if hess_name[-5:] == "132.0":
143+
tmp_hess_data = []
144+
with open(os.path.join(calc_dir, hess_name), mode="rb") as file:
145+
binary = file.read()
146+
for ii in range(int(len(binary)/8)):
147+
tmp_hess_data.append(struct.unpack("d",binary[ii*8:(ii+1)*8])[0])
148+
hess_data[hess_name] = tmp_hess_data
149+
else:
150+
with zopen(
151+
os.path.join(calc_dir, hess_name),
152+
mode="rt",
153+
encoding="ISO-8859-1",
154+
) as f:
155+
hess_data[hess_name] = f.readlines()
145156
task_doc["output"]["hess_data"] = hess_data
146157
if os.path.exists(os.path.join(calc_dir, "scratch")):
147158
shutil.rmtree(os.path.join(calc_dir, "scratch"))

atomate/qchem/firetasks/write_inputs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,10 @@ def run_task(self, fw_spec):
136136
)
137137
qcin.write(input_file)
138138
if self.get("prev_hess"):
139-
with zopen(os.path.join(os.path.dirname(input_file), "HESS"), "wt") as f:
140-
f.writelines(self.get("prev_hess"))
139+
with open(os.path.join(os.path.dirname(input_file), "132.0"), mode="wb") as file:
140+
for val in self.get("prev_hess"):
141+
data = struct.pack("d", val)
142+
file.write(data)
141143

142144

143145
@explicit_serialize

0 commit comments

Comments
 (0)