Skip to content

Commit 5ff9730

Browse files
committed
ash results: write_to_disk, added try statement if problem
1 parent 775fa72 commit 5ff9730

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

ash/interfaces/interface_xtb.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,8 @@ def grab_bondorder_matrix(numatoms):
10491049
# periodic
10501050
# PCs
10511051

1052+
# TODO : file-restart capability via npz
1053+
10521054
# Interface to tbliteTheory
10531055
class tbliteTheory(Theory):
10541056
def __init__(self, method=None, printlevel=2, numcores=1, spinpol=False, solvation_method=None, solvent_name=None, solvent_eps=None,

ash/modules/module_results.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,12 @@ def write_to_disk(self,filename="ASH.result"):
119119
print(f"{k} : {v}")
120120
#print(f"{k} : {v}")
121121
# Dump new dict
122-
f.write(json.dumps(newdict, allow_nan=True))
122+
try:
123+
f.write(json.dumps(newdict, allow_nan=True))
124+
except TypeError as e:
125+
print("Error writing ASH_Results to disk:", e)
126+
print("Skipping writing to disk")
127+
return
123128
f.close()
124129

125130
# Read ASH-Results data from disk

0 commit comments

Comments
 (0)