6
« on: June 23, 2014, 08:55 »
# Read in the old configuration
device_configuration = nlread("nanodevice_huckel.nc",DeviceConfiguration)[0]
calculator = device_configuration.calculator()
metallic_regions = device_configuration.metallicRegions()
# Define gate_voltages
gate_voltage_list=[1.0, 2.0, 3.0, 4.0, 5.0]*Volt
# Define output file name
filename= "nanodevice_huckel.nc"
# Perform loop over gate voltages
for gate_voltage in gate_voltage_list:
# Set the gate voltages to the new values
new_regions = [m(value = gate_voltage) for m in metallic_regions]
device_configuration.setMetallicRegions(new_regions)
# Make a copy of the calculator and attach it to the configuration
# Restart from the previous scf state
device_configuration.setCalculator(calculator(),
initial_state=device_configuration)
device_configuration.update()
nlsave(filename, device_configuration)
# Calculate analysis objects
electron_density = ElectronDifferenceDensity(device_configuration)
nlsave(filename, electron_density)
electrostatic_potential = ElectrostaticDifferencePotential(device_configuration)
nlsave(filename, electrostatic_potential)
transmission_spectrum = TransmissionSpectrum(
configuration=device_configuration,
energies=numpy.linspace(-3,3,101)*eV,
self_energy_calculator=DirectSelfEnergy(),
)
nlsave(filename, transmission_spectrum)
nlprint(transmission_spectrum)