Author Topic: Trouble Restarting from a checkpoint file  (Read 16998 times)

0 Members and 1 Guest are viewing this topic.

Offline hellboy

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
Re: Trouble Restarting from a checkpoint file
« Reply #15 on: September 1, 2010, 07:22 »
I have attached the ivscript.py and the script. In Linux the script makes only one checkpoint  file.
Code
from ATK.TwoProbe import *

from ATK.MPI import processIsMaster

import ivcurve



# Generate time stamp

if processIsMaster():

    import platform, time

    print '#',time.ctime()

    print '#',platform.node(),platform.platform()+'\n'



# Opening vnlfile

if processIsMaster(): file = VNLFile('/home/hellboy/Desktop/NanoLab simulations/SWCNT 44 Two probe/SWCNT44twoprobe.vnl')



# Scattering elements

left_surface_elements  = [Carbon, Carbon, Carbon, Carbon, 

                          Carbon, Carbon, Carbon, Carbon, 

                          Carbon, Carbon, Carbon, Carbon, 

                          Carbon, Carbon, Carbon, Carbon]

central_atom_elements  = [Carbon, Carbon, Carbon, Carbon, 

                          Carbon, Carbon, Carbon, Carbon, 

                          Carbon, Carbon, Carbon, Carbon, 

                          Carbon, Carbon, Carbon, Carbon, 

                          Carbon, Carbon, Carbon, Carbon, 

                          Carbon, Carbon, Carbon, Carbon, 

                          Carbon, Carbon, Carbon, Carbon, 

                          Carbon, Carbon, Carbon, Carbon]

right_surface_elements = [Carbon, Carbon, Carbon, Carbon, 

                          Carbon, Carbon, Carbon, Carbon, 

                          Carbon, Carbon, Carbon, Carbon, 

                          Carbon, Carbon, Carbon, Carbon]

scattering_elements = left_surface_elements + central_atom_elements + right_surface_elements



# Scattering coordinates

left_surface_coordinates  = [[ 10.32234097,   7.60652113,   2.46297622],

                             [  7.60652113,  10.32234097,   2.46297622],

                             [  4.89070082,   7.60652113,   2.46297622],

                             [  7.60652113,   4.89070082,   2.46297622],

                             [  9.95849037,   8.96443081,   2.46297622],

                             [  6.24861097,   9.95849037,   2.46297622],

                             [  5.25455189,   6.24861097,   2.46297622],

                             [  8.96443081,   5.25455189,   2.46297622],

                             [  9.52689552,   9.52689552,   3.69446445],

                             [  5.68614626,   9.52689552,   3.69446445],

                             [  5.68614626,   5.68614626,   3.69446445],

                             [  9.52689552,   5.68614626,   3.69446445],

                             [  8.30942726,  10.22980118,   3.69446445],

                             [  4.98324013,   8.30942726,   3.69446445],

                             [  6.903615  ,   4.98324013,   3.69446445],

                             [ 10.22980118,   6.903615  ,   3.69446445]]*Angstrom

