Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jacob Wilkins <46597752+oerc0122@users.noreply.github.com>
  • Loading branch information
ElliottKasoar and oerc0122 committed Sep 2, 2024
1 parent 5b6a18a commit fc01da0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions janus_core/calculations/md.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def _prepare_restart(self) -> None:
# Use restart_stem.name otherwise T300.0 etc. counts as extension
poss_restarts = restart_stem.parent.glob(f"{restart_stem.name}*.extxyz")
try:
last_restart = sorted(poss_restarts, key=getmtime)[-1]
last_restart = max(poss_restarts, key=getmtime)

# Read in last structure
self.struct = input_structs(
Expand All @@ -556,9 +556,9 @@ def _prepare_restart(self) -> None:
try:
# Remove restart_stem from filename
# Use restart_stem.name otherwise T300.0 etc. counts as extension
self.offset = int("".join(last_stem.split(f"{restart_stem.name}-")))
self.offset = int(last_stem.split("-")[-1])

# Check "-"" not inlcuded in offset
# Check "-" not inlcuded in offset
assert self.offset > 0

except (ValueError, AssertionError) as e:
Expand Down
6 changes: 2 additions & 4 deletions janus_core/helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,8 @@ def _build_filename(
if filename:
built_filename = Path(filename)
else:
prefix = (
str(prefix_override)
if prefix_override is not None
else str(self.file_prefix)
prefix = str(
prefix_override if prefix_override is not None else self.file_prefix
)
built_filename = Path("-".join((prefix, *filter(None, additional), suffix)))

Expand Down

0 comments on commit fc01da0

Please sign in to comment.