Skip to content

Commit

Permalink
throw warnings if inputfile is non-exist
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Oct 23, 2024
1 parent 0a1bb76 commit 78bab7e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dpdata/lammps/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,13 @@ def get_spin_keys(inputfile):
list or None
List of spin info keys if found, None otherwise.
"""
if inputfile is None or not os.path.isfile(inputfile):
if inputfile is None:
return None

if not os.path.isfile(inputfile):
warnings.warn(f"Input file {inputfile} not found.")
return None

with open(inputfile) as f:
for line in f.readlines():
ls = line.split()
Expand Down

0 comments on commit 78bab7e

Please sign in to comment.