Skip to content

Commit 7d7cfb1

Browse files
committed
Trying to debug parse_outputs taking so long
1 parent b979209 commit 7d7cfb1

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

atomate/qchem/firetasks/parse_outputs.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ def run_task(self, fw_spec):
8989
multirun=multirun,
9090
)
9191

92+
logger.info("Drone finished!")
93+
9294
# parse the GRAD file, if desired and if it is present
9395
if self.get("parse_grad_file", False):
9496
grad_file = None
@@ -112,23 +114,28 @@ def run_task(self, fw_spec):
112114
if grad_file is None:
113115
task_doc["warnings"]["grad_file_missing"] = True
114116
else:
117+
logger.info("Parsing gradient file")
115118
grad = []
116119
if grad_file[-5:] == "131.0" or grad_file[-8:] == "131.0.gz":
117120
tmp_grad_data = []
121+
logger.info("Gradient file is binary")
118122
with zopen(grad_file, mode="rb") as file:
119123
binary = file.read()
120-
for ii in range(int(len(binary)/8)):
121-
tmp_grad_data.append(struct.unpack("d",binary[ii*8:(ii+1)*8])[0])
124+
for ii in range(int(len(binary) / 8)):
125+
tmp_grad_data.append(
126+
struct.unpack("d", binary[ii * 8 : (ii + 1) * 8])[0]
127+
)
122128
grad = []
123-
for ii in range(int(len(tmp_grad_data)/3)):
129+
for ii in range(int(len(tmp_grad_data) / 3)):
124130
grad.append(
125131
[
126-
float(tmp_grad_data[ii*3]),
127-
float(tmp_grad_data[ii*3+1]),
128-
float(tmp_grad_data[ii*3+2])
132+
float(tmp_grad_data[ii * 3]),
133+
float(tmp_grad_data[ii * 3 + 1]),
134+
float(tmp_grad_data[ii * 3 + 2]),
129135
]
130136
)
131137
else:
138+
logger.info("Gradient file is text")
132139
with zopen(grad_file, mode="rt", encoding="ISO-8859-1") as f:
133140
lines = f.readlines()
134141
for line in lines:
@@ -142,6 +149,7 @@ def run_task(self, fw_spec):
142149
]
143150
)
144151
task_doc["output"]["precise_gradients"] = grad
152+
logger.info("Done parsing gradient. Now removing scratch directory")
145153
if os.path.exists(os.path.join(calc_dir, "scratch")):
146154
shutil.rmtree(os.path.join(calc_dir, "scratch"))
147155

@@ -161,23 +169,31 @@ def run_task(self, fw_spec):
161169
if len(hess_files) == 0:
162170
task_doc["warnings"]["hess_file_missing"] = True
163171
else:
172+
logger.info("Parsing Hessian file")
164173
hess_data = {}
165174
for hess_name in hess_files:
166175
if hess_name[-5:] == "132.0" or hess_name[-8:] == "132.0.gz":
176+
logger.info("Hessian file is binary")
167177
tmp_hess_data = []
168-
with zopen(os.path.join(calc_dir, hess_name), mode="rb") as file:
178+
with zopen(
179+
os.path.join(calc_dir, hess_name), mode="rb"
180+
) as file:
169181
binary = file.read()
170-
for ii in range(int(len(binary)/8)):
171-
tmp_hess_data.append(struct.unpack("d",binary[ii*8:(ii+1)*8])[0])
182+
for ii in range(int(len(binary) / 8)):
183+
tmp_hess_data.append(
184+
struct.unpack("d", binary[ii * 8 : (ii + 1) * 8])[0]
185+
)
172186
hess_data[hess_name] = tmp_hess_data
173187
else:
188+
logger.info("Hessian file is text")
174189
with zopen(
175190
os.path.join(calc_dir, hess_name),
176191
mode="rt",
177192
encoding="ISO-8859-1",
178193
) as f:
179194
hess_data[hess_name] = f.readlines()
180195
task_doc["output"]["hess_data"] = hess_data
196+
logger.info("Done parsing Hessian. Now removing scratch directory")
181197
if os.path.exists(os.path.join(calc_dir, "scratch")):
182198
shutil.rmtree(os.path.join(calc_dir, "scratch"))
183199

0 commit comments

Comments
 (0)