File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -938,16 +938,22 @@ def generate_lam_vals(lambda_base, increment=0.001):
938938 # Calculate the speed in nanoseconds per day.
939939 speed = time .to ("ns" ) / days
940940
941- # Checkpoint.
942- self ._checkpoint (
943- system ,
944- index ,
945- 0 ,
946- speed ,
947- is_final_block = True ,
948- lambda_energy = lambda_energy ,
949- lambda_grad = lambda_grad ,
950- )
941+ # Acquire the file lock to ensure that the checkpoint files are
942+ # in a consistent state if read by another process.
943+ with lock .acquire (timeout = self ._config .timeout .to ("seconds" )):
944+ # Backup any existing checkpoint files.
945+ self ._backup_checkpoint (index )
946+
947+ # Write the checkpoint files.
948+ self ._checkpoint (
949+ system ,
950+ index ,
951+ 0 ,
952+ speed ,
953+ lambda_energy = lambda_energy ,
954+ lambda_grad = lambda_grad ,
955+ is_final_block = True ,
956+ )
951957
952958 _logger .success (
953959 f"{ _lam_sym } = { lambda_value :.5f} complete, speed = { speed :.2f} ns day-1"
You can’t perform that action at this time.
0 commit comments