From bdc2083a971d704cd3e1a63016edc24f7b4c267c Mon Sep 17 00:00:00 2001 From: wladerer Date: Wed, 15 Nov 2023 12:26:56 -0800 Subject: [PATCH] Refactor check_for_vasprun function and disable unnecessary parsing in get_metadata --- scripts/db.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/scripts/db.py b/scripts/db.py index 5ca92d4..8d94ac9 100755 --- a/scripts/db.py +++ b/scripts/db.py @@ -10,15 +10,7 @@ def check_for_vasprun(file: str) -> bool: """Checks if a vasprun.xml file exists and is valid""" is_file = os.path.isfile(file) - if is_file: - try: - vasprun_object = Vasprun(file) - except: - raise ValueError( - "vasprun.xml file is invalid. Calculation may be running or corrupt" - ) - - else: + if not is_file: raise ValueError(f"{file} not found") @@ -36,7 +28,7 @@ def get_metadata(file: str) -> dict: """Returns metadata from vasprun.xml file""" # check for vasprun.xml file check_for_vasprun(file) - vasprun = Vasprun(file) + vasprun = Vasprun(file, parse_dos=False, parse_eigen=False, parse_projected_eigen=False, parse_potcar_file=False) spin = vasprun.parameters["ISPIN"] soc = vasprun.parameters["LSORBIT"]