QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: zdhlover on April 16, 2010, 15:40

Title: Re: what's happen when I compute the voltage drop?
Post by: zdhlover on April 16, 2010, 15:40
I don't know why I can't reply that topic ?

By the way ,The upload folder of the forum is full ,please check it !  

This time I make the sufficent screen layers ,but the same thing happen, waht's wrong?

I have been checked the http://quantumwise.com/forum/index.php?topic=21.0 carefully, and I also notice the setup of electrode_constraint = ElectrodeConstraints.RealSpaceDensity, but the same thing happen , what 's wrong ?

Could you check my scripts and run them to see what's happen?





from ATK.TwoProbe import *
from ATK.MPI import processIsMaster

# Generate time stamp
if processIsMaster():
    import platform, time
    print '#',time.ctime()
    print '#',platform.node(),platform.platform()+'\n'

# Opening vnlfile
if processIsMaster(): file = VNLFile('D:/voltage/new2/sufficent.vnl')

# Scattering elements and coordinates
scattering_elements = [Lithium,  Lithium,  Lithium,  Lithium, 
                       Lithium,  Lithium,  Lithium,  Lithium, 
                       Lithium,  Lithium,  Hydrogen, Hydrogen,
                       Lithium,  Lithium,  Lithium,  Lithium, 
                       Lithium,  Lithium,  Lithium,  Lithium, 
                       Lithium,  Lithium]
scattering_coordinates = [[  4.80000019,   4.80000019,   5.76000023],
                          [  4.80000019,   4.80000019,   8.64000034],
                          [  4.80000019,   4.80000019,  11.52000046],
                          [  4.80000019,   4.80000019,  14.40000057],
                          [  4.80000019,   4.80000019,  17.28000069],
                          [  4.80000019,   4.80000019,  20.15999985],
                          [  4.80000019,   4.80000019,  23.04000092],
                          [  4.80000019,   4.80000019,  25.92000008],
                          [  4.80000019,   4.80000019,  28.79999996],
                          [  4.80000019,   4.80000019,  31.68000008],
                          [  4.80000019,   4.80000019,  34.83999992],
                          [  4.80000019,   4.80000019,  33.85999943],
                          [  4.80000019,   4.80000019,  37.02000023],
                          [  4.80000019,   4.80000019,  39.90000034],
                          [  4.80000019,   4.80000019,  60.06000264],
                          [  4.80000019,   4.80000019,  62.94000299],
                          [  4.80000019,   4.80000019,  54.30000241],
                          [  4.80000019,   4.80000019,  57.18000252],
                          [  4.80000019,   4.80000019,  48.54000218],
                          [  4.80000019,   4.80000019,  51.42000325],
                          [  4.80000019,   4.80000019,  42.78000195],
                          [  4.80000019,   4.80000019,  45.66000302]]*Angstrom
       

electrode_elements = [Lithium, Lithium]
electrode_coordinates = [[ 4.80000019,  4.80000019,  0.        ],
                         [ 4.80000019,  4.80000019,  2.88000011]]*Angstrom

electrode_cell = [[ 9.6 ,  0.  ,  0.  ],
                  [ 0.  ,  9.6 ,  0.  ],
                  [ 0.  ,  0.  ,  5.76]]*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,15])
    )
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 = SingleZetaPolarized,
    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 = (1.0,0.0)*Volt

two_probe_algorithm_parameters = twoProbeAlgorithmParameters(
    electrode_constraint = ElectrodeConstraints.RealSpaceDensity,
    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, 200)
)

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, 200)
)

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)

# Restore self consistent calculation from check point file
scf = restoreSelfConsistentCalculation(
    filename = 'D:/voltage/new2/0.nc'
)

runtime_parameters = runtimeParameters(
    verbosity_level = 10,
    checkpoint_filename = 'D:/voltage/new2/1.nc'
)

# Using initial density from self consistent calculation
scf = executeSelfConsistentCalculation(
    twoprobe_configuration,
    two_probe_method,
    initial_calculation = scf,
    runtime_parameters = runtime_parameters
)
Title: Re: what's happen when I compute the voltage drop?
Post by: Anders Blom on April 16, 2010, 16:47
Your coordinates are still funny. They should be without a lot of decimals, just 20.16, not 20.159999995. Try to set up the geometry via a script instead.

Also, in this setup the electrode is too short.


