Author Topic: Checkpoint file in restarted calculations  (Read 2690 times)

0 Members and 1 Guest are viewing this topic.

Offline asanchez

  • Heavy QuantumATK user
  • ***
  • Posts: 42
  • Country: ie
  • Reputation: 1
    • View Profile
Checkpoint file in restarted calculations
« 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!

Offline kstokbro

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 392
  • Reputation: 13
    • View Profile
    • QuantumWise
Re: Checkpoint file in restarted calculations
« Reply #1 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)

Offline Umberto Martinez

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 479
  • Country: dk
  • Reputation: 26
    • View Profile

Offline asanchez

  • Heavy QuantumATK user
  • ***
  • Posts: 42
  • Country: ie
  • Reputation: 1
    • View Profile
Re: Checkpoint file in restarted calculations
« Reply #3 on: June 8, 2015, 13:52 »
Very nice. Thanks!