|
Nordland
|
 |
« Reply #15 on: May 4, 2009, 07:13 » |
|
For some reason it is unable to write the results to a file, however it might be something else.
Perhaps you are missing a if processIsMaster(): before that statement?
|
|
|
|
|
Logged
|
|
|
|
artingchen
Regular ATK user

Reputation: 0
Offline
Posts: 47
|
 |
« Reply #16 on: May 4, 2009, 12:24 » |
|
hello, I edit the script to calculate the I-V curve using this method. the code:
from ATK.TwoProbe import * from ATK.MPI import processIsMaster import ivcurve import numpy
# Generate time stamp if processIsMaster(): import platform, time print '#',time.ctime() print '#',platform.node(),platform.platform()+'\n'
# Opening vnlfile if processIsMaster(): file = VNLFile('C:/Users/617/Desktop/lih.vnl')
# Scattering elements and coordinates scattering_elements = [lithium, Lithium, Lithium, Hydrogen, Hydrogen, Lithium, Lithium, Lithium] scattering_coordinates = [[ 4.35 , 4.35 , 11.6 ], [ 4.35 , 4.35 , 14.5000001 ], [ 4.35 , 4.35 , 17.40000019], [ 4.35 , 4.35 , 19.76600037], [ 4.35 , 4.35 , 20.57000027], [ 4.35 , 4.35 , 22.93600044], [ 4.35 , 4.35 , 25.83600006], [ 4.35 , 4.35 , 28.73599968]]*Angstrom
electrode_elements = [lithium, Lithium, Lithium, Lithium] electrode_coordinates = [[ 4.3499999 , 4.3499999 , 0. ], [ 4.3499999 , 4.3499999 , 2.9000001 ], [ 4.3499999 , 4.3499999 , 5.80000019], [ 4.3499999 , 4.3499999 , 8.69999981]]*Angstrom
electrode_cell = [[ 8.7, 0. , 0. ], [ 0. , 8.7, 0. ], [ 0. , 0. , 11.6]]*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],[3,7]) ) 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 = 150.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*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 = 150.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 = 150.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 = 1, checkpoint_filename = 'C:/Users/617/Desktop/lih.nc' )
voltages = numpy.arange(0.,1.01,0.1)*Volt
ivcurve.runIVcurve ( twoprobe_configuration, two_probe_method, runtime_parameters, voltages, vnl_filename='lih.vnl', sample_name='lih', current_k_point_sampling = (1,1), current_number_of_points = 100 )
iv = ivcurve.extractIVcurveFromVNLFile('lih.vnl','lih')
ivcurve.plotIVCurve(iv,'iv.png') import matplotlib matplotlib.use('Agg') import pylab as P from numpy import array
X = array(iv)[:,0] Y = array(iv)[:,1] P.plot(X,Y) P.xlabel('Bias (Volt)') P.ylabel('Current (Ampere)') P.title('I-V curve for lih')
P.savefig('lih.png')
when I drag this script into in Job manage icon, after the job finish, a i-v photo can be got. but when I run the job with the ATK using the command "$ mpiexec -n 4 /home/ms/vnl-2008.10.0/atk/bin/atk /home/ms/b-pcur/lih.py" an error comes out as follows:
Traceback (most recent call last): File "<string>", line 218, in ? File "/home/ms/vnl-2008.10.0/atk/lib/python2.4/site-packages/ivcurve.py", line 79, in runIVcurve f.addToSample(current,sample_name,'Current at %s V bias' % voltage.inUnitsOf(Volt)) OSError: [Errno 2] No such file or directory: 'lih.vnl'
I run the VNL on linux system, what is the problem? please help me to solve it. thank you !
|
|
|
|
|
Logged
|
|
|
|
|
Anders Blom
|
 |
« Reply #17 on: May 4, 2009, 12:26 » |
|
Impossible to say without seeing the script. Somehow the file, which it tries to add the current to, is not opened. Perhaps there is a missing ifProcessIsMaster(), so a node is trying to write to the VNL file, but only the master node has opened it. Or there is some other typo in the script.
|
|
|
|
|
Logged
|
|
|
|
artingchen
Regular ATK user

Reputation: 0
Offline
Posts: 47
|
 |
