CheckpointHandler

class CheckpointHandler(file_name=None, time_interval=None)

Class for representing the parameters used for saving the configuration and calculator at regular intervals during self- consistent iterations.

Parameters:
  • file_name (str) – The name of the checkpoint file. The file can be given as an absolute path or a relative path interpreted relative to the current working directory. The path of the checkpoint file is written in the output log of the calculator. The extension can be either “nc” for a NetCDF file or “hdf5” for an HDF5 file.
    Default: File of the form: 'TEMP/checkpointXXXXXXXX.hdf5', where TEMP is the temporary folder on the computer and X is a random digit.

  • time_interval (PhysicalQuantity of type time interval | Disabled) – The approximate time between saving. The program will check if the time since last save exceeds the time interval after each self-consistent iteration.
    Default: 0.5 * Hour.

fileName()
Returns:

The name of the checkpoint file.

Return type:

str

timeInterval()
Returns:

The length of the time interval or Disabled if there’s no checkpoint handling.

Return type:

PhysicalQuantity of type time interval | Disabled

uniqueString()

Return a unique string representing the state of the object.

Usage Examples

Set the checkpoint file to “/home/checkpoint.nc” and tell the calculator to store itself every 20 minutes.

checkpoint_handler = CheckpointHandler('/home/checkpoint.nc', 20*Minute)
calculator = LCAOCalculator(checkpoint_handler=checkpoint_handler)

Turn off checkpoint handling for a calculator.

calculator = LCAOCalculator(checkpoint_handler=NoCheckpointHandler)