QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: Jin-Kyu Choi on November 25, 2011, 02:22

Title: There is an error in calculating I-V curves and voltage drops.
Post by: Jin-Kyu Choi on November 25, 2011, 02:22
Hello, I'm Jin-Kyu Choi from Chonnam National University, South Korea.

To calculate I-V curves, I followed the description in the "Minitutorial" from Quantumwise web (http://www.quantumwise.com/publications/tutorials/mini-tutorials/98-i-v-curve-and-voltage-drop).

Because I had a memory deficiency trouble, I modified the self-consistent calculation script as below (I've got an advise about it from the Forum 2 days ago http://quantumwise.com/forum/index.php?topic=1358.0):

nlprint(device_configuration)
for voltage in [0., 0.4, 0.8]*Volt: 
    device_configuration.setCalculator(
        calculator(electrode_voltages=(-0.5*voltage,0.5*voltage)),
        initial_state=device_configuration
    )
    device_configuration.update()
    nlsave("lih2li_iv_scf_bias_%g.nc" % voltage.inUnitsOf(Volt), device_configuration)


After that, I tried to calculate the trasmission spectrum and voltage drop for each case by using the script as in "Calculating the analysis quantities" part from the Tutorial.
Then I've got an error message as follows:

Traceback (most recent call last):
  File "c:\docume~1\wolfnf~1\locals~1\temp\8823705931732971.py", line 32, in <module>
    voltage_drop = potential - zero_bias_potential
NameError: name 'zero_bias_potential' is not defined


Here is the part of input scrip related to the error of 'zero_bias_potential':

    if float(bias)!=0.:
        voltage_drop = potential - zero_bias_potential
        nlsave(analysis_filename, voltage_drop, object_id="Voltage drop %s" % bias)
    else:
        zero_bias_potential = potential


I think it is needed to modify the line about defining the "zero_bias_potential" in the input scrip. Could anybody help me?
Thank you.
Title: Re: There is an error in calculating I-V curves and voltage drops.
Post by: Nordland on November 25, 2011, 09:08
This script is flawed in the sense, that it requires that the zero bias calculation is first in the netcdf file.

What I would recommend to fix it, is something along the lines:
Code
biases = [float(conf.calculator().electrodeVoltages()[1]-conf.calculator().electrodeVoltages()[0]) for conf in configurations ]
This will read all the biases into a list.
Code
configurations = [configurations[i] for i in numpy.argsort(biases)]
This will resort the configurations according the biases and the rest of the script should work.

Add these two lines just below the nlread
Code
# Read all configurations from NetCDF file
configurations = nlread(scf_filename, DeviceConfiguration)
biases = [float(conf.calculator().electrodeVoltages()[1]-conf.calculator().electrodeVoltages()[0]) for conf in configurations ]
configurations = [configurations[i] for i in numpy.argsort(biases)]

I hope this works - I haven't tried it yet, but it should work :)
Title: Re: There is an error in calculating I-V curves and voltage drops.
Post by: Anders Blom on November 25, 2011, 14:06
Thanks, Nordland - I have modified the online tutorial to include your improvement.