Skip to content

Commit cd2ff9f

Browse files
committed
Make sure trajectory chunks exist prior to trajectory reconstruction.
1 parent b07ed49 commit cd2ff9f

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/somd2/runner/_base.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,15 +1646,17 @@ def _checkpoint(
16461646
_copyfile(traj_filename, f"{traj_filename}.prev")
16471647
traj_chunks = [f"{traj_filename}.prev"] + traj_chunks
16481648

1649-
# Load the topology and chunked trajectory files.
1650-
mols = _sr.load([topology0] + traj_chunks)
1649+
# Make sure there are trajectory chunks to process.
1650+
if len(traj_chunks) > 0:
1651+
# Load the topology and chunked trajectory files.
1652+
mols = _sr.load([topology0] + traj_chunks)
16511653

1652-
# Save the final trajectory to a single file.
1653-
_sr.save(mols.trajectory(), traj_filename, format=["DCD"])
1654+
# Save the final trajectory to a single file.
1655+
_sr.save(mols.trajectory(), traj_filename, format=["DCD"])
16541656

1655-
# Now remove the chunked trajectory files.
1656-
for chunk in traj_chunks:
1657-
_Path(chunk).unlink()
1657+
# Now remove the chunked trajectory files.
1658+
for chunk in traj_chunks:
1659+
_Path(chunk).unlink()
16581660

16591661
# Add config and lambda value to the system properties.
16601662
system.set_property("config", self._config.as_dict(sire_compatible=True))

0 commit comments

Comments
 (0)