central_atom_coordinates  = [[ 10.32234097,   7.60652113,   4.92602378],

                             [  9.52689552,   9.52689552,   6.15751189],

                             [  7.60652113,  10.32234097,   4.92602378],

                             [  5.68614626,   9.52689552,   6.15751189],

                             [  4.89070082,   7.60652113,   4.92602378],

                             [  5.68614626,   5.68614626,   6.15751189],

                             [  7.60652113,   4.89070082,   4.92602378],

                             [  9.52689552,   5.68614626,   6.15751189],

                             [  9.95849037,   8.96443081,   4.92602378],

                             [  8.30942726,  10.22980118,   6.15751189],

                             [  6.24861097,   9.95849037,   4.92602378],

                             [  4.98324013,   8.30942726,   6.15751189],

                             [  5.25455189,   6.24861097,   4.92602378],

                             [  6.903615  ,   4.98324013,   6.15751189],

                             [  8.96443081,   5.25455189,   4.92602378],

                             [ 10.22980118,   6.903615  ,   6.15751189],

                             [ 10.32234097,   7.60652113,   7.389     ],

                             [  9.52689552,   9.52689552,   8.62048811],

                             [  7.60652113,  10.32234097,   7.389     ],

                             [  5.68614626,   9.52689552,   8.62048811],

                             [  4.89070082,   7.60652113,   7.389     ],

                             [  5.68614626,   5.68614626,   8.62048811],

                             [  7.60652113,   4.89070082,   7.389     ],

                             [  9.52689552,   5.68614626,   8.62048811],

                             [  9.95849037,   8.96443081,   7.389     ],

                             [  8.30942726,  10.22980118,   8.62048811],

                             [  6.24861097,   9.95849037,   7.389     ],

                             [  4.98324013,   8.30942726,   8.62048811],

                             [  5.25455189,   6.24861097,   7.389     ],

                             [  6.903615  ,   4.98324013,   8.62048811],

                             [  8.96443081,   5.25455189,   7.389     ],

                             [ 10.22980118,   6.903615  ,   8.62048811]]*Angstrom

right_surface_coordinates = [[ 10.32234097,   7.60652113,   9.85146421],

                             [  7.60652113,  10.32234097,   9.85146421],

                             [  4.89070082,   7.60652113,   9.85146421],

                             [  7.60652113,   4.89070082,   9.85146421],

                             [  9.95849037,   8.96443081,   9.85146421],

                             [  6.24861097,   9.95849037,   9.85146421],

                             [  5.25455189,   6.24861097,   9.85146421],

                             [  8.96443081,   5.25455189,   9.85146421],

                             [  9.52689552,   9.52689552,  11.08295232],

                             [  5.68614626,   9.52689552,  11.08295232],

                             [  5.68614626,   5.68614626,  11.08295232],

                             [  9.52689552,   5.68614626,  11.08295232],

                             [  8.30942726,  10.22980118,  11.08295232],

                             [  4.98324013,   8.30942726,  11.08295232],

                             [  6.903615  ,   4.98324013,  11.08295232],

                             [ 10.22980118,   6.903615  ,  11.08295232]]*Angstrom

scattering_coordinates = left_surface_coordinates + central_atom_coordinates + right_surface_coordinates



electrode_elements = [Carbon, Carbon, Carbon, Carbon, 

                      Carbon, Carbon, Carbon, Carbon, 

                      Carbon, Carbon, Carbon, Carbon, 

                      Carbon, Carbon, Carbon, Carbon]

electrode_coordinates = [[ 10.32234097,   7.60652113,   0.        ],

                         [  9.52689552,   9.52689552,   1.23148811],

                         [  7.60652113,  10.32234097,   0.        ],

                         [  5.68614626,   9.52689552,   1.23148811],

                         [  4.89070082,   7.60652113,   0.        ],

                         [  5.68614626,   5.68614626,   1.23148811],

                         [  7.60652113,   4.89070082,   0.        ],

                         [  9.52689552,   5.68614626,   1.23148811],

                         [  9.95849037,   8.96443081,   0.        ],

                         [  8.30942726,  10.22980118,   1.23148811],

                         [  6.24861097,   9.95849037,   0.        ],

                         [  4.98324013,   8.30942726,   1.23148811],

                         [  5.25455189,   6.24861097,   0.        ],

                         [  6.903615  ,   4.98324013,   1.23148811],

                         [  8.96443081,   5.25455189,   0.        ],

                         [ 10.22980118,   6.903615  ,   1.23148811]]*Angstrom



electrode_cell = [[ 15.2130418 ,   0.        ,   0.        ],

                  [  0.        ,  15.2130418 ,   0.        ],

                  [  0.        ,   0.        ,   2.46297625]]*Angstrom



# Set up electrodes

electrode_configuration = PeriodicAtomConfiguration(

    electrode_cell,

    electrode_elements,

    electrode_coordinates

    )



# Set up two-probe configuration

twoprobe_configuration = TwoProbeConfiguration(

    (electrode_configuration,electrode_configuration),

    scattering_elements,

    scattering_coordinates,

    electrode_repetitions=[[1,1],[1,1]],

    equivalent_atoms=([0,0],[1,56])

    )

