Author Topic: Clarification for the restart/restore or post analysis based on a converged *.nc  (Read 6594 times)

0 Members and 1 Guest are viewing this topic.

Offline Jess Wellendorff

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 933
  • Country: dk
  • Reputation: 29
    • View Profile
I think you should use the method described in the section "simplistic approach" in the tutorial:
Code
device_configuration = nlread("checkpoint-0.4.nc")[0]
device_configuration.setCalculator(device_configuration.calculator(), initial_state=device_configuration)
device_configuration.update(force_restart=True)
nlsave("Au-C6H4S2-Au-restart.nc", device_configuration)
This uses the device configuration and calculator from the checkpoint file, and uses the state of the old calculation as initial guess for the restarted SCF loop. I have attached a modified version of your script.

Offline Jess Wellendorff

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 933
  • Country: dk
  • Reputation: 29
    • View Profile
Just to clarify: force_restart=True does force the calculation to restart from scratch. But since you use the state from the checkpoint file as initial state, "from scratch" here means from that initial guess rather than from a superposition of atomic densities :)

Offline zhangguangping

  • QuantumATK Guru
  • ****
  • Posts: 187
  • Country: cn
  • Reputation: 2
    • View Profile
Just to clarify: force_restart=True does force the calculation to restart from scratch. But since you use the state from the checkpoint file as initial state, "from scratch" here means from that initial guess rather than from a superposition of atomic densities :)
Dear Jess, Thanks for your reply. I understand the way to start a calculation using an initial guess. And I have tested it, it works. Indeed, I tested using following script,
Code
device_configuration = nlread("checkpoint-0.4.nc")[0]
device_configuration.setCalculator(device_configuration.calculator(), initial_state=device_configuration)
device_configuration.update()
nlsave("Au-C6H4S2-Au-restart.nc", device_configuration)
So what is the difference here between using device_configuration.update() and device_configuration.update(force_restart=True), which is the question raised in 8th floor.
Quote
(2) And I am puzzling about the force_restart=True in device_configuration.update(), that is what is the difference between device_configuration.update() and device_configuration.update(force_restart=True) since they both trigger a calculation?
My test has shown that there is exactly not any difference between the following two calculations.
Code
device_configuration = nlread("checkpoint-0.4.nc")[0]
device_configuration.setCalculator(device_configuration.calculator(), initial_state=device_configuration)
device_configuration.update()
nlsave("Au-C6H4S2-Au-restart.nc", device_configuration)
and
Code
device_configuration = nlread("checkpoint-0.4.nc")[0]
device_configuration.setCalculator(device_configuration.calculator(), initial_state=device_configuration)
device_configuration.update(force_restart=True)
nlsave("Au-C6H4S2-Au-restart.nc", device_configuration)
With best regards, Guangping
« Last Edit: April 20, 2016, 15:49 by zhangguangping »

Offline Jess Wellendorff

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 933
  • Country: dk
  • Reputation: 29
    • View Profile
Dear Guangping, - configuration.update() checks if the calculator attached to the configuration is SCF converged or not. It not, it does the SCF from scratch. If yes, we already have a ground state, and no new SCF is performed. - configuration.update(force_restart=True) simply forces an SCF to be performed even though the attached calculator may already have been SCF converged. That's the essential difference between the two. So why does your two examples result in the same behavior? Because you re-initialize a calculator on the configuration (setCalculator). The calculator is formally not converged yet, even though we may supply a converged initial_state. So in this case, force_restart=True has no real effect, because the calculator would do SCF in any case. Just to be perfectly clear: If I have an NC file GaAs.nc with a converged calculation:
Code
configuration = nlread('GaAs.nc', BulkConfiguration)[-1]
configuration.update()
the update would not result in a SCF calculation. On the contrary,
Code
configuration = nlread('GaAs.nc', BulkConfiguration)[-1]
configuration.setCalculator(configuration.calculator(), initial_state=configuration)
configuration.update()
would result in SCF, but only a single SCF step is needed because the initial_state is the ground state.
« Last Edit: April 27, 2016, 08:42 by Jess Wellendorff »

Offline zhangguangping

  • QuantumATK Guru
  • ****
  • Posts: 187
  • Country: cn
  • Reputation: 2
    • View Profile
Dear Jess,

Thanks for your clear reply.

This reply thoroughly clear my puzzle.

Thanks very much.

With best regards,

/Guangping