|
1 | 1 | import json
|
2 | 2 | import os
|
3 | 3 | import shutil
|
| 4 | +import struct |
4 | 5 | from monty.io import zopen
|
5 | 6 |
|
6 | 7 | from fireworks import FiretaskBase, FWAction, explicit_serialize
|
@@ -130,18 +131,28 @@ def run_task(self, fw_spec):
|
130 | 131 | for subfilename in os.listdir(os.path.join(calc_dir, "scratch")):
|
131 | 132 | if "HESS" in subfilename:
|
132 | 133 | hess_files.append("scratch/" + subfilename)
|
| 134 | + elif subfilename == "132.0": |
| 135 | + hess_files.append("scratch/" + subfilename) |
133 | 136 |
|
134 | 137 | if len(hess_files) == 0:
|
135 | 138 | task_doc["warnings"]["hess_file_missing"] = True
|
136 | 139 | else:
|
137 | 140 | hess_data = {}
|
138 | 141 | 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() |
145 | 156 | task_doc["output"]["hess_data"] = hess_data
|
146 | 157 | if os.path.exists(os.path.join(calc_dir, "scratch")):
|
147 | 158 | shutil.rmtree(os.path.join(calc_dir, "scratch"))
|
|
0 commit comments