Skip to content

Commit

Permalink
Refactor check_for_vasprun function and disable
Browse files Browse the repository at this point in the history
unnecessary parsing in get_metadata
  • Loading branch information
wladerer committed Nov 15, 2023
1 parent 25f12c6 commit bdc2083
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions scripts/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")


Expand All @@ -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"]
Expand Down

0 comments on commit bdc2083

Please sign in to comment.