Skip to content

Commit 1289f27

Browse files
committed
Remove no-op. [ci skip]
1 parent 2548e6c commit 1289f27

1 file changed

Lines changed: 41 additions & 42 deletions

File tree

src/somd2/runner/_repex.py

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,49 +1102,48 @@ def run(self):
11021102
_logger.error("Checkpoint cancelled. Exiting.")
11031103
_sys.exit(1)
11041104

1105-
if i < cycles:
1106-
# Assemble and energy matrix from the results.
1107-
_logger.info("Assembling energy matrix")
1108-
energy_matrix = self._assemble_results(results)
1109-
1110-
# Mix the replicas.
1111-
_logger.info("Mixing replicas")
1112-
self._dynamics_cache.set_states(
1113-
self._mix_replicas(
1114-
self._config.num_lambda,
1115-
energy_matrix,
1116-
self._dynamics_cache.get_proposed(),
1117-
self._dynamics_cache.get_accepted(),
1118-
)
1105+
# Assemble an energy matrix from the results.
1106+
_logger.info("Assembling energy matrix")
1107+
energy_matrix = self._assemble_results(results)
1108+
1109+
# Mix the replicas.
1110+
_logger.info("Mixing replicas")
1111+
self._dynamics_cache.set_states(
1112+
self._mix_replicas(
1113+
self._config.num_lambda,
1114+
energy_matrix,
1115+
self._dynamics_cache.get_proposed(),
1116+
self._dynamics_cache.get_accepted(),
11191117
)
1120-
self._dynamics_cache.mix_states()
1121-
1122-
# This is a checkpoint cycle.
1123-
if is_checkpoint:
1124-
# Update the block number.
1125-
block += 1
1126-
1127-
# Advance the checkpoint threshold.
1128-
next_checkpoint += cycles_per_checkpoint
1129-
1130-
# Guard the repex state and transition matrix saving with a file lock.
1131-
lock = _FileLock(self._lock_file)
1132-
with lock.acquire(timeout=self._config.timeout.to("seconds")):
1133-
# Save the transition matrix.
1134-
_logger.info("Saving replica exchange transition matrix")
1135-
self._save_transition_matrix()
1136-
1137-
# Backup the dynamics cache pickle file, if it exists.
1138-
if self._repex_state.exists():
1139-
_copyfile(
1140-
self._repex_state,
1141-
self._repex_state.with_suffix(".pkl.bak"),
1142-
)
1143-
1144-
# Pickle the dynamics cache.
1145-
_logger.info("Saving replica exchange state")
1146-
with open(self._repex_state, "wb") as f:
1147-
_pickle.dump(self._dynamics_cache, f)
1118+
)
1119+
self._dynamics_cache.mix_states()
1120+
1121+
# This is a checkpoint cycle.
1122+
if is_checkpoint:
1123+
# Update the block number.
1124+
block += 1
1125+
1126+
# Advance the checkpoint threshold.
1127+
next_checkpoint += cycles_per_checkpoint
1128+
1129+
# Guard the repex state and transition matrix saving with a file lock.
1130+
lock = _FileLock(self._lock_file)
1131+
with lock.acquire(timeout=self._config.timeout.to("seconds")):
1132+
# Save the transition matrix.
1133+
_logger.info("Saving replica exchange transition matrix")
1134+
self._save_transition_matrix()
1135+
1136+
# Backup the dynamics cache pickle file, if it exists.
1137+
if self._repex_state.exists():
1138+
_copyfile(
1139+
self._repex_state,
1140+
self._repex_state.with_suffix(".pkl.bak"),
1141+
)
1142+
1143+
# Pickle the dynamics cache.
1144+
_logger.info("Saving replica exchange state")
1145+
with open(self._repex_state, "wb") as f:
1146+
_pickle.dump(self._dynamics_cache, f)
11481147

11491148
# Record the end time for the production block.
11501149
prod_end = time()

0 commit comments

Comments
 (0)