Author Topic: How to Restart a stopped calculation(iv_characteristics)  (Read 3919 times)

0 Members and 1 Guest are viewing this topic.

Offline dmicje12

  • Regular QuantumATK user
  • **
  • Posts: 18
  • Country: tw
  • Reputation: 0
    • View Profile
Hello everyone.

I want to restart a calculation
I find this in quantumatk tutorial
https://docs.quantumatk.com/tutorials/restarting_calculations/restarting_calculations.html
It says I need to add the line
"device_configuration = nlread("checkpointfile.hdf5")[0]"
before
"device_configuration.update()"

But my script is like this:
# Set up configuration
central_region = BulkConfiguration(
    bravais_lattice=central_region_lattice,
    elements=central_region_elements,
    cartesian_coordinates=central_region_coordinates
    )

# Add metallic region
metallic_region_0 = BoxRegion(
    -0.7*Volt,
    xmin = 0.0*Angstrom, xmax = 0.9*Angstrom,
    ymin = 0.0*Angstrom, ymax = 5.6*Angstrom,
    zmin = 13.0*Angstrom, zmax = 90.0*Angstrom,
)

metallic_region_1 = BoxRegion(
    -0.7*Volt,
    xmin = 25.5*Angstrom, xmax = 26.31*Angstrom,
    ymin = 0.0*Angstrom, ymax = 5.6*Angstrom,
    zmin = 13.0*Angstrom, zmax = 90.0*Angstrom,
)

metallic_regions = [metallic_region_0, metallic_region_1]
central_region.setMetallicRegions(metallic_regions)

# Add dielectric region
dielectric_region_0 = BoxRegion(
    3.9,
    xmin = 0.9*Angstrom, xmax = 8.9*Angstrom,
    ymin = 0.0*Angstrom, ymax = 5.6*Angstrom,
    zmin = -2.5*Angstrom, zmax = 105.0*Angstrom,
)

dielectric_region_1 = BoxRegion(
    3.9,
    xmin = 17.5*Angstrom, xmax = 25.5*Angstrom,
    ymin = 0.0*Angstrom, ymax = 5.6*Angstrom,
    zmin = -2.5*Angstrom, zmax = 105.0*Angstrom,
)

dielectric_regions = [dielectric_region_0, dielectric_region_1]
central_region.setDielectricRegions(dielectric_regions)

 device_0321_01 = DeviceConfiguration(
    central_region,
    [left_electrode, right_electrode],
    equivalent_electrode_lengths=[2.584, 2.584]*Angstrom,
    transverse_electrode_repetitions=[[1, 1], [1, 1]],
    )
# device_0321_01 = nlread("tmp/dojo0715.hdf5")[0]

# %% Set DeviceLCAOCalculator

# %% DeviceLCAOCalculator

#----------------------------------------
# Exchange-Correlation
#----------------------------------------
exchange_correlation = NCLDA.PZ

k_point_sampling = KpointDensity(
    density_a=1.0*Angstrom,
    density_b=10.0*Angstrom,
    density_c=200.0*Angstrom
)

numerical_accuracy_parameters = NumericalAccuracyParameters(
    density_mesh_cutoff=80.0*Hartree,
    k_point_sampling=k_point_sampling,
    occupation_method=FermiDirac(
        broadening=300.0*Kelvin
    )
)

#----------------------------------------
# Basis Set
#----------------------------------------
basis_set = [
    BasisLDAPseudoDojo.Selenium_Medium,
    BasisLDAPseudoDojo.Rhodium_Medium,
    BasisLDAPseudoDojo.Tungsten_Medium,
    ]



iteration_control_parameters = IterationControlParameters(
    max_steps=3000,
    damping_factor=0.079,
    non_convergence_behavior=StopCalculation()
)

device_algorithm_parameters = DeviceAlgorithmParameters(
    initial_density_type=NeutralAtom(
        electrode_constraint_length=10.0*Angstrom,
        )
)

