Author Topic: neumann condiotion in gated device  (Read 3241 times)

0 Members and 1 Guest are viewing this topic.

Offline karolcia

  • New QuantumATK user
  • *
  • Posts: 3
  • Country: de
  • Reputation: 0
    • View Profile
neumann condiotion in gated device
« on: June 17, 2014, 16:21 »
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)



Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: neumann condiotion in gated device
« Reply #1 on: June 18, 2014, 06:01 »
While system 1 might work (technically), the results will be wrong since you need the Multigrid condition if you have gates like that. What you need to do is add similar Poisson solver statements to the electrode calculators. Normally the Script Generator will do this for you, which version of ATK are you using? Anyway it's quite simple, just define
Code: python
poisson_solver = MultigridSolver(
    boundary_conditions=[[NeumannBoundaryCondition,NeumannBoundaryCondition],
                         [NeumannBoundaryCondition,NeumannBoundaryCondition],
                         [PeriodicBoundaryCondition,PeriodicBoundaryCondition]]
    )
and add this with the keyword "poisson_solver" to the right_electrode_calculator and left too.

Offline karolcia

  • New QuantumATK user
  • *
  • Posts: 3
  • Country: de
  • Reputation: 0
    • View Profile
Re: neumann condiotion in gated device
« Reply #2 on: June 18, 2014, 12:17 »
My trying to use version 12.2 (I know is little old)

The Script Generator only put device_poisson_solver into script, but the last pair of condition was not Periodic, but Dirichlet.

Therefore I tried to just copy from your post poisson_solver, but it did not work.
So I tried like this:

#----------------------------------------
# Poisson Solver Settings
#----------------------------------------
device_poisson_solver = MultigridSolver(
    boundary_conditions=[[NeumannBoundaryCondition,NeumannBoundaryCondition],
                                         [NeumannBoundaryCondition,NeumannBoundaryCondition],
                                         [PeriodicBoundaryCondition,PeriodicBoundaryCondition]]
    )

left_electrode_poisson_solver = MultigridSolver(
    boundary_conditions=[[NeumannBoundaryCondition,NeumannBoundaryCondition],
                         [NeumannBoundaryCondition,NeumannBoundaryCondition],
                         [PeriodicBoundaryCondition,PeriodicBoundaryCondition]]
    )

right_electrode_poisson_solver = MultigridSolver(
    boundary_conditions=[[NeumannBoundaryCondition,NeumannBoundaryCondition],
                         [NeumannBoundaryCondition,NeumannBoundaryCondition],
                         [PeriodicBoundaryCondition,PeriodicBoundaryCondition]]
   )

#----------------------------------------
# Electrode Calculators
#----------------------------------------
left_electrode_calculator = LCAOCalculator(
    basis_set=basis_set,
    poisson_solver=left_electrode_poisson_solver,
    exchange_correlation=exchange_correlation,
    numerical_accuracy_parameters=left_electrode_numerical_accuracy_parameters,
    )

right_electrode_calculator = LCAOCalculator(
    basis_set=basis_set,
    poisson_solver=right_electrode_poisson_solver,
    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,
    electrode_calculators=
        [left_electrode_calculator, right_electrode_calculator],
    electrode_voltages=( 0.5*Volt, 0.0*Volt)
    )

device_configuration.setCalculator(calculator)
nlprint(device_configuration)
device_configuration.update()
nlsave('n5s1.nc', device_configuration)

And I got another error message:
--------------------------------------------
Traceback (most recent call last):
  File "/tmp/9241002929559588.py", line 311, in <module>
    electrode_voltages=( 0.5*Volt, 0.0*Volt)
  File "./zipdir/NL/Calculators/LCAOCalculator/DeviceLCAOCalculator.py", line 168, in __init__
  File "./zipdir/NL/Calculators/LCAOCalculator/DeviceLCAOCalculator.py", line 1494, in setAndCheckPoissonSolver
NL.ComputerScienceUtilities.Exceptions.NLValueError:  The parameter, poisson_solver, must have DirichletBoundaryCondition in direction of the z-axis (2,0)
----------------------------------------------

How should I change my script?
Probably this is sth really simple, but I do not know...

Offline karolcia

  • New QuantumATK user
  • *
  • Posts: 3
  • Country: de
  • Reputation: 0
    • View Profile
Re: neumann condiotion in gated device
« Reply #3 on: June 18, 2014, 13:55 »
I have just tried to change only for device the conditions like that:
----------------------
device_poisson_solver = MultigridSolver(
    boundary_conditions=[[NeumannBoundaryCondition,NeumannBoundaryCondition],
                         [NeumannBoundaryCondition,NeumannBoundaryCondition],
                         [DirichletBoundaryCondition,DirichletBoundaryCondition]]
    )
-----------------------------------------------
and it seems it works.