@@ -247,6 +247,9 @@ def _create_dynamics(
247247 else :
248248 mols = system
249249
250+ # Delete an existing trajectory frames.
251+ mols .delete_all_frames ()
252+
250253 # Overload the device and lambda value.
251254 dynamics_kwargs ["device" ] = device
252255 dynamics_kwargs ["lambda_value" ] = lam
@@ -721,11 +724,17 @@ def __init__(self, system, config):
721724 output_directory = self ._config .output_directory ,
722725 )
723726 else :
727+ _logger .debug ("Restarting from file" )
728+
724729 # Check to see if the simulation is already complete.
725730 time = self ._system [0 ].time ()
726731 if time > self ._config .runtime - self ._config .timestep :
727- _logger .success (f "Simulation already complete. Exiting." )
732+ _logger .success ("Simulation already complete. Exiting." )
728733 _sys .exit (0 )
734+ else :
735+ _logger .info (
736+ f"Restarting at time { time } , time remaining = { self ._config .runtime - time } "
737+ )
729738
730739 try :
731740 with open (self ._repex_state , "rb" ) as f :
@@ -827,28 +836,28 @@ def run(self):
827836 else :
828837 cycles = int (ceil (cycles ))
829838
830- if self ._config .checkpoint_frequency .value () > 0.0 :
839+ # Store the current checkpoint frequency.
840+ checkpoint_frequency = self ._config .checkpoint_frequency
841+
842+ if checkpoint_frequency .value () > 0.0 :
831843 # Calculate the number of blocks and the remainder time.
832- frac = (self ._config .runtime / self . _config . checkpoint_frequency ).value ()
844+ frac = (self ._config .runtime / checkpoint_frequency ).value ()
833845
834846 # Handle the case where the runtime is less than the checkpoint frequency.
835847 if frac < 1.0 :
836848 frac = 1.0
837- self . _config . checkpoint_frequency = str ( self ._config .runtime )
849+ checkpoint_frequency = self ._config .runtime
838850
839851 num_blocks = int (frac )
840852 rem = round (frac - num_blocks , 12 )
841853
842854 # Work out the number of repex cycles per block.
843- frac = (
844- self ._config .checkpoint_frequency .value ()
845- / self ._config .energy_frequency .value ()
846- )
855+ frac = (checkpoint_frequency / self ._config .energy_frequency ).value ()
847856
848857 # Handle the case where the checkpoint frequency is less than the energy frequency.
849858 if frac < 1.0 :
850859 frac = 1.0
851- self . _config . checkpoint_frequency = str ( self ._config .energy_frequency )
860+ checkpoint_frequency = self ._config .energy_frequency
852861
853862 # Store the number of repex cycles per block.
854863 cycles_per_checkpoint = int (frac )
@@ -1035,7 +1044,7 @@ def run(self):
10351044 repeat (num_blocks + int (rem > 0 )),
10361045 repeat (i == cycles - 1 ),
10371046 ):
1038- if not result :
1047+ if error :
10391048 _logger .error (
10401049 f"Checkpoint failed for { _lam_sym } = "
10411050 f"{ self ._lambda_values [index ]:.5f} : { error } "
0 commit comments