Author Topic: checkpoint file  (Read 4761 times)

0 Members and 1 Guest are viewing this topic.

Offline ramkrishna

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 253
  • Country: us
  • Reputation: 5
    • View Profile
checkpoint file
« on: July 10, 2014, 20:16 »
Dear Sir,     I have two points here,    1)   In case of checkpoint handler if I will fix it in the following way for the I-V curve calculations (in the explicit voltage list code to calculate transmissions), will it be correct? I am really confused here. Suppose the my scf calculation is interrupted after a voltage of 0.25V but before the converged result of 0.5V, will it save upto that point within that checkpoint file?
Code
#----------------------------------------
# Device Calculator
#----------------------------------------    
calculator = DeviceLCAOCalculator(
    basis_set=basis_set,
    exchange_correlation=exchange_correlation,
    numerical_accuracy_parameters=device_numerical_accuracy_parameters,
    electrode_calculators=
        [left_electrode_calculator, right_electrode_calculator],
    )

[color=red]# Set Checkpoint file
checkpoint_handler = CheckpointHandler('/home/ram/Desktop/checkpoint_files/checkpoint.nc', 20*Minute)

calculator = DeviceLCAOCalculator(checkpoint_handler=checkpoint_handler)[/color]

# Define the bias voltages for the I-V curve
voltage_list=[0, 0.25, 0.5, 0.75, 1.0]*Volt

# Loop over the bias voltages
for voltage in voltage_list:
    # Set electrode voltages and use the self-consistent state of the previous calculation as starting guess
    device_configuration.setCalculator(
          calculator(electrode_voltages=(voltage/2, -voltage/2)), 
          initial_state=device_configuration)
    device_configuration.update()
    nlsave('device.nc', device_configuration)
     
    # Calculate and save the transmission spectrum for each bias
    transmission(device_configuration)

2) Now, if I want to restart the scf calculation from that checkpoint file for the next bias (i.e. 0.5V) then can I use the command
Code
device_configuration = nlread("checkpointfile.nc")[0]
device_configuration.update(force_restart=True)
in the place of the device_configuration.update() which is within the bias loop [ http://quantumwise.com/publications/tutorials/mini-tutorials/142-restarting-stopped-calculations ] to start from that interrupted stage? As this  device_configuration.update() is within the loop, so I am quite confused whether when it goes for next scf calculations for voltage 0.75V, will it consider the 0.5V device configuration as the initial configuration or not (I mean, will it take the checkpoint file again for its initial state or the 0.5V device configuration?). Or if there is any specific way to use the checkpoint file to use for a interrupted I-V calculations after a certain iteration of a specific bias without restarting from the previous converged state, then please let me know. It will be very much helpful to handle a long simulation. Thanking you, Ramkrishna

Offline Umberto Martinez

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 479
  • Country: dk
  • Reputation: 26
    • View Profile
Re: checkpoint file
« Reply #1 on: July 14, 2014, 10:29 »
1) looks fine besides transmission(device_configuration) do you mean nlsave('analysis.nc', transmission_spectrum)? given that you define transmission_spectrum somewhere else. 2) Why not restarting from the last DeviceConfiguration in your device.nc which contains the last converged state (at 0.25V in your case) with something like:
Code
# Read the last converged state, use object_id to read any specific converged state
device_configuration = nlread("device.nc", DeviceConfiguration)[-1]
# Define the bias voltages for the I-V curve
voltage_list=[0.5, 0.75, 1.0]*Volt

# Loop over the bias voltages
for voltage in voltage_list:
    # Set electrode voltages and use the self-consistent state of the previous calculation as starting guess
    device_configuration.setCalculator(
          calculator(electrode_voltages=(voltage/2, -voltage/2)), 
          initial_state=device_configuration)
    device_configuration.update()
    nlsave('device.nc', device_configuration)
Check also the IVCurve object: http://www.quantumwise.com/documents/manuals/latest/ReferenceManual/index.html/ref.ivcurve.html

Offline ramkrishna

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 253
  • Country: us
  • Reputation: 5
    • View Profile
Re: checkpoint file
« Reply #2 on: July 14, 2014, 23:57 »
Dear Sir,
      I know that I can restart from the last converged state, but thing is that, the step takes quite long time (as the system is quite big) to go to converge from one bias to another bias point. Now if it will terminate just near the new converge state, then those days are just wastage and I don't want to waste that time by restarting from the previous converged state.

Regards
Ramkrishna

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: checkpoint file
« Reply #3 on: July 16, 2014, 05:37 »
The checkpoint file is always just for the SCF loop. So if you calculation is interrupted at the 0.5 V bias step, the checkpoint file is for that. You can then restart from that, for this bias, and then continue the bias loop when it has converged.