poisson_solver = MultigridSolver(
    boundary_conditions=[
        [NeumannBoundaryCondition(), NeumannBoundaryCondition()],
        [PeriodicBoundaryCondition(), PeriodicBoundaryCondition()],
        [DirichletBoundaryCondition(), DirichletBoundaryCondition()]
    ]
)

contour_parameters = ContourParameters(
    equilibrium_contour = SemiCircleContour(
        circle_points=40
    )
)

checkpoint_handler = CheckpointHandler(
    file_name='/home/weixiang/tmp/dojo0729.hdf5'
)

calculator = DeviceLCAOCalculator(
    basis_set=basis_set,
    exchange_correlation=exchange_correlation,
    numerical_accuracy_parameters=numerical_accuracy_parameters,
    iteration_control_parameters=iteration_control_parameters,
    device_algorithm_parameters=device_algorithm_parameters,
    poisson_solver=poisson_solver,
    contour_parameters=contour_parameters,
    electrode_voltages=[ 0.  , -0.05]*Volt,
    checkpoint_handler=checkpoint_handler
)
# %% Set Calculator

device_0321_01.setCalculator(calculator)

nlsave('0715_6w_dojo_general_0v_electrode_diele_filled_k1*10_1*100.hdf5', device_0321_01)


# %% IVCharacteristics

kpoints = MonkhorstPackGrid(
    nb=100
)

iv_characteristics = IVCharacteristics(
    configuration=device_0321_01,
    filename='0715_6w_dojo_general_0v_electrode_diele_filled_k1*10_1*100.hdf5',
    object_id='ivc',
    gate_source_voltages=numpy.linspace(0.0, 0.0, 1)*Volt,
    drain_source_voltages=numpy.linspace(-0.05, -0.05, 1)*Volt,
    energies=numpy.linspace(-3.0, 3.0, 101)*eV,
    kpoints=kpoints
)

iv_characteristics.update()

I can't find "device_configuration.update()"
So, I don't know how to insert "device_configuration = nlread("tmp/dojo0715.hdf5")[0]" in my script.
Can anyone help me?
Thanks!

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5585
  • Country: dk
  • Reputation: 101
    • View Profile
    • QuantumATK at Synopsys
Re: How to Restart a stopped calculation(iv_characteristics)
« Reply #1 on: July 29, 2024, 21:15 »
That advise is very old, sorry it wasn't updated.

In the case of IVCharacteristics, just rerun the script exactly as it is, no modifications. Any tasks (bias points etc) that are already done will be skipped, and the calculation will resume where it was interrupted.

Offline dmicje12

  • Regular QuantumATK user
  • **
  • Posts: 18
  • Country: tw
  • Reputation: 0
    • View Profile
Re: How to Restart a stopped calculation(iv_characteristics)
« Reply #2 on: July 30, 2024, 05:16 »
Thanks for your helping!
My situation is a bit complicated.
My iv_characteristics just set one voltage point(vds_-0.05_vgs_0.00)
The voltage point is running SCF(200steps),it is not converged.
I have used checkpoint handler.
So i rerun the script,will it restarts from 200steps or starting a new calculation?
Thanks!

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5585
  • Country: dk
  • Reputation: 101
    • View Profile
    • QuantumATK at Synopsys
Re: How to Restart a stopped calculation(iv_characteristics)
« Reply #3 on: August 2, 2024, 00:00 »
Right, in this case it will be better to figure out why it didn't converge, for instance you need to take smaller steps in voltage. The restart will not start from step 200, it will reattempt the same calculation.

Offline dmicje12

  • Regular QuantumATK user
  • **
  • Posts: 18
  • Country: tw
  • Reputation: 0
    • View Profile
Re: How to Restart a stopped calculation(iv_characteristics)
« Reply #4 on: August 2, 2024, 04:58 »
Thank yuo!
I got it