if processIsMaster(): nlPrint(twoprobe_configuration)

if processIsMaster(): file.addToSample(twoprobe_configuration, 'twoprobe_configuration')



######################################################################

# Central region parameters

######################################################################

exchange_correlation_type = LDA.PZ



iteration_mixing_parameters = iterationMixingParameters(

    algorithm = IterationMixing.Pulay,

    diagonal_mixing_parameter = 0.1,

    quantity = IterationMixing.Hamiltonian,

    history_steps = 6

)



electron_density_parameters = electronDensityParameters(

    mesh_cutoff = 400.0*Rydberg

)



basis_set_parameters = basisSetParameters(

    type = DoubleZetaPolarized,

    radial_sampling_dr = 0.001*Bohr,

    energy_shift = 0.01*Rydberg,

    delta_rinn = 0.8,

    v0 = 40.0*Rydberg,

    charge = 0.0,

    split_norm = 0.15

)



iteration_control_parameters = iterationControlParameters(

    tolerance = 1e-005,

    criterion = IterationControl.TotalEnergy,

    max_steps = 100

)



electrode_voltages = (0.0,0.0)*Volt



two_probe_algorithm_parameters = twoProbeAlgorithmParameters(

    electrode_constraint = ElectrodeConstraints.Off,

    initial_density_type = InitialDensityType.EquivalentBulk

)



energy_contour_integral_parameters = energyContourIntegralParameters(

    circle_points = 30,

    integral_lower_bound = 3.0*Rydberg,

    fermi_line_points = 10,

    fermi_function_poles = 4,

    real_axis_infinitesimal = 0.01*electronVolt,

    real_axis_point_density = 0.02*electronVolt

)



two_center_integral_parameters = twoCenterIntegralParameters(

    cutoff = 2500.0*Rydberg,

    points = 1024

)



######################################################################

# Left electrode parameters

######################################################################

left_electrode_electron_density_parameters = electronDensityParameters(

    mesh_cutoff = 400.0*Rydberg

)



left_electrode_iteration_control_parameters = iterationControlParameters(

    tolerance = 1e-005,

    criterion = IterationControl.TotalEnergy,

    max_steps = 100

)



left_electrode_brillouin_zone_integration_parameters = brillouinZoneIntegrationParameters(

    monkhorst_pack_parameters = (1, 1, 500)

)



left_electrode_iteration_mixing_parameters = iterationMixingParameters(

    algorithm = IterationMixing.Pulay,

    diagonal_mixing_parameter = 0.1,

    quantity = IterationMixing.Hamiltonian,

    history_steps = 6

)



left_electrode_eigenstate_occupation_parameters = eigenstateOccupationParameters(

    temperature = 300.0*Kelvin

)



######################################################################

# Collect left electrode parameters

######################################################################

left_electrode_parameters = ElectrodeParameters(

    brillouin_zone_integration_parameters = left_electrode_brillouin_zone_integration_parameters,

    electron_density_parameters = left_electrode_electron_density_parameters,

    eigenstate_occupation_parameters = left_electrode_eigenstate_occupation_parameters,

    iteration_mixing_parameters = left_electrode_iteration_mixing_parameters,

    iteration_control_parameters = left_electrode_iteration_control_parameters

)



######################################################################

# Right electrode parameters

######################################################################

right_electrode_electron_density_parameters = electronDensityParameters(

    mesh_cutoff = 400.0*Rydberg

)



right_electrode_iteration_control_parameters = iterationControlParameters(

    tolerance = 1e-005,

    criterion = IterationControl.TotalEnergy,

    max_steps = 100

)



right_electrode_brillouin_zone_integration_parameters = brillouinZoneIntegrationParameters(

    monkhorst_pack_parameters = (1, 1, 500)

)



right_electrode_iteration_mixing_parameters = iterationMixingParameters(

    algorithm = IterationMixing.Pulay,

    diagonal_mixing_parameter = 0.1,

    quantity = IterationMixing.Hamiltonian,

    history_steps = 6

)



