ok let me piece this together ..
To do this simulation i start here:
gate_voltage_list = numpy.linspace(0.0, 1.5,16)*Volt
bias_voltage_list = [0.8]*Volt
doTransmission()
do transmission looks like this:
def doTransmission():
global logs
global nc_files
global plots
global dopingLvl
global dopingOn
global dopingType
global rowSelect
global colSelect
global dopeL
global dopeC
global dopeR
global rip
global outFileName
global outFileName2
global gate_voltage_list
global bias_voltage_list
global N_vals
global lengthVals
global transSpecEnergies
global kPntsX
global kPntsY
global kPntsZ
global ldos_energies
global iteration_control_parameters
global numerical_accuracy_parameters
global pps
global bafl
global SCF
global ldosBiasVoltage
global ldosGateVoltage
global vac
global doubleGate
global gateOverlap
global dist_1
global dist_2
global dist_3
global simType
global host
global length
global dopeType
global validDopingCfgs
# http://www.quantumwise.com/documents/tutorials/latest/GrapheneDevice/index.html/chap.further.html#chap.further.sect1.both
nlprint(str(gate_voltage_list));
nlprint(str(bias_voltage_list));
#read in the old configuration
device_configuration = nlread(nc_files + outFileName, object_id="cfg")[0]
calculator = my_DeviceHuckelCalculator()
metallic_region0 = device_configuration.metallicRegions()[0]
metallic_region1 = None
if doubleGate:
metallic_region1 = device_configuration.metallicRegions()[1]
device_configuration.setCalculator(calculator)
device_configuration.update()
# Define gate_voltages
for bias in bias_voltage_list:
for gate_voltage in gate_voltage_list:
if doubleGate:
device_configuration.setMetallicRegions([metallic_region0(value = gate_voltage), metallic_region1(value = gate_voltage)] )
else:
device_configuration.setMetallicRegions([metallic_region0(value = gate_voltage)] )
# Set calculator with applied bias on the configuration
# use the old selfconsistent state as starting input.
device_configuration.setCalculator(
calculator(electrode_voltages=(bias,0.0*Volt)),
initial_state=device_configuration)
gate_voltage_str = str(gate_voltage)
gate_voltage_str = gate_voltage_str.replace("_", "")
gate_voltage_str = gate_voltage_str.replace(" ", "")
bias_str = str(bias)
bias_str = bias_str.replace("_", "")
bias_str = bias_str.replace(" ", "")
voltageStr = "[vg" + gate_voltage_str + "][vds" + bias_str + "]"
#Analysis
#electron_density = ElectronDifferenceDensity(device_configuration)
#nlsave(nc_files + outFileName2, electron_density,object_id='dens'+voltageStr)
#electrostatic_potential = ElectrostaticDifferencePotential(device_configuration)
#nlsave(nc_files + outFileName2, electrostatic_potential, object_id='pot'+voltageStr)
# -------------------------------------------------------------
# Transmission spectrum
# -------------------------------------------------------------
transmission_spectrum = TransmissionSpectrum(
configuration = device_configuration,
energies = transSpecEnergies,
kpoints = MonkhorstPackGrid(1,1),
energy_zero_parameter = AverageFermiLevel,
infinitesimal = 1e-06*eV,
self_energy_calculator = KrylovSelfEnergy(),
)
nlsave(nc_files + outFileName2, transmission_spectrum,object_id='trans'+voltageStr)
now = date.today()
nlprint("doTransmission " + voltageStr + " " + str(now.strftime("%m-%d-%y %I:%M %p")))
the plotting function looks like this:
gate_voltage_list = numpy.linspace(0.0, 1.5,16)*Volt
bias_voltage_list = [0.8]*Volt
makeIVPlot_vsVgs()
and
def makeIVPlot_vsVgs():
global logs
global nc_files
global plots
global dopingLvl
global dopingOn
global dopingType
global rowSelect
global colSelect
global dopeL
global dopeC
global dopeR
global rip
global outFileName
global outFileName2
global gate_voltage_list
global bias_voltage_list
global N_vals
global lengthVals
global transSpecEnergies
global kPntsX
global kPntsY
global kPntsZ
global ldos_energies
global iteration_control_parameters
global numerical_accuracy_parameters
global pps
global bafl
global SCF
global ldosBiasVoltage
global ldosGateVoltage
global vac
global doubleGate
global gateOverlap
global dist_1
global dist_2
global dist_3
global simType
global host
global length
global dopeType
global validDopingCfgs
#make list of relevant temperatures
temperature=300*Kelvin
#make list to hold the current calculations
current_list = numpy.zeros( (len(bias_voltage_list), len(gate_voltage_list)) )
print str(current_list)
#plot the current as function of gatevoltage
import pylab
pylab.figure()
for m in range(len(bias_voltage_list)):
bias = bias_voltage_list[m]
for n in range(len(gate_voltage_list)):
gate_voltage = gate_voltage_list[n]
gate_voltage_str = str(gate_voltage)
gate_voltage_str = gate_voltage_str.replace("_", "")
gate_voltage_str = gate_voltage_str.replace(" ", "")
bias_str = str(bias)
bias_str = bias_str.replace("_", "")
bias_str = bias_str.replace(" ", "")
voltageStr = "[vg" + gate_voltage_str + "][vds" + bias_str + "]"
if processIsMaster():
print voltageStr
transmission_spectrum = nlread(nc_files + outFileName2, object_id="trans"+voltageStr)[0]
(current_list[m])[n] = transmission_spectrum.current(electrode_temperatures=(temperature,temperature))
#print "vg(" + str(gate_voltage) + ")", current_list[n]
# for each gate voltage plot the IV curve versus bias voltage
pylab.plot(gate_voltage_list,current_list[m],label="vds(" + str(bias) + ")")
print str(current_list)
pylab.xlabel("Vgs (V)")
pylab.ylabel("Current (A)")
pylab.legend(loc="lower right")
pylab.grid(True)
pylab.savefig(plots + outFileName2 + "IVplot2.png",dpi=150)
#pylab.show()
It is confusing, so let's simplify :)
First of all, you have to compare the same things. The IV tool only plots current against bias, it doesn't know anything about gate voltage. So if all those points are in the same file, it can probably get confused.
Moreover, you are looking at I against Vg for fixed , and comparing a curve of I against Vs (your two attached plots), so we really can't expect these to be equal.
I still think your jumpy curves from the fact that you have the right values of I, but they come in the wrong order. I can't see, in the Python, however, how that is possible, as you also say.
So, sure, we can ignore the IV tool and focus on getting your plot correct. I'm still stumped there, however... Is the NC file huge? Maybe you can http://letscrate.com it to me.
The point about the wrong plot I made was caused by the comment on one of the last lines in makeIVPlot_vsVgs which says "# for each gate voltage plot the IV curve versus bias voltage" - probably just a copy/pasted comment you forgot to change.
Btw, you can do
bias_str = str(bias).replace("_", "").replace(" ", "")
Saves lines ;)