Author Topic: Re: can VNL calculate the variation of the current as a function of voltage?  (Read 12144 times)

0 Members and 1 Guest are viewing this topic.

Offline artingchen

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
dear
 I have edited the script followed what you describe ,but when the job run, SyntaxError: invalid syntax (c:/users/617/appdata/local/temp/tmpwdhrmo.nl, line 419) comes out.
my script is edited as follows:


from ATK.TwoProbe import *
from ATK.MPI import processIsMaster
import numpy%
« Last Edit: April 29, 2009, 12:51 by artingchen »

Offline Nordland

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 812
  • Reputation: 18
    • View Profile
The short answer: No.

What I do, is that I setup the script in VNL, and drop the fina script to the editor, and add the small loop at the end of the file, and then I go.

Offline artingchen

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
dear,
 can you show me the script in detail? I try to edit script many times, however, when I run the script, errors happed.

Offline artingchen

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
I edit  the script in Calculating physical propertiesas follow :
######################################################################
# Calculate physical properties
######################################################################
import numpy
for voltage in numpy.arange(-4.0, 4.0+0.0205128205128, 0.205128205128)
current = calculateCurrent(
    self_consistent_calculation = scf,
    electrode_voltages = (voltage/2.0, -voltage/2.0)*Volt,
    brillouin_zone_integration_parameters = brillouinZoneIntegrationParameters((1, 1)),
    green_function_infinitesimal = 1.0e-5*electronVolt,
    number_of_points = 100
)
if processIsMaster(): nlPrint(current)
if processIsMaster(): file.addToSample(current, 'twoprobe_configuration', 'Current')


but when it is running, the error of electrode_voltage is not identified.
 
how can I edit the script?
 

Offline serhan

  • Heavy QuantumATK user
  • ***
  • Posts: 98
  • Reputation: 1
    • View Profile
Code
for voltage in numpy.arange(4.5, 5.01, 0.1):
	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 = (voltage, 0)*Volt,
	    algorithm_parameters = two_probe_algorithm_parameters
	)

	if processIsMaster(): nlPrint(voltage)
	import datetime
	
	if processIsMaster(): print "Calculation started:", datetime.datetime.now().replace(microsecond=0)

	runtime_parameters = runtimeParameters(
    	verbosity_level = 1,
    	checkpoint_filename = '/home/master/sweep/%.1fV.nc' % voltage
	)

	# Perform self-consistent field calculation
	scf = executeSelfConsistentCalculation(
    	twoprobe_configuration,
    	two_probe_method,
    	runtime_parameters = runtime_parameters,
	initial_calculation=scf
	)
This works... Cheers, Serhan

Offline artingchen

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
thank you very much ! I want to ask where the above loop is add to in the whole script. when I put it in the end of the script, it does not work. when I put it in before the line

######################################################################
# Calculate physical properties
######################################################################
it also does not work.
« Last Edit: April 28, 2009, 12:25 by artingchen »

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
This question highlights an important conceptual point about the way ATK calculated two-probe systems under bias, which I would like to take a second to comment on in more detail. The simplest, and perhaps most common way to compute the I-V curve for a tunneling device is precisely like was attempted above: to first compute the zero-bias transmission, and then just integrate the transmission spectrum over an increasingly broad "bias window" to get the current. This works fine, in some sense, and is called the linear response current. However, it only gives accurate results under one crucial assumption: that the transmission spectrum is not influenced by the bias. In many cases this assumption is valid, in others it is just assumed, without proof (often because there is no simple way to check it). There are however many situations where the transmission spectrum T(E) itself depends strongly on the applied bias. The uniqueness of ATK lies in its ability to compute T(E) self-consistently under an applied finite bias. To do this you must, exactly like serhan shows, include the bias in the actual self-consistent calculation. In this way, the bias will be included in the self-consistent electrostatic potential, and consequently in the electron density and the density matrix, which in turn are used to compute the transmission. Newer versions (later than 2008.02) of ATK actually also include a method to compute the linear response current, which works almost as you tried to do, artingchen. To use this function, you must however first import a module called ATK.Future, and instead of calling calculateCurrent() you use a different function. A rewritten version of your original attempt that utilizes this function would be as below. I have made this is as a standalone analysis task, loading an already converged calculation from the checkpoint file.
Code
from ATK.TwoProbe import *
import numpy
from ATK.Future import calculateLinearResponseCurrent
from ATK.MPI import processIsMaster

scf = restoreSelfConsistentCalculation ('my_calculation.nc')

my_voltages = numpy.linspace(-4.0, 4.0, 100)*Volt
lr_currents = calculateLinearResponseCurrent(
    self_consistent_calculation = scf,
    voltages = my_voltages,
    brillouin_zone_integration_parameters = brillouinZoneIntegrationParameters((1, 1)),
    green_function_infinitesimal = 1.0e-5*electronVolt,
    number_of_points = 100
)