right_electrode_eigenstate_occupation_parameters = eigenstateOccupationParameters(

    temperature = 300.0*Kelvin

)



######################################################################

# Collect right electrode parameters

######################################################################

right_electrode_parameters = ElectrodeParameters(

    brillouin_zone_integration_parameters = right_electrode_brillouin_zone_integration_parameters,

    electron_density_parameters = right_electrode_electron_density_parameters,

    eigenstate_occupation_parameters = right_electrode_eigenstate_occupation_parameters,

    iteration_mixing_parameters = right_electrode_iteration_mixing_parameters,

    iteration_control_parameters = right_electrode_iteration_control_parameters

)



######################################################################

# Initialize self-consistent field calculation

######################################################################

two_probe_method = TwoProbeMethod(

    electrode_parameters = (left_electrode_parameters,right_electrode_parameters),

    exchange_correlation_type = exchange_correlation_type,

    iteration_mixing_parameters = iteration_mixing_parameters,

    electron_density_parameters = electron_density_parameters,

    basis_set_parameters = basis_set_parameters,

    iteration_control_parameters = iteration_control_parameters,

    energy_contour_integral_parameters = energy_contour_integral_parameters,

    two_center_integral_parameters = two_center_integral_parameters,

    electrode_voltages = electrode_voltages,

    algorithm_parameters = two_probe_algorithm_parameters

)

if processIsMaster(): nlPrint(two_probe_method)



runtime_parameters = runtimeParameters(

    verbosity_level = 10,

    checkpoint_filename = '/home/hellboy/Desktop/NanoLab simulations/SWCNT 44 Two probe/SWCNT44twoprobe.nc'

)



voltages=[0.0,0.5,1.0]*Volt



ivcurve.runIVcurve (

    twoprobe_configuration, 

    two_probe_method, 

    runtime_parameters,

    voltages, 

    vnl_filename='/home/hellboy/Desktop/NanoLab simulations/SWCNT 44 Two probe/SWCNT44twoprobe_iv.vnl', sample_name='/home/hellboy/Desktop/NanoLab simulations/SWCNT 44 Two probe/SWCNT44twoprobe', 

    current_k_point_sampling = (1,1),

    current_number_of_points = 100

  )

Offline hellboy

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
Re: Trouble Restarting from a checkpoint file
« Reply #16 on: September 1, 2010, 10:28 »
I feel it should create 3 checkpoint files ie., for 0v, 0.5V and 1.0V
I am not using voltage.arange and in windows it generates 3 netCDF files.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5571
  • Country: dk
  • Reputation: 93
    • View Profile
    • QuantumATK at Synopsys
Re: Trouble Restarting from a checkpoint file
« Reply #17 on: September 1, 2010, 10:32 »
Of course. My mistake, sorry.

Try not using spaces in your filenames...

What is the name of the file that is created on Linux? Is there some hints in the log file, does it actually run all 3 voltages?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5571
  • Country: dk
  • Reputation: 93
    • View Profile
    • QuantumATK at Synopsys
Re: Trouble Restarting from a checkpoint file
« Reply #18 on: September 1, 2010, 10:34 »
Also, try not using the full path of the file, just a local name (all files get written to the current directory anyway, if you run from the command line).

Offline hellboy

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
Re: Trouble Restarting from a checkpoint file
« Reply #19 on: September 1, 2010, 10:39 »
I am not using spaces in filenames.
The name of the file created is SWCNT44twoprobe.nc in Linux
The size of single NetCDF file that is created in Linux is around 69MB, whereas the 3 NetCDF files that were created in Windows is 19.75 MB each

I will try with a local checkpoint file name and will not add full path.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5571
  • Country: dk
  • Reputation: 93
    • View Profile
    • QuantumATK at Synopsys
Re: Trouble Restarting from a checkpoint file
« Reply #20 on: September 1, 2010, 10:42 »
Well, there were spaces in the path name, that's what I meant :)

I'll check if there is some trivial mistake that only appears on Linux

