# Optimization of a 2DEG structure¶

Attention

The nextnanoevo Python package is under development. Its release is planned for 2024.

## Introduction¶

This tutorial demonstrates the use of nextnanoevo for optimization of a 2DEG design from the tutorial — FREE — Schrödinger-Poisson - A comparison to the tutorial file of Greg Snider’s code.

### Objective¶

The first state (subband) confined in the GaAs quantum well is forming 2-dimensional electron gas (2DEG) formed at one of interfaces due to electric field originated from the Schottky layer. Multiple parameters of the structure are impacting formation of the 2DEG, and one of them is the width of the quantum well containing the 2DEG. Therefore, one can aim at choosing the best width of the quantum well for a given design, to obtain 2DEG with the highest possible occupation of the first state (subband). In this tutorial we show, how to perform such optimization. We show how to maximize occupation of the first electron state by varying the thickness of the GaAs quantum-well layer in the range from 1 nm to 20 nm.

Variables under optimization:

Name

Units

Initial value

Bounds

\$quantum_well_width

nm

15.0

1.0-20.0

Target output:

Name

Units

Initial value

Target

Occupation of the fisrt subband

$$cm^{-2}$$

0.1668

max

### Scipy.optimize.minimize¶

In this example scipy.optimize.minimize algorithm is used. The algorithm searches for the minimum value in the provided variable space. In this tutorial only 1 variable is optimized, but the algorithm supports n-dimensional variable space.

Hint

Every maximization problem can be formulated as minimization by changing the sign of the target value.

## Optimization script¶

At first, specify input file, variables, and relevant output files in the IO instance:

from nextnanoevo.IO import IO
nn_io = IO(input_file_path,
['quantum_well_width'],
[('bias_00000', 'Quantum', 'occupation_quantum_region_Gamma.dat')])


Next, define the metric function to extract the occupation of the first subband in the 2DEG region.

def max_first_state_occupation(df_list):
gamma_first_state_occupation = df_list[0].variables[0].value[0]

# negative sign to use "minimize" method
return -gamma_first_state_occupation

metric = Metric(input_length=1, output_length=1, extraction_function=max_first_state_occupation)


Create the Optimizer, and set the initial value and bounds for the quantum well thickness.

from nextnanoevo.OptimizerClass import Optimizer
optimizer = Optimizer(nextnanoio=nn_io, metric=metric, optimization_method='minimize')

# Setting the scipy.optimize.minimize arguments

result = optimizer.run_optimization()

The optimal quantum well thickness is [8.34375] nm