if processIsMaster(): 
    file = VNLFile ('linear_response_current.vnl')
    print 'Bias (V)\tCurrent (A)'
    for i in range(len(my_voltages)):
        print my_voltages[i].inUnitsOf(Volt), '\t', lr_currents[i].inUnitsOf(Ampere)
        file.addToSample(lr_currents[i], 'twoprobe_configuration', 'Current at %g V bias' % my_voltages[i].inUnitsOf(Volt))
Note that all voltages are given at once, instead of looping over them. I have also made use of the very nice NumPy function linspace() instead of arange() which is a tricky function. Oh, and I reduced the number of points between -4 and +4 V from 400 to 100. Note that if you want to (and you do want to!) go by serhan's approach, the best approach is always to start by 0 V bias,. For more details, see the manual page for the function calculateLinearResponseCurrent(). Do note, however, that calculating the current in this way may not give the correct result, if, as mentioned above, the transmission does depend on the bias. And the only way to find out if it does it to compute it... Still, the linear response current can be useful as a first quick test to get an overview. It is however always crucial to also study the details of the transmission spectrum, also at finite bias.

Offline artingchen

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
hello, the transmission spectrum depends on the applied bais, PH.D blom, you say it should use the serhan's approach, but it always does not work. how can I edit the script? I edit the script as follow:
 from ATK.TwoProbe import *
from ATK.MPI import processIsMaster
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/lih2li.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
######################################################################
for voltage in numpy.arange(0.0, 5.01, 0.1) *Volt
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 =(voltage, 0)*Volt,
    algorithm_parameters = two_probe_algorithm_parameters
)
if processIsMaster(): nlPrint(voltage)

# Restore self consistent calculation from check point file
scf = restoreSelfConsistentCalculation(
    filename = 'C:/Users/617/Desktop/lih2li.nc'
)

runtime_parameters = runtimeParameters(
    verbosity_level = 10,
    checkpoint_filename = 'C:/Users/617/Desktop/lih2li1.nc'
)

# Using initial density from self consistent calculation
scf = executeSelfConsistentCalculation(
    twoprobe_configuration,
    two_probe_method,
    initial_calculation = scf,
    runtime_parameters = runtime_parameters
)
######################################################################
# Calculate physical properties
######################################################################
current = calculateCurrent(
    self_consistent_calculation = scf,
    brillouin_zone_integration_parameters = brillouinZoneIntegrationParameters((1, 1)),
    green_function_infinitesimal = 1.0e-5*electronVolt,
    number_of_points = 100
)
if processIsMaster(): nlPrint(current)
if processIsMaster(): file.addToSample(current, 'twoprobe_configuration', 'Current')

when I try to run it, an error comes out.

Offline Nordland

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 812
  • Reputation: 18
    • View Profile
When you make a loop in python, everything that has to happen inside this loop must be indented and the for-loop must end with a colon

Example:
for i in range(5):
    print something
print hello

This script will print something 5 times and hello 1 time. Note the colon at the line for the for-loop.
« Last Edit: April 29, 2009, 10:14 by Nordland »

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Just a general note to everyone: when posting question about a script that gives errors, please also post the error message. Often the problem will be obvious from the error output (for those who are used to interpreting Python's sometimes a bit cryptic messages), and it saves a lot of time not having to run the script yourself.

Offline artingchen

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
I edit the script as follow:
######################################################################
# 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 = 'C:/Users/617/Desktop/lih2li.nc'
)

runtime_parameters = runtimeParameters(
    verbosity_level = 10,
    checkpoint_filename = 'C:/Users/617/Desktop/lih2li1.nc'
)



for voltage in numpy.arange(0.0, 5.01, 0.1):
   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 = (voltage, 0)*Volt,
       algorithm_parameters = two_probe_algorithm_parameters
   )

   if processIsMaster(): nlPrint(voltage)
   
   runtime_parameters = runtimeParameters(
       verbosity_level = 10,
       checkpoint_filename = 'C:/Users/617/Desktop/lih2li1.nc'
   )

# Using initial density from self consistent calculation
scf = executeSelfConsistentCalculation(
    twoprobe_configuration,
    two_probe_method,
    initial_calculation = scf,
    runtime_parameters = runtime_parameters
)

   

######################################################################
# Calculate physical properties
######################################################################
current = calculateCurrent(
    self_consistent_calculation = scf,
    brillouin_zone_integration_parameters = brillouinZoneIntegrationParameters((1, 1)),
    green_function_infinitesimal = 1.0e-5*electronVolt,
    number_of_points = 100
)
if processIsMaster(): nlPrint(current)
if processIsMaster(): file.addToSample(current, 'twoprobe_configuration', 'Current')