Offline hellboy

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
Re: Trouble Restarting from a checkpoint file
« Reply #21 on: September 1, 2010, 10:44 »
It did not completed run  for 3 voltages, my problem is that it must have created SWCNT44twoprob-0.0.nc then for other voltages.
But it created SWCNT44twoprobe.nc which is suspicious and that too of 69.5 MB size.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5571
  • Country: dk
  • Reputation: 93
    • View Profile
    • QuantumATK at Synopsys
Re: Trouble Restarting from a checkpoint file
« Reply #22 on: September 1, 2010, 10:56 »
I'm running some tests. Meanwhile, just a note: your "sample_name" for runIVcurve is not appropriate. You should set it to twoprobe_configuration to match the geometry.

Also, you may just as well lower the verbosity to 1 while testing. Did you check if indeed it runs all 3 voltages on Linux? What about the VNL file on Linux, do you have the current for all 3 voltages there?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5571
  • Country: dk
  • Reputation: 93
    • View Profile
    • QuantumATK at Synopsys
Re: Trouble Restarting from a checkpoint file
« Reply #23 on: September 1, 2010, 10:57 »
My initial tests show no problems. I'm getting a "SWCNT4twoprobe-0.0.nc" file already after the first electrode iteration on the zero-bias case.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5571
  • Country: dk
  • Reputation: 93
    • View Profile
    • QuantumATK at Synopsys
Re: Trouble Restarting from a checkpoint file
« Reply #24 on: September 1, 2010, 11:00 »
Sorry, didn't see your post before mine. Are you sure the SWCNT44twoprobe.nc file is not from another run? Try starting fresh in a new directory. Check the ivcurve.py script, do you have the latest version? The magic line is
Code: python
new_filename = os.path.splitext(nc_filename)[0] + ('-%s' % voltage.inUnitsOf(Volt)) + os.path.splitext(nc_filename)[1]
« Last Edit: September 1, 2010, 11:02 by Anders Blom »

Offline hellboy

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
Re: Trouble Restarting from a checkpoint file
« Reply #25 on: September 1, 2010, 12:05 »
My run did not create SWCNT4twoprobe-0.0.nc so i stopped.
I have the latest ivscript.py with the "magic line"
Thank you for  "sample_name"  correction.

Offline hellboy

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
Re: Trouble Restarting from a checkpoint file
« Reply #26 on: September 1, 2010, 12:18 »
I will try again taking your instructions into consideartion.
Thanks a lot for your prompt replies.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5571
  • Country: dk
  • Reputation: 93
    • View Profile
    • QuantumATK at Synopsys
Re: Trouble Restarting from a checkpoint file
« Reply #27 on: September 1, 2010, 12:33 »
I suggest you try a dry run, using the attached script instead of your existing ivcurve.py. That is, add this line
Code: python
import ivcurve_test as ivcurve
below the existing "import ivcurve" statement (you can keep that line) and let's see what it says.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5571
  • Country: dk
  • Reputation: 93
    • View Profile
    • QuantumATK at Synopsys
Re: Trouble Restarting from a checkpoint file
« Reply #28 on: September 1, 2010, 12:39 »
I think I know what the problem is!!! As we can see from the test run, the PATH to the file is not kept. So, the NC files will be created in the current directory from where you run, and not where you asked it to be placed. To fix this, change the magic line to
Code: python
new_filename = path+"/"+os.path.splitext(nc_filename)[0] + ('-%s' % voltage.inUnitsOf(Volt)) + os.path.splitext(nc_filename)[1]
But probably somewhere on your system (/tmp?) there might be the NC files already...

Offline hellboy

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
Re: Trouble Restarting from a checkpoint file
« Reply #29 on: September 2, 2010, 07:10 »
I haven't checked it with new "magic line"
I've rerun the script with no spacing in file names and also didn't specified the full path. Now I am able to get seperate NetCDF files in /bin folder of my ATK installation. VNL files are also generated in /bin folder.
I will soon try with the addition of "magic lines".

Thanks for your prompt responses.