Skip to content

Commit 2f0c068

Browse files
authored
Merge pull request #100 from OpenBioSim/fix_99
Fix issue #99
2 parents 6a72b9e + 3be5d28 commit 2f0c068

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/somd2/runner/_base.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ def __init__(self, system, config):
124124

125125
# Flag whether frames are being saved.
126126
if (
127-
self._config.frame_frequency > 0
127+
self._config.save_trajectories
128+
and self._config.frame_frequency > 0
128129
and self._config.frame_frequency <= self._config.runtime
129130
):
130131
self._save_frames = True
@@ -1241,7 +1242,6 @@ def _compare_configs(config1, config2):
12411242
"equilibration_timestep",
12421243
"equilibration_constraints",
12431244
"energy_frequency",
1244-
"save_trajectory",
12451245
"frame_frequency",
12461246
"save_velocities",
12471247
"platform",
@@ -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)