when the job run, the results come out as follow:
Electrode Constraint = ElectrodeConstraints.Off
Initial Density Type = InitialDensityType.EquivalentBulk

0.00.10.20.30.40.50.60.70.80.91.01.11.21.31.41.51.61.71.8
1.92.02.12.22.32.42.52.62.72.82.93.03.13.23.33.43.53.63.73.83.94.04.14.24.34.44.54.64.74.84.95.0

and only one current value of 2.84247279605e-006 A
is got. why ? what is the mistake I make.

Offline Forum Administrator

  • Forum Administrator
  • Administrator
  • Heavy QuantumATK user
  • *****
  • Posts: 52
  • Country: dk
  • Reputation: 0
    • View Profile
    • QuantumATK at Synopsys
You have only indented the definition of the two-probe method, not the actual execution of it. You need
Code
for voltage in numpy.arange(0.0, 5.01, 0.1):
   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 = (voltage, 0)*Volt,
       algorithm_parameters = two_probe_algorithm_parameters
   )

   if processIsMaster(): nlPrint(voltage)
   
   runtime_parameters = runtimeParameters(
       verbosity_level = 10,
       checkpoint_filename = 'C:/Users/617/Desktop/lih2li1.nc'
   )

    # Using initial density from self consistent calculation
    scf = executeSelfConsistentCalculation(
        twoprobe_configuration,
        two_probe_method,
        initial_calculation = scf,
        runtime_parameters = runtime_parameters
    )

   

    ######################################################################
    # Calculate physical properties
    ######################################################################
    current = calculateCurrent(
        self_consistent_calculation = scf,
        brillouin_zone_integration_parameters = brillouinZoneIntegrationParameters((1, 1)),
        green_function_infinitesimal = 1.0e-5*electronVolt,
        number_of_points = 100
    )
    if processIsMaster(): nlPrint(current)
    if processIsMaster(): file.addToSample(current, 'twoprobe_configuration', 'Current')


Offline artingchen

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
dear
 I have edited the script followed what you describe ,but when the job run, SyntaxError: invalid syntax (c:/users/617/appdata/local/temp/tmpwdhrmo.nl, line 419) comes out.
my script is edited as follows:


from ATK.TwoProbe import *
from ATK.MPI import processIsMaster
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/lih2li.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
######################################################################
for voltage in numpy.arange(0.0, 5.01, 0.1):
   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 = (voltage, 0)*Volt,
       algorithm_parameters = two_probe_algorithm_parameters
   )

   if processIsMaster(): nlPrint(voltage)
   
   runtime_parameters = runtimeParameters(
       verbosity_level = 10,
       checkpoint_filename = 'C:/Users/617/Desktop/lih2li1.nc'
   )

    # Using initial density from self consistent calculation
    scf = executeSelfConsistentCalculation(
        twoprobe_configuration,
        two_probe_method,
        initial_calculation = scf,
        runtime_parameters = runtime_parameters
    )


######################################################################
# Calculate physical properties
######################################################################
current = calculateCurrent(
    self_consistent_calculation = scf,
    brillouin_zone_integration_parameters = brillouinZoneIntegrationParameters((1, 1)),
    green_function_infinitesimal = 1.0e-5*electronVolt,
    number_of_points = 100
)
if processIsMaster(): nlPrint(current)
if processIsMaster(): file.addToSample(current, 'twoprobe_configuration', 'Current')
where is the error?
« Last Edit: April 29, 2009, 12:46 by artingchen »

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
I don't know where the syntax error comes from, because the script you have post contains 228 lines, so it cannot be the script you actually run, if the error is reported on line 419.

But in the code you posted, there are some mistakes. For some reason, Lithium has been replaced by lithium in a few places, this will not work. And finally, about the indentation, you have not made it like my example above (sorry, posted as admin!), since the last segment is not indented. All lines after "for voltage" should be indented, until the end of the script.

Offline artingchen

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
the last segment is indented and the Lithum has replaced the lithium, but there is also a SyntaxError: invalid syntax (c:/users/617/appdata/local/temp/tmpe7ymcu.nl, line 421)

I am so sorry, I have found the problem and solve it. I delete the follow segment.
 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 = 'C:/Users/617/Desktop/lih2li.nc'
)

runtime_parameters = runtimeParameters(
    verbosity_level = 10,
    checkpoint_filename = 'C:/Users/617/Desktop/lih2li1.nc'
)


so , I should be sorry for that, and I should thanks for your help!
« Last Edit: April 29, 2009, 14:23 by artingchen »