Overview#

The nextnano optimizers Python package is meant for automated optimization of semiconductor devices. Optimization is performed based on results obtained using the nextnano software simulation tools. To use nextnano optimizers, one has to set up classes IO and Metric, see their structure in Figure 2.

IO includes a list of variables, which are varied during optimization, the path to the simulation input file and the definition of the outputs used for optimization. Metric contains a procedure which extracts the data from the simulation output and converts it to a quantity measuring the quality (i.e. proximity to a desired target) of the device with given parameters. The optimizer class coordinates the entire workflow.

../_images/user_guide_optimizers_diagram.png

Figure 2 The scheme of the optimization code: IO defines the simulation input and which outputs are read, Metric turns those output datafiles into the numbers which are minimized (or maximized) by the optimizer. The optimizer class coordinates the entire workflow.#

A minimal optimization problem reads: vary one input variable, read one output datafile, and let an optimizer minimize the value extracted from it. Such an optimization can be implemented as the following short Python script:

import numpy as np

from nextnano_optimizers.io import IO
from nextnano_optimizers.metric import Metric
from nextnano_optimizers.optimizer import Evolution

# 1. which variable to vary, and which output datafile to read
nn_io = IO(
    input_file_path=r"path\to\input_file.nnp",
    variable_names=["QuantumWellWidth"],
    target_output_paths=[("bias_00000", "Quantum", "energy_spectrum.dat")],
)

# 2. what to compute from that datafile -- here the first transition energy
def transition_energy(datafiles):
    energies = datafiles[0].variables["Energy"].value
    return np.array([energies[1] - energies[0]])

nn_metric = Metric(input_length=1, output_length=1, extraction_function=transition_energy)

# 3. minimize it, with the well width searched between 5 nm and 15 nm
evolution = Evolution(nn_io, nn_metric, bounds=([5], [15]))
evolution.run(gen=10)

print(evolution.champion_x, evolution.champion_f)

In general, every script using nextnano optimizers follows this template. The pages below describe each piece in detail.

To learn how to use specific optimization methods, you can read one of the following pages:

The following pages describe the plotting functions, which are used to visualize the optimization progress and results: