Skip to content

Commit 5028af6

Browse files
committed
raise PendingDeprecationWarning
1 parent 3ee373d commit 5028af6

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

dpdata/plugins/cp2k.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
@Format.register("cp2k/aimd_output")
1818
class CP2KAIMDOutputFormat(Format):
1919
def from_labeled_system(self, file_name, restart=False, **kwargs):
20+
xyz_file = sorted(glob.glob(f"{file_name}/*pos*.xyz"))[0]
21+
log_file = sorted(glob.glob(f"{file_name}/*.log"))[0]
2022
try:
21-
xyz_file = sorted(glob.glob(f"{file_name}/*pos*.xyz"))[0]
22-
log_file = sorted(glob.glob(f"{file_name}/*.log"))[0]
2323
return tuple(Cp2kSystems(log_file, xyz_file, restart))
24-
except (StopIteration, RuntimeError):
24+
except (StopIteration, RuntimeError) as e:
2525
# StopIteration is raised when pattern match is failed
26-
print(string_warning)
26+
raise PendingDeprecationWarning(string_warning) from e
2727

2828

2929
@Format.register("cp2k/output")
@@ -47,5 +47,5 @@ def from_labeled_system(self, file_name, restart=False, **kwargs):
4747
# TODO: in the future, we should add exact error type here
4848
# TODO: when pattern match is failed
4949
# TODO: For now just use RuntimeError as a placeholder.
50-
except RuntimeError:
51-
print(string_warning)
50+
except RuntimeError as e:
51+
raise PendingDeprecationWarning(string_warning) from e

0 commit comments

Comments
 (0)