Skip to content

Commit

Permalink
Allow parsing of read-only data for interstitials (by handling IO err…
Browse files Browse the repository at this point in the history
…ors with `voronoi_nodes.json`)
  • Loading branch information
kavanase committed Oct 30, 2024
1 parent adeccd9 commit 7a4f3bf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions doped/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1997,12 +1997,13 @@ def _read_bulk_voronoi_node_dict(bulk_path):
defect_entry.calculation_metadata["periodicity_breaking_supercell"] = periodicity_breaking

if bulk_voronoi_node_dict and bulk_path and not prev_bulk_voronoi_node_dict:
# save to bulk folder for future expedited parsing:
if os.path.exists("voronoi_nodes.json.lock"):
with FileLock("voronoi_nodes.json.lock"):
with contextlib.suppress(Exception): # ignore any file IO errors
# save to bulk folder for future expedited parsing:
if os.path.exists("voronoi_nodes.json.lock"):
with FileLock("voronoi_nodes.json.lock"):
dumpfn(bulk_voronoi_node_dict, os.path.join(bulk_path, "voronoi_nodes.json"))
else:
dumpfn(bulk_voronoi_node_dict, os.path.join(bulk_path, "voronoi_nodes.json"))
else:
dumpfn(bulk_voronoi_node_dict, os.path.join(bulk_path, "voronoi_nodes.json"))

check_and_set_defect_entry_name(
defect_entry, possible_defect_name, bulk_symm_ops=bulk_supercell_symm_ops
Expand Down

0 comments on commit 7a4f3bf

Please sign in to comment.