Skip to content

Commit 82d46cc

Browse files
committed
Avoid empty prev_hess
1 parent e3ca65c commit 82d46cc

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

atomate/qchem/firetasks/write_inputs.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ class WriteInputFromIOSet(FiretaskBase):
5656
"""
5757

5858
required_params = ["qchem_input_set"]
59-
optional_params = ["molecule", "qchem_input_params", "input_file", "write_to_dir", "prev_hess"]
59+
optional_params = [
60+
"molecule",
61+
"qchem_input_params",
62+
"input_file",
63+
"write_to_dir",
64+
"prev_hess",
65+
]
6066

6167
def run_task(self, fw_spec):
6268
input_file = os.path.join(
@@ -137,10 +143,13 @@ def run_task(self, fw_spec):
137143
)
138144
qcin.write(input_file)
139145
if self.get("prev_hess"):
140-
with open(os.path.join(os.path.dirname(input_file), "132.0"), mode="wb") as file:
141-
for val in self.get("prev_hess"):
142-
data = struct.pack("d", val)
143-
file.write(data)
146+
if self.get("prev_hess") != []:
147+
with open(
148+
os.path.join(os.path.dirname(input_file), "132.0"), mode="wb"
149+
) as file:
150+
for val in self.get("prev_hess"):
151+
data = struct.pack("d", val)
152+
file.write(data)
144153

145154

146155
@explicit_serialize

0 commit comments

Comments
 (0)