QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: asanchez on June 5, 2015, 15:31

Title: Checkpoint file in restarted calculations
Post by: asanchez on June 5, 2015, 15:31
Hi all,

When running a restarted calculation with a script like:

configuration = nlread('original_checkpoint_file.nc')[0]
configuration.setCalculator(configuration.calculator(), initial_state=configuration)
configuration.update(force_restart=True)
nlsave('output.nc', configuration)

How can one specify the checkpoint file to write to? Since there's no explicit specification of the calculator I don't know how to do it. Is there a way using the setCalculator method?

Thanks!
Title: Re: Checkpoint file in restarted calculations
Post by: kstokbro on June 5, 2015, 21:55
# read configuration from checkpoint file
configuration = nlread('original_checkpoint_file.nc')[0]

# Define the check point handler
checkpoint_handler = CheckpointHandler('/home/checkpoint.nc', 20*Minute)

# Clone the calculator method, with a new checkpoint handler
calculator = configuration.calculator()(checkpoint_handler=checkpoint_handler)

configuration.setCalculator(calculator, initial_state=configuration)
configuration.update(force_restart=True)
nlsave('output.nc', configuration)
Title: Re: Checkpoint file in restarted calculations
Post by: Umberto Martinez on June 8, 2015, 11:34
For more details see also the Reference Manual:
http://www.quantumwise.com/documents/manuals/latest/ReferenceManual/index.html/ref.checkpointhandler.html
Title: Re: Checkpoint file in restarted calculations
Post by: asanchez on June 8, 2015, 13:52
Very nice. Thanks!