@@ -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
@@ -667,11 +670,17 @@ def __init__(self, system, config):
667670 output_directory = self ._config .output_directory ,
668671 )
669672 else :
673+ _logger .debug ("Restarting from file" )
674+
670675 # Check to see if the simulation is already complete.
671676 time = self ._system [0 ].time ()
672677 if time > self ._config .runtime - self ._config .timestep :
673- _logger .success (f "Simulation already complete. Exiting." )
678+ _logger .success ("Simulation already complete. Exiting." )
674679 _sys .exit (0 )
680+ else :
681+ _logger .info (
682+ f"Restarting at time { time } , time remaining = { self ._config .runtime - time } "
683+ )
675684
676685 try :
677686 with open (self ._repex_state , "rb" ) as f :
@@ -773,28 +782,28 @@ def run(self):
773782 else :
774783 cycles = int (ceil (cycles ))
775784
776- if self ._config .checkpoint_frequency .value () > 0.0 :
785+ # Store the current checkpoint frequency.
786+ checkpoint_frequency = self ._config .checkpoint_frequency
787+
788+ if checkpoint_frequency .value () > 0.0 :
777789 # Calculate the number of blocks and the remainder time.
778- frac = (self ._config .runtime / self . _config . checkpoint_frequency ).value ()
790+ frac = (self ._config .runtime / checkpoint_frequency ).value ()
779791
780792 # Handle the case where the runtime is less than the checkpoint frequency.
781793 if frac < 1.0 :
782794 frac = 1.0
783- self . _config . checkpoint_frequency = str ( self ._config .runtime )
795+ checkpoint_frequency = self ._config .runtime
784796
785797 num_blocks = int (frac )
786798 rem = round (frac - num_blocks , 12 )
787799
788800 # Work out the number of repex cycles per block.
789- frac = (
790- self ._config .checkpoint_frequency .value ()
791- / self ._config .energy_frequency .value ()
792- )
801+ frac = (checkpoint_frequency / self ._config .energy_frequency ).value ()
793802
794803 # Handle the case where the checkpoint frequency is less than the energy frequency.
795804 if frac < 1.0 :
796805 frac = 1.0
797- self . _config . checkpoint_frequency = str ( self ._config .energy_frequency )
806+ checkpoint_frequency = self ._config .energy_frequency
798807
799808 # Store the number of repex cycles per block.
800809 cycles_per_checkpoint = int (frac )
@@ -981,7 +990,7 @@ def run(self):
981990 repeat (num_blocks + int (rem > 0 )),
982991 repeat (i == cycles - 1 ),
983992 ):
984- if not result :
993+ if error :
985994 _logger .error (
986995 f"Checkpoint failed for { _lam_sym } = "
987996 f"{ self ._lambda_values [index ]:.5f} : { error } "
0 commit comments