Dear all,
I have problem with applying Neumann conditions to my system: nanotube with gate.
Below I placed two files. First (1), with periodic boundary conditions works,
another (2), with Neumann condition does not. I tried to add Neumann conditions by Script builder, it seems that they are added, but it does not work.
The error message is:
-----------------------------------------------
Traceback (most recent call last):
File "/tmp/9514443501104607.py", line 297, in <module>
electrode_voltages=( 0.1*Volt, 0.0*Volt)
File "./zipdir/NL/Calculators/LCAOCalculator/DeviceLCAOCalculator.py", line 178, in __init__
File "./zipdir/NL/Calculators/LCAOCalculator/DeviceLCAOCalculator.py", line 1576, in checkAndSetElectrodeCalculators
NL.ComputerScienceUtilities.Exceptions.NLValueError: The electrode_calculators poisson solver must have same boundary condition in direction x as the poisson solver of the DeviceCalculator
----------------------------------------------
How can I add those conditions to electrodes? What should I change/add to my script file?
System 1: with periodic conditions (works):
-------------------------------------------------------------------------
# Set up configuration
central_region = BulkConfiguration(
bravais_lattice=central_region_lattice,
elements=central_region_elements,
cartesian_coordinates=central_region_coordinates
)
# Add metallic region
metallic_region_0 = BoxRegion(
1*Volt,
xmin = 0*Angstrom, xmax = 13.9168*Angstrom,
ymin = 0*Angstrom, ymax = 0.5*Angstrom,
zmin = 4.26258*Angstrom, zmax = 12.6253*Angstrom
)
metallic_regions = [metallic_region_0]
central_region.setMetallicRegions(metallic_regions)
# Add dielectric region
dielectric_region_0 = BoxRegion(
4,
xmin = 0*Angstrom, xmax = 13.9168*Angstrom,
ymin = 0.5*Angstrom, ymax = 4.07914*Angstrom,
zmin = 4.26258*Angstrom, zmax = 12.6253*Angstrom
)
dielectric_regions = [dielectric_region_0]
central_region.setDielectricRegions(dielectric_regions)
device_configuration = DeviceConfiguration(
central_region,
[left_electrode, right_electrode]
)
# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
#----------------------------------------
# Basis Set
#----------------------------------------
basis_set = [
GGABasis.Carbon_DoubleZetaPolarized,
]
#----------------------------------------
# Exchange-Correlation
#----------------------------------------
exchange_correlation = GGA.PBE
#----------------------------------------
# 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),
)
device_algorithm_parameters = DeviceAlgorithmParameters(
self_energy_calculator_real=KrylovSelfEnergy(save_self_energies=True, lambda_min=0.1),
)
#----------------------------------------
# Electrode Calculators
#----------------------------------------
left_electrode_calculator = LCAOCalculator(
basis_set=basis_set,
exchange_correlation=exchange_correlation,
numerical_accuracy_parameters=left_electrode_numerical_accuracy_parameters,
)
right_electrode_calculator = LCAOCalculator(
basis_set=basis_set,
exchange_correlation=exchange_correlation,
numerical_accuracy_parameters=right_electrode_numerical_accuracy_parameters,
)
#----------------------------------------
# Device Calculator
#----------------------------------------
calculator = DeviceLCAOCalculator(
basis_set=basis_set,
exchange_correlation=exchange_correlation,
device_algorithm_parameters=device_algorithm_parameters,
electrode_calculators=
[left_electrode_calculator, right_electrode_calculator],
electrode_voltages=( 0.1*Volt, 0.0*Volt)
)
device_configuration.setCalculator(calculator)
nlprint(device_configuration)
device_configuration.update()
nlsave('n5s1.nc', device_configuration)
System 2, with Neumann conditions (does not work):
# -------------------------------------------------------------
# TwoProbe configuration
# -------------------------------------------------------------
(...)
# Set up configuration
central_region = BulkConfiguration(
bravais_lattice=central_region_lattice,
elements=central_region_elements,
cartesian_coordinates=central_region_coordinates
)
# Add metallic region
metallic_region_0 = BoxRegion(
1*Volt,
xmin = 0*Angstrom, xmax = 13.9168*Angstrom,
ymin = 0*Angstrom, ymax = 0.5*Angstrom,
zmin = 4.26258*Angstrom, zmax = 12.6253*Angstrom
)
metallic_regions = [metallic_region_0]
central_region.setMetallicRegions(metallic_regions)
# Add dielectric region
dielectric_region_0 = BoxRegion(
4,
xmin = 0*Angstrom, xmax = 13.9168*Angstrom,
ymin = 0.5*Angstrom, ymax = 4.07914*Angstrom,
zmin = 4.26258*Angstrom, zmax = 12.6253*Angstrom
)
dielectric_regions = [dielectric_region_0]
central_region.setDielectricRegions(dielectric_regions)
device_configuration = DeviceConfiguration(
central_region,
[left_electrode, right_electrode]
)
# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
#----------------------------------------
# Basis Set
#----------------------------------------
basis_set = [
GGABasis.Carbon_DoubleZetaPolarized,
]
#----------------------------------------
# Exchange-Correlation
#----------------------------------------
exchange_correlation = GGA.PBE
#----------------------------------------
# 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),
)
#----------------------------------------
# Poisson Solver Settings
#----------------------------------------
device_poisson_solver = MultigridSolver(
boundary_conditions=[[NeumannBoundaryCondition,NeumannBoundaryCondition],
[NeumannBoundaryCondition,NeumannBoundaryCondition],
[DirichletBoundaryCondition,DirichletBoundaryCondition]]
)
device_algorithm_parameters = DeviceAlgorithmParameters(
self_energy_calculator_real=KrylovSelfEnergy(save_self_energies=True, lambda_min=0.1),
)
#----------------------------------------
# Electrode Calculators
#----------------------------------------
left_electrode_calculator = LCAOCalculator(
basis_set=basis_set,
exchange_correlation=exchange_correlation,
numerical_accuracy_parameters=left_electrode_numerical_accuracy_parameters,
)
right_electrode_calculator = LCAOCalculator(
basis_set=basis_set,
exchange_correlation=exchange_correlation,
numerical_accuracy_parameters=right_electrode_numerical_accuracy_parameters,
)
#----------------------------------------
# Device Calculator
#----------------------------------------
calculator = DeviceLCAOCalculator(
basis_set=basis_set,
exchange_correlation=exchange_correlation,
poisson_solver=device_poisson_solver,
device_algorithm_parameters=device_algorithm_parameters,
electrode_calculators=
[left_electrode_calculator, right_electrode_calculator],
electrode_voltages=( 0.1*Volt, 0.0*Volt)
)
device_configuration.setCalculator(calculator)
nlprint(device_configuration)
device_configuration.update()
nlsave('neumann.nc', device_configuration)