« Reply #18 on: May 4, 2009, 12:29 » |
|
dear doctor Blom, I edit the script to calculate the I-V curve using this method. the code:
from ATK.TwoProbe import * from ATK.MPI import processIsMaster import ivcurve import numpy
# Generate time stamp if processIsMaster(): import platform, time print '#',time.ctime() print '#',platform.node(),platform.platform()+'\n'
# Opening vnlfile if processIsMaster(): file = VNLFile('C:/Users/617/Desktop/lih.vnl')
# Scattering elements and coordinates scattering_elements = [lithium, Lithium, Lithium, Hydrogen, Hydrogen, Lithium, Lithium, Lithium] scattering_coordinates = [[ 4.35 , 4.35 , 11.6 ], [ 4.35 , 4.35 , 14.5000001 ], [ 4.35 , 4.35 , 17.40000019], [ 4.35 , 4.35 , 19.76600037], [ 4.35 , 4.35 , 20.57000027], [ 4.35 , 4.35 , 22.93600044], [ 4.35 , 4.35 , 25.83600006], [ 4.35 , 4.35 , 28.73599968]]*Angstrom
electrode_elements = [lithium, Lithium, Lithium, Lithium] electrode_coordinates = [[ 4.3499999 , 4.3499999 , 0. ], [ 4.3499999 , 4.3499999 , 2.9000001 ], [ 4.3499999 , 4.3499999 , 5.80000019], [ 4.3499999 , 4.3499999 , 8.69999981]]*Angstrom
electrode_cell = [[ 8.7, 0. , 0. ], [ 0. , 8.7, 0. ], [ 0. , 0. , 11.6]]*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],[3,7]) ) 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 = 150.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*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 = 150.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 = 150.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 = 1, checkpoint_filename = 'C:/Users/617/Desktop/lih.nc' )
voltages = numpy.arange(0.,1.01,0.1)*Volt
ivcurve.runIVcurve ( twoprobe_configuration, two_probe_method, runtime_parameters, voltages, vnl_filename='lih.vnl', sample_name='lih', current_k_point_sampling = (1,1), current_number_of_points = 100 )
iv = ivcurve.extractIVcurveFromVNLFile('lih.vnl','lih')
ivcurve.plotIVCurve(iv,'iv.png') import matplotlib matplotlib.use('Agg') import pylab as P from numpy import array
X = array(iv)[:,0] Y = array(iv)[:,1] P.plot(X,Y) P.xlabel('Bias (Volt)') P.ylabel('Current (Ampere)') P.title('I-V curve for lih')
P.savefig('lih.png')
when I drag this script into in Job manage icon, after the job finish, a i-v photo can be got. but when I run the job with the ATK using the command "$ mpiexec -n 4 /home/ms/vnl-2008.10.0/atk/bin/atk /home/ms/b-pcur/lih.py" an error comes out as follows:
Traceback (most recent call last): File "<string>", line 218, in ? File "/home/ms/vnl-2008.10.0/atk/lib/python2.4/site-packages/ivcurve.py", line 79, in runIVcurve f.addToSample(current,sample_name,'Current at %s V bias' % voltage.inUnitsOf(Volt)) OSError: [Errno 2] No such file or directory: 'lih.vnl'
I run the VNL on linux system, what is the problem? please help me to solve it. thank you !
how can I solve it ? is there any method?
|
|
|
|
« Last Edit: May 4, 2009, 12:33 by artingchen »
|
Logged
|
|
|
|
|
Anders Blom
|
 |
« Reply #19 on: May 4, 2009, 12:33 » |
|
Well, please post the script  You can remove the whole definition of the geometry, it's not needed and maybe you want to keep it secret, that's fine. Just remove those lines from the script, and attach the remains. Then it will be immediately obvious for us what's wrong, it's just a small detail in the Python code somewhere.
|
|
|
|
|
Logged
|
|
|
|
|
Anders Blom
|
 |
« Reply #20 on: May 4, 2009, 12:49 » |
|
In the call to runIVCurve you must give the name of the VNL file with full path, like you did when it was defined if processIsMaster(): file = VNLFile('C:/Users/617/Desktop/lih.vnl')
So change to ivcurve.runIVcurve ( twoprobe_configuration, two_probe_method, runtime_parameters, voltages, vnl_filename='C:/Users/617/Desktop/lih.vnl', sample_name='lih', current_k_point_sampling = (1,1), current_number_of_points = 100 )
and it should work better! 
|
|
|
|
|
Logged
|
|
|
|
artingchen
Regular ATK user

Reputation: 0
Offline
Posts: 47
|
 |
« Reply #21 on: May 4, 2009, 12:55 » |
|
thank you ! I will try it .
|
|
|
|
|
Logged
|
|
|
|
artingchen
Regular ATK user

Reputation: 0
Offline
Posts: 47
|
 |
« Reply #22 on: May 4, 2009, 15:08 » |
|
dear doctor blom: I have edit the script according to what you told me , but there is also the same error. the code: # Opening vnlfile if processIsMaster(): file = VNLFile('/home/ms/b-pcur/lih.vnl')
ivcurve.runIVcurve ( twoprobe_configuration, two_probe_method, runtime_parameters, voltages, vnl_filename='/home/ms/b-pcur/lih.vnl', sample_name='lih', current_k_point_sampling = (1,1), current_number_of_points = 100 )
iv = ivcurve.extractIVcurveFromVNLFile('/home/ms/b-pcur/lih.vnl','lih')
does the above script have error? now, I don't to know what I can do ? please help me.
|
|
|
|
« Last Edit: May 5, 2009, 04:48 by artingchen »
|
Logged
|
|
|
|
|
Anders Blom
|
 |
« Reply #23 on: May 4, 2009, 15:39 » |
|
Hang on, I think the error might be different. You were running in parallel, and the script doesn't actually check that only the master node writes to the VNL file. Shame on me, that's really bad.
I have fixed the script in the original post; download it and replace your existing file, and try again.
|
|
|
|
|
Logged
|
|
|
|
artingchen
Regular ATK user

Reputation: 0
Offline
Posts: 47
|
 |
« Reply #24 on: May 4, 2009, 15:53 » |
|
thank you! I will try it again.
|
|
|
|
|
Logged
|
|
|
|
artingchen
Regular ATK user

Reputation: 0
Offline
Posts: 47
|
 |
« Reply #25 on: May 5, 2009, 03:09 » |
|
dear doctor blom, I have download the script and replace the existing file. however, when my script run, it does not work and the same error comes out. I want to ask whether the ivcurve.py file works well. do you test it ? Now, I really don't know what can I do? please help me agian. thank you very much.
|
|
|
|
|
Logged
|
|
|
|
|
Anders Blom
|
 |
« Reply #26 on: May 5, 2009, 04:32 » |
|
What is a bit confusing for me is that now we edited scripts left and right, plus you run both on Windows and Linux. As far as I understand, you can run properly in serial on Windows (via the VNL Job Manager, perhaps), but it fails in parallel on Linux, is that correct? And it complains about the VNL file not existing?
Please make a habit of posting the error message when there is one. Even if it seems the same as before, there could be a small crucial difference that helps in finding out what's wrong. For instance, if you are indeed using the new script, it should fail on line 80, not line 79. Also, the error should contain the full path of the "lih.vnl" file.
|
|
|
|
|
Logged
|
|
|
|
artingchen
Regular ATK user

Reputation: 0
Offline
Posts: 47
|
 |
« Reply #27 on: May 5, 2009, 04:36 » |
|
I am so sorry not to post the content of error. I can run properly in serial on Windows or Linux via the VNL Job Manager, but it fails in parallel on Linux. I do download the the new ivcurve.py file and replace the existing file. the code: # Opening vnlfile if processIsMaster(): file = VNLFile('/home/ms/b-pcur/lih.vnl')
ivcurve.runIVcurve ( twoprobe_configuration, two_probe_method, runtime_parameters, voltages, vnl_filename='/home/ms/b-pcur/lih.vnl', sample_name='lih', current_k_point_sampling = (1,1), current_number_of_points = 100 )
iv = ivcurve.extractIVcurveFromVNLFile('/home/ms/b-pcur/lih.vnl','lih')
but the error is as follows;
Traceback (most recent call last): File "<string>", line 226, in ? File "/home/ms/vnl-2008.10.0/atk/lib/python2.4/site-packages/ivcurve.py", line 80, in runIVcurve if processIsMaster: f.addToSample(current,sample_name,'Current at %s V bias' % voltage.inUnitsOf(Volt)) OSError: [Errno 2] No such file or directory: '/home/ms/b-pcur/lih.vnl'
the path of the "lih.vnl" file have a problem? please help me? the job run on Linux system with the command "$ mpiexec -n 4 /home/ms/vnl-2008.10.0/atk/bin/atk /home/ms/b-pcur/lih.py"
|
|
|
|
« Last Edit: May 5, 2009, 04:53 by artingchen »
|
Logged
|
|
|
|
|
Anders Blom
|
 |
« Reply #28 on: May 5, 2009, 04:52 » |
|
I must really apologize, it was a typing mistake on my part (which is obvious from the error message  ). It should be isProcessMaster(), not isProcessMaster. Small details, simple to find when you know. And yes, I should have tested the script in parallel, but as I wrote before I forgot to do it, and right now I don't have any parallel computer at hand (I'm travelling). I have updated the script in the original post; really hope this version finally works properly! (Fortunately, not too much time is wasted before the error occurs.) Is the Forum working really slow for you too? It's strange, normally it responds fast, but right now it's really sluggish... I've tried optimizing the tables and checking for errors, but it seems ok... Can only hope it solves itself.
|
|
|
|
|
Logged
|
|
|
|
artingchen
Regular ATK user

Reputation: 0
Offline
Posts: 47
|
 |
« Reply #29 on: May 5, 2009, 05:05 » |
|
thank you ! I will try it again. if there is any problem, would you like helping again?  you are so kind person. thank you again. best regards. have a good trip! by the way, do you like the chinese culture? I hope you can have a trip in china.  welcome to china! I am in china. 
|
|
|
|
|
Logged
|
|
|
|
|