as follow:
###############################################################
# NL Module imports
###############################################################
from NanoLanguage import *
###############################################################
# TwoProbe configuration
###############################################################
###############################################################
# Left electrode
###############################################################
# Set up lattice
vector_a = [5.76751646075, -4.50174304348e-33, 0.0]*Angstrom
vector_b = [-2.88375823037, 4.99481577175, 2.72677173011e-16]*Angstrom
vector_c = [-9.86076131526e-32, -3.85623756222e-16, 7.06373620597]*Angstrom
left_electrode_lattice = UnitCell(vector_a, vector_b, vector_c)
# Define elements
left_electrode_elements = [Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold,
Gold, Gold]
# Define coordinates
left_electrode_coordinates = [[ 2.24397869, 2.13528941, 1.17728937],
[ 3.68585781, 2.9677587 , 3.5318681 ],
[ 2.24397869, 3.800228 , 5.88644684],
[ 0.80209958, 4.63269729, 1.17728937],
[ 5.12773692, 0.47035082, 3.5318681 ],
[ 3.68585781, 1.30282011, 5.88644684],
[-0.63977954, 2.13528941, 1.17728937],
[ 0.80209958, 2.9677587 , 3.5318681 ],
[-0.63977954, 3.800228 , 5.88644684],
[-2.08165865, 4.63269729, 1.17728937],
[ 2.24397869, 0.47035082, 3.5318681 ],
[ 0.80209958, 1.30282011, 5.88644684]]*Angstrom
# Set up configuration
left_electrode = BulkConfiguration(
bravais_lattice=left_electrode_lattice,
elements=left_electrode_elements,
cartesian_coordinates=left_electrode_coordinates
)
###############################################################
# Right electrode
###############################################################
# Set up lattice
vector_a = [5.76751646075, -4.50174304348e-33, 0.0]*Angstrom
vector_b = [-2.88375823037, 4.99481577175, 2.72677173011e-16]*Angstrom
vector_c = [-9.86076131526e-32, -3.85623756222e-16, 7.06373620597]*Angstrom
right_electrode_lattice = UnitCell(vector_a, vector_b, vector_c)
# Define elements
right_electrode_elements = [Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold,
Gold, Gold]
# Define coordinates
right_electrode_coordinates = [[ 3.52353777, 1.19458777, 1.17728937],
[-0.80209958, 2.02705707, 3.5318681 ],
[ 3.52353777, 2.85952636, 5.88644684],
[ 2.08165865, 3.69199566, 1.17728937],
[-2.24397869, 4.52446495, 3.5318681 ],
[ 4.96541688, 0.36211848, 5.88644684],
[ 0.63977954, 1.19458777, 1.17728937],
[ 2.08165865, 2.02705707, 3.5318681 ],
[ 0.63977954, 2.85952636, 5.88644684],
[-0.80209958, 3.69199566, 1.17728937],
[ 0.63977954, 4.52446495, 3.5318681 ],
[ 2.08165865, 0.36211848, 5.88644684]]*Angstrom
# Set up configuration
right_electrode = BulkConfiguration(
bravais_lattice=right_electrode_lattice,
elements=right_electrode_elements,
cartesian_coordinates=right_electrode_coordinates
)
###############################################################
# Central region
###############################################################
# Set up lattice
vector_a = [5.76751646075, -4.50174304348e-33, 0.0]*Angstrom
vector_b = [-2.88375823037, 4.99481577175, 2.72677173011e-16]*Angstrom
vector_c = [0.0, 0.0, 23.6730584282]*Angstrom
central_region_lattice = UnitCell(vector_a, vector_b, vector_c)
# Define elements
central_region_elements = [Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold,
Gold, Gold, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon,
Sulfur, Sulfur, Hydrogen, Hydrogen, Hydrogen, Hydrogen, Hydrogen,
Hydrogen, Hydrogen, Hydrogen, Hydrogen, Hydrogen, Hydrogen,
Hydrogen, Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold, Gold,
Gold, Gold, Gold]
# Define coordinates
central_region_coordinates = [[ 2.24397869, 2.13528941, 1.17728937],
[ 3.68585781, 2.9677587 , 3.5318681 ],
[ 2.24397869, 3.800228 , 5.88644684],
[ 0.80209958, 4.63269729, 1.17728937],
[ 5.12773692, 0.47035082, 3.5318681 ],
[ 3.68585781, 1.30282011, 5.88644684],
[ -0.63977954, 2.13528941, 1.17728937],
[ 0.80209958, 2.9677587 , 3.5318681 ],
[ -0.63977954, 3.800228 , 5.88644684],
[ -2.08165865, 4.63269729, 1.17728937],
[ 2.24397869, 0.47035082, 3.5318681 ],
[ 0.80209958, 1.30282011, 5.88644684],
[ 0.63977954, 4.52446495, 14.22404472],
[ 2.24397869, 0.47035082, 9.44901371],
[ 1.18002575, 3.15916078, 12.12452871],
[ 1.70373248, 1.83565499, 11.54852972],
[ 1.71925849, 1.79641782, 10.01331992],
[ 1.16449974, 3.19839795, 13.65973851],
[ 2.24397869, 0.47035082, 7.78644684],
[ 0.63977954, 4.52446495, 15.88661159],
[ -0.39473083, 4.71829786, 13.88812535],
[ 4.14531548, 0.37886964, 13.88812535],
[ 3.27848906, 0.27651792, 9.78493308],
[ -1.26155725, 4.61594613, 9.78493308],
[ 2.18858957, 3.01378545, 14.03879739],
[ 0.54401201, 2.36303172, 14.03879739],
[ 2.33974622, 2.63178406, 9.63426104],
[ 0.69516866, 1.98103032, 9.63426104],
[ 0.15514836, 3.34416821, 11.74432312],
[ 1.80081756, 3.99535391, 11.74432312],
[ 2.72860987, 1.65064756, 11.9287353 ],
[ 1.08294067, 0.99946187, 11.9287353 ],
[ 3.52353777, 1.19458777, 17.78661159],
[ -0.80209958, 2.02705707, 20.14119033],
[ 3.52353777, 2.85952636, 22.49576906],
[ 2.08165865, 3.69199566, 17.78661159],
[ -2.24397869, 4.52446495, 20.14119033],
[ 4.96541688, 0.36211848, 22.49576906],
[ 0.63977954, 1.19458777, 17.78661159],
[ 2.08165865, 2.02705707, 20.14119033],
[ 0.63977954, 2.85952636, 22.49576906],
[ -0.80209958, 3.69199566, 17.78661159],
[ 0.63977954, 4.52446495, 20.14119033],
[ 2.08165865, 0.36211848, 22.49576906]]*Angstrom
# Set up configuration
central_region = BulkConfiguration(
bravais_lattice=central_region_lattice,
elements=central_region_elements,
cartesian_coordinates=central_region_coordinates
)
device_configuration = DeviceConfiguration(
central_region,
[left_electrode, right_electrode]
)
nlprint(device_configuration)
###############################################################
# Calculator
###############################################################
#----------------------------------------
# Numerical Accuracy Settings
#----------------------------------------
left_electrode_numerical_accuracy_parameters = NumericalAccuracyParameters(
k_point_sampling=(1, 1, 100),
)
right_electrode_numerical_accuracy_parameters = NumericalAccuracyParameters(
k_point_sampling=(1, 1, 100),
)
#----------------------------------------
# Contour Integral Settings
#----------------------------------------
double_contour_integral_parameters = DoubleContourIntegralParameters(
circle_points=50,
)
#----------------------------------------
# Electrode Calculators
#----------------------------------------
left_electrode_calculator = HuckelCalculator(
numerical_accuracy_parameters=left_electrode_numerical_accuracy_parameters,
)
right_electrode_calculator = HuckelCalculator(
numerical_accuracy_parameters=right_electrode_numerical_accuracy_parameters,
)
#----------------------------------------
# Device Calculator
#----------------------------------------
calculator = DeviceHuckelCalculator(
contour_parameters=double_contour_integral_parameters,
electrode_calculators=
[left_electrode_calculator, right_electrode_calculator],
electrode_voltages=( -0.5*Volt, 0.5*Volt)
)
device_configuration.setCalculator(calculator)
###############################################################
# Analysis
###############################################################
device_configuration.update()
nlsave('1.nc', device_configuration)
transmission_spectrum = TransmissionSpectrum(
configuration=device_configuration,
energies=numpy.linspace(-5,5,200)*eV,
kpoints=MonkhorstPackGrid(1,1,1),
energy_zero_parameter=AverageFermiLevel,
infinitesimal=1e-06*eV,
self_energy_calculator=KrylovSelfEnergy(),
)
nlsave('1.nc', transmission_spectrum)
nlprint(transmission_spectrum)
from NanoLanguage import *
#read in the old configuration
device_configuration = nlread("1.nc",DeviceConfiguration)[0]
calculator = device_configuration.calculator()
# Define sample biases
voltage_list = numpy.linspace(0.1,1.0,10)
for voltage in voltage_list:
# Set the calculator and use the old scf state as starting input.
device_configuration.setCalculator(
calculator(electrode_voltages=(-0.5*voltage,0.5*voltage)*Volt ),
initial_state=device_configuration
)
#Analysis
filename = '1.nc'
electrostatic_potential = ElectrostaticDifferencePotential(device_configuration)
nlsave(filename, electrostatic_potential, object_id='pot'+str(voltage))
transmission_spectrum = TransmissionSpectrum(
configuration=device_configuration,
energies=numpy.linspace(-5,5,200)*eV,
)
nlsave(filename, transmission_spectrum,object_id='trans'+str(voltage))
molecular_energy_spectrum = MolecularEnergySpectrum(
configuration=device_configuration,
energy_zero_parameter=FermiLevel,
projection_list=ProjectionList([Hydrogen])
)
nlsave(filename, molecular_energy_spectrum,object_id='mpsh'+str(voltage) )
------------------------------------------------------------------------
However, I found some error, how do i deal with ?
--------------------------------------------------------------------------
NanoLanguageScript execution started
+ -------------------------------------------------------------
File "c:\docume~1\yazyq\locals~1\temp\9707668693419072.py", in line
device_configuration.setCalculator(
^
IndentationError: expected an indented block
NanoLanguageScript execution failure
+ -------------------------------------------------------------
| NanoLanguageScript execution finished
+ -------------------------------------------------------------