Skip to content

Commit 64def0e

Browse files
committed
Check previous results directories for MD restart
1 parent 85d6524 commit 64def0e

File tree

1 file changed

+12
-1
lines changed
  • janus_core/calculations

1 file changed

+12
-1
lines changed

janus_core/calculations/md.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,18 @@ def _prepare_restart(self) -> None:
808808
restart_stem = self._restart_stem
809809

810810
# Use restart_stem.name otherwise T300.0 etc. counts as extension
811-
poss_restarts = restart_stem.parent.glob(f"{restart_stem.name}*.extxyz")
811+
poss_restarts = list(
812+
restart_stem.parent.glob(f"{restart_stem.name}*.extxyz")
813+
)
814+
815+
# If no restarts found, check potential last results directory
816+
if not poss_restarts:
817+
results_dirs = sorted(restart_stem.parent.parent.glob("janus_results*"))
818+
if results_dirs:
819+
poss_restarts = results_dirs[-1].glob(
820+
f"{restart_stem.name}*.extxyz"
821+
)
822+
812823
try:
813824
last_restart = max(poss_restarts, key=getmtime)
814825

0 commit comments

Comments
 (0)