Hello, I am Ying-fei Chang from Northeast Normal University, P. R. China.
I had some trouble with the calculation of the trasmission spectrum and voltage drop, the error information is:
Traceback (most recent call last):
File "c:\users\changyf\appdata\local\temp\9960269774839752.py", line 34, in <module>
voltage_drop = potential - zero_bias_potential
NameError: name 'zero_bias_potential' is not defined
NanoLanguageScript execution failure.
I read the topic about
http://quantumwise.com/forum/index.php?topic=1363.0, and added
biases = [float(conf.calculator().electrodeVoltages()[1]-conf.calculator().electrodeVoltages()[0]) for conf in configurations]
configurations = [configurations
for i in numpy.argsort(biases)]
in my script, but it do not work yet.
I think the defining of "zero_bias_potential" in the input scripis is needed to be modified. Since the first calculated in not for 0V, the program can not get the "zero_bias_potential", so it failured.
If I save the IV_SCF configurations in separate files by using the Script like
nlsave("1FS_1_IV_SCF_%g.nc" % voltage.inUnitsOf(Volt), device_configuration)
from the Tutorial, and add the following line in front of the analysis file
for voltage in [0.,0.5,1.,1.5,2.,2.5,3.,3.5,4.,4.5,5.]*Volt:
scf_filename = ('1FS_1_IV_SCF_%g.nc' % voltage)
analysis_filename = "1FS_1_IV_analysis.nc"
It can work, but the result is not correct, because the current from -5V to 4V is almost 0.
I think the bias maybe incorrect.
So, I hope someone to tell me how to calculate the trasmission spectrum and voltage drop form one IV_SCF file or in separate files.
The following it my modefied script.
for voltage in [0.,0.5,1.,1.5,2.,2.5,3.,3.5,4.,4.5,5.]*Volt:
scf_filename = ('1FS_1_IV_SCF_%g.nc' % voltage)
analysis_filename = "1FS_1_IV_analysis.nc"
# 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 for i in numpy.argsort(biases)]
for configuration in configurations:
# For each one, extract the bias,
calculator = configuration.calculator()
bias = calculator.electrodeVoltages()[1]-calculator.electrodeVoltages()[0]
# ... calculate and save the transmission spectrum,
transmission_spectrum = TransmissionSpectrum(
configuration=configuration,
energies=numpy.linspace(-4,4,100)*eV,
kpoints=MonkhorstPackGrid(1,1,1)
)
nlsave(analysis_filename, transmission_spectrum, object_id="Transmission %s" % bias)
# Uncomment the line below if you want all transmission spectra in the log file
#nlprint(transmission_spectrum)
potential = EffectivePotential(configuration)
# Uncomment the line below if you want to save all potentials, and not just the voltage drops
#nlsave(analysis_filename, potential, object_id="Potential %s" % bias)
# Calculate and save the voltage drop (except for zero bias, of course)
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
# Copy geometry to analysis file, for plotting
zero_bias_calculation = nlread(scf_filename, DeviceConfiguration, read_state = False)[0]
nlsave(analysis_filename, zero_bias_calculation)