Title: Re: what's happen when I compute the voltage drop?
Post by: zdhlover on April 17, 2010, 05:08
 :( :( :(

I also try other two-probe systemes, but I still get the strange voltage-drop(1v-0v) image as append images !

My scripts are all build with vnl, the coordinates and the decimals are all auto obtained, I also pay attention to the notice,but ....
and I wonder two questiones:

1, Are you sure the voltage-drop is so sensitive to the coordinates? If it is ,after we optimize the two-probe systemes,
   can we get the correct results?

2, And do you try my scripts to compute the voltage-drop?  If my scripts are all not correct, could you offer some right scripts and the right
     voltage-drop image?

By the way , my computation and other's we perfomed are all in vnl 2008.10 ,this error is common,and I ask this question because I can't corretly answer others same questiones.
Title: Re: what's happen when I compute the voltage drop?
Post by: zh on April 17, 2010, 07:46
The numerical values for the coordinates in the script file seem reasonable. The problem observed for the voltage drop does not matter to the numerical values of coordinates. The two-probe system just consists of atomic chain.  It will be meaningful to show the contour plot of voltage drop in a plane containing  the atomic chain.  Or try a case with more screening surface layers. 
Title: Re: what's happen when I compute the voltage drop?
Post by: zdhlover on April 17, 2010, 09:35
 :( :( :(

I have to mentioned: I ask this question because I can't corretly answer others people's same questiones! My scripts are all build with vnl, the coordinates and the decimals are all auto obtained, I also pay attention to the notice(for example: more screening surface layers ,long electrode and others ), and I also try many situationes ,but the same thing happen!

and I wonder two questiones:

1, Are you sure the voltage-drop is so sensitive to the coordinates? If it is ,after we optimize the two-probe systemes,
   can we get the correct results?

2, And do you try my scripts to compute the voltage-drop?  If my scripts are all not correct, could you offer some right scripts and the right
     voltage-drop image for us running to check ?
Title: Re: what's happen when I compute the voltage drop?
Post by: zdhlover on April 17, 2010, 11:05
The above are all performed in VNL 2008.10, and I also test the same script above ( lisufficen1v.py lisufficen0v.py) in VNL 2008.02

and I get the difference image and output as below!?


And I wonder  it is correct? and I also wonder the correct voltage-drop (1v-0v) is 1.0 0.1 0.08 0.07 0.06 ……………0.01 0.0(in ASCII  ;D ;D   may be not so homogeneous)?
Title: Re: what's happen when I compute the voltage drop?
Post by: zdhlover on April 17, 2010, 14:45
 :) :) :)

To test where is the question, I also use the two .nc  files which generate by VNL 2008.10 to compute the  voltage-drop in VNL 2008.02, and the same image by use the two .nc files which generate by VNL 2008.02. Does  the question hide in the function of calculateEffectivePotentialin VNL 2008.10?


And I also want to know  the correct voltage-drop (1v-0v) is like 1.0 0.1 0.02 0.07 0.04 ……………0.01 0.0(in ASCII )?
                                                                                                                   =1.0

The append files are the voltage-drop image compute in VNL 2008.10 and VNL2008.02 by use the same two .nc  filles which generate by VNL 2008.10 .
Title: Re: what's happen when I compute the voltage drop?
Post by: nori on April 17, 2010, 16:01
Quote
The above are all performed in VNL 2008.10, and I also test the same script above ( lisufficen1v.py lisufficen0v.py) in VNL 2008.02

and I get the difference image and output as below!?
There is the bug in VNL 2008.02 which some physical properties such as Effective potential don't be calculated properly when you use a density matrix stored in NetCDF file.

As regards your latest example, the electrode size is too small as Anders mentioned above and you have to use the electrode that includes more than 4 atoms in the unit cell.
Besides it, if you use "ElectrodeConstraints.RealSpaceDensity", the coordinates of electrodes should be centered.

I guess that "ElectrodeConstraints.DensityMatrix" is the best choice for you system and recommend you to try it.
Title: Re: what's happen when I compute the voltage drop?
Post by: zdhlover on April 17, 2010, 16:35
Quote
The above are all performed in VNL 2008.10, and I also test the same script above ( lisufficen1v.py lisufficen0v.py) in VNL 2008.02

and I get the difference image and output as below!?
There is the bug in VNL 2008.02 which some physical properties such as Effective potential don't be calculated properly when you use a density matrix stored in NetCDF file.

As regards your latest example, the electrode size is too small as Anders mentioned above and you have to use the electrode that includes more than 4 atoms in the unit cell.
Besides it, if you use "ElectrodeConstraints.RealSpaceDensity", the coordinates of electrodes should be centered.

I guess that "ElectrodeConstraints.DensityMatrix" is the best choice for you system and recommend you to try it.

But I also ues VNL 2008.02 and 2008.10 compute the average potential along the Z axis,  the two which is correct?
Title: Re: what's happen when I compute the voltage drop?
Post by: nori on April 17, 2010, 17:01
The bug is fixed in 2008.10 so you should always use 2008.10.
But unfortunately, "VNL2008.10.png" is also strange because voltage drop should occur mainly around H2...
Have you changed the ElectrodeConstraint?
It seems that "ElectrodeConstraints.RealSpaceDensity" is still selected in "VNL2008.10.png"...
Title: Re: what's happen when I compute the voltage drop?
Post by: zdhlover on April 17, 2010, 17:12
The bug is fixed in 2008.10 so you should always use 2008.10.
Have you changed the ElectrodeConstraint?
It seems that "ElectrodeConstraints.RealSpaceDensity" is still selected in "VNL2008.10.png"...

yes, my computation  all performed with "ElectrodeConstraints.RealSpaceDensity".

and I am so sorry that I can't find the best choice you said " "ElectrodeConstraints.DensityMatrix"
Title: Re: what's happen when I compute the voltage drop?
Post by: nori on April 17, 2010, 17:19
Quote
and I am so sorry that I can't find the best choice you said " "ElectrodeConstraints.DensityMatrix"
You can't select "ElectrodeConstraints.DensityMatrix" in NanoLanguage Scripter and you have to modify the script by hand.
Title: Re: what's happen when I compute the voltage drop?
Post by: nori on April 17, 2010, 17:38
Another possible reason is that you choose multi-grid solver.
If my memory is right, strange voltage drop is obtained with multi-grid solver of 2008.10 in some 2probe systems.

Could you try the scripts attached in this post?
With these scripts, calculations with "ElectrodeConstraints.DensityMatrix" and FFT solver are executed.
Title: Re: what's happen when I compute the voltage drop?
Post by: zdhlover on April 18, 2010, 04:54
Another possible reason is that you choose multi-grid solver.
If my memory is right, strange voltage drop is obtained with multi-grid solver of 2008.10 in some 2probe systems.

Could you try the scripts attached in this post?
With these scripts, calculations with "ElectrodeConstraints.DensityMatrix" and FFT solver are executed.

I understand what you mean.  I use your scripts compute in VNL 2008.10, and I get the result as the append files.
And I wonder are there correct?  How can we judge the image of voltage-drop and the data of the the average potential along Z axiz is correct?
Title: Re: what's happen when I compute the voltage drop?
Post by: nori on April 20, 2010, 08:15
Please note that it is very difficult to judge whether a calculated voltage drop is CORRECT.
But I feel your latest one is the most reasonable because there is no dip at the interface between central region and right electrode and no dipole-like potential is induced.

I guess any more improvement can't be achieved with 2008.10 unless the bias voltage is decreased.
Possibly the new algorithm of 2010.02 can make it better.
Title: Re: what's happen when I compute the voltage drop?
Post by: Anders Blom on April 20, 2010, 23:31
We should also note that a 1D system like this might not be the best one for testing the voltage drop, since the 1D chain screens the potential very poorly. I also think, when looking more closely at it, that the XY unit cell should be expanded in this example; there seems to be some interaction with the repeated chains in these directions. I would also sharpen the tolerance, not sure how much it helps, but the default 1e-5 is a bit on the liberal side for certain quantities (probably not current, but maybe more "intrinsic" quantities.

I would also like to point you to the beautiful voltage drop pictures (http://quantumwise.com/forum/index.php?topic=21.msg406#msg406) posted by "nori", that really show that ATK can compute this accurately and "correct", if the system is correspondingly set up.

The 1D Li-H2-Li should in general not be seen a very suitable two-probe test system; many of its properties are quite artificial, in fact. Its primary appeal is that it's fast to compute, and so it serves as a good example to teach people how to compute various things, but it's less suitable for analyzing the results!

Finally, if you are interested in computing the voltage drop, you might find my new post (http://quantumwise.com/forum/index.php?topic=3.msg3210;topicseen#msg3210) on extracting the effective potential from a VNL file useful!