.. _nnevo_1D_MiDIR_QCL_gain: Optimization of Mid-IR Quantum Cascade Laser Gain ================================================= .. note:: |The_nextnanoevo_package| is under development. .. contents:: :local: :backlinks: none Header --------- Relevant files - :guilabel:`MidIR_QCL_InGaAs_InAlAs_Bai_NaturePhot2010_nextnanoevo.negf` - :guilabel:`MIdIR_QCL_example.py` (not available public yet) Relevant output files: - :guilabel:`330mV/Gain/SemiClassical_vs_Energy_[0.0,0.0,1.0].dat` Scope - design optimization - QCL - NEGF - laser gain Important variables - ``$thickness_scaling_factor`` (scaling factor for all wells and barries in QCL heterostructure) Introduction ------------- This tutorial shows how to optimize the gain of a 1D Mid-IR Quantum Cascade Laser (QCL) using the |The_nextnanoevo_package|. The goal is to maximize the gain of the QCL by varying the thickness of the quantum wells and barriers. The gain is calculated using the |nextnano.NEGF|. Starting point -------------- The starting point is the design of a Mid-IR QCL with a peak gain at photon energy of 275 meV. The design consists of sequence of InGaAs wells and AlInAs barriers with applied 330 mV bias (:ref:`[Bai2010]`.) The bandedges are shown in the figure below .. _fig_nnevo_qcl_bandedges: .. figure:: /images/nnevo_TU_MidIR_QCL_Gain_BandEdges.* :align: center :width: 90% The band edges of the MidIR QCL following :ref:`[Bai2010]` design. The simulated gain with the peak at 275 meV is shown in the figure below .. _fig_gain_start: .. figure:: /images/nnevo_TU_MidIR_QCL_Gain_default.* :align: center :width: 90% The gain of the MidIR QCL following :ref:`[Bai2010]` design. Optimization objective ---------------------- The goal is to maximize the gain of the QCL at 270 meV by varying the thickness of the quantum wells and barriers. All the wells and barriers will be scaled by the same factor. Variables under optimization: .. table:: ============================== ======== ================= =========== Name Units Initial value Bounds ============================== ======== ================= =========== ``$thickness_scaling_factor`` -- 1.0 0.9-1.1 ============================== ======== ================= =========== Target output: .. table:: ======================================= ================= ================= ========= Name Units Initial value Target ======================================= ================= ================= ========= Gain at 270 meV :math:`cm^{-1}` 199.49 max ======================================= ================= ================= ========= Optimization script ------------------- At first, specify input file, variables, and relevant output files in the ``IO`` instance: .. code:: Python from nextnanoevo.IO import IO output_files = [("330mV", "Gain", "SemiClassical_vs_Energy_[0.0,0.0,1.0].dat")] nn_io = IO( input_file_path, variable_names=["thickness_scaling_factor"], target_output_paths=output_files, ) Next, define the metric to get the gain at 270 meV. .. code:: Python def get_gain_at_270mev(df_list): df = df_list[0] energy = df.coords["Photon Energy"].value gain = df.variables["Gain"].value # get gain exactly at 270 meV mask = np.isclose(energy, 270, atol=0.001) gain_at_270mev = gain[mask] # minus sign to transform maximization to minimization return -gain_at_270mev Define the Metric Metric class .. code:: Python from nextnanoevo import Metric metric = Metric(input_length=1, output_length=1, extraction_function=get_gain_at_270mev) Create and run evolution .. code:: Python from nextnanoevo import Evolution evolution = Evolution(nextnanoio=nn_io, metric=metric, bounds=([1.0], [1.1]), size=5) evolution.run(gen=4, algorithm_kwargs={"m": 0.4, "cr": 0.95, "seed": 2023}, seed=12345) And print the final solution and fitness .. code:: Python for index, (sol, fit) in enumerate( zip(evolution.pareto_solutions, evolution.pareto_fits) ): print(f"{index}. Solution {sol}: {fit}") This example is created to showcase how to use nextnanoevo to optimize the devices with |nextnano.NEGF|. To decrease the time of the simulations, the bounds are set to 0.9-1.1, and the number of generations is set to 3. Result of optimization: .. table:: ============================== ==================================== ``$thickness_scaling_factor`` Gain at 270 meV (:math:`cm^{-1}`) ============================== ==================================== 1.0662883 324.4952 ============================== ==================================== The resulting gain in the optimized QCL is shown in the figure below .. _fig_gain_optimized: .. figure:: /images/nnevo_TU_MidIR_QCL_Gain_optimized.* :align: center :width: 90% The gain of the MidIR QCL using optimized design. Conclusion ---------- This tutorial shows how to use the |nextnanoevo| to optimize the gain at the given photon energy of QCL. The optimized sttructure has a peak gain at the target wavelength after 5 generations of optimization.