I read on forum that to calculate the difference in the potentials of 2 atoms we can use the following code:
pot = nlread("file.nc", ElectrostaticDifferencePotential)[0]
p1 = pot.evaluate(0.*Ang,0*Ang,0*Ang)
p2 = pot.evaluate(0.*Ang,0*Ang,1*Ang)
print p2-p1
But, this gives the value in Hartree. How to get this in Volts?
Second: To get Voltage Drop(V) vs. Z(Ang) plot, why is it necessary that we should have both zero-bias and finite-bias calculations? Cant we plot it just with a finite bias calculation?
In the forum ( http://quantumwise.com/forum/index.php?topic=21.0 (http://quantumwise.com/forum/index.php?topic=21.0) ) , Dr. Norland has posted following script to plot voltage drop(V) vs. device_length(z). But, it seems its for older version. When I run the script I get errors with many functions used in the script not defined.
zero_bias_filename = 'lih2li_00.nc'
finiate_bias_filename = 'lih2li_01.nc'
vnl_filename = 'voltage_drop.vnl'
""" ------------ No need to modify anything below this point --------------------- """
# Implementation of the voltage drop.
from ATK.TwoProbe import *; import numpy
# Zero bias calculation.
zero_bias = restoreSelfConsistentCalculation(zero_bias_filename)
# Finite bias calculation.
finite_bias = restoreSelfConsistentCalculation(finiate_bias_filename)
# Calculate the voltage drop.
voltage_drop = calculateEffectivePotential(finite_bias) - calculateEffectivePotential(zero_bias)
# Store the results in a VNL file.
file = VNLFile(vnl_filename)
file.addToSample(voltage_drop,'Voltage Drop','Voltage Drop')
# Get the raw number of the potential, and print the average potential to the screen.
raw_data = voltage_drop.toArray()
z_axis_length = voltage_drop._cell().c().z()
print '### Voltage drop ###'
print '# z(bohr) V(Ry)'
# Loop over all the data and calculate the average in the xy-plane.
for i in range(raw_data.shape[2]):
print i*z_axis_length/float(raw_data.shape[2]), numpy.average(raw_data[:,:,i])
#######################
Kindly let me know the changes to be made in the script to make it run for the recent ATK version.
In the voltage_drop.py I get an error in the following line:
voltage_drop = potential[1]-potential[0]
Error: List Index out of range.
What does this potential[1] and potential[0] functions extract?