### Install on Linux with setup.py Source: https://erwinjr2.readthedocs.io/en/stable/manual/install.html Install the software from the code directory on Linux. Add --user to install in the user directory if you lack full system control. ```bash python setup.py install ``` -------------------------------- ### Install ErwinJr2 with pip and run it Source: https://erwinjr2.readthedocs.io/en/stable/_sources/manual/install.rst.txt Install ErwinJr2 with pip, then start it with the ErwinJr command or create a desktop shortcut with ErwinJr-genshortcut. Requires Python and pip. If the compiled library is not available, you may see 'C library is not compiled. Features are limited.' when starting from the command line. ```bash python -m pip install pip --upgrade ``` ```bash python -m pip install ErwinJr2 ``` ```bash ErwinJr ``` ```bash ErwinJr-genshortcut ``` -------------------------------- ### Install setuptools, wheel, and PyQt5 Source: https://erwinjr2.readthedocs.io/en/stable/manual/install.html Upgrade setuptools and wheel, then install PyQt5 for GUI support. Required for development or if not on a remote server. ```bash python -m pip install setuptools, wheel --upgrade ``` ```bash python -m pip install pyqt5 ``` -------------------------------- ### Install ErwinJr2 on Linux with setup.py Source: https://erwinjr2.readthedocs.io/en/stable/_sources/manual/install.rst.txt Install ErwinJr2 on Linux from the source directory. Add --user at the end to install in the user directory if you don't have full control of the system. ```bash python setup.py install ``` -------------------------------- ### Prepare environment with setuptools and PyQt5 Source: https://erwinjr2.readthedocs.io/en/stable/_sources/manual/install.rst.txt Prepare the environment for building ErwinJr2 from source: upgrade setuptools and wheel, and optionally install PyQt5 for GUI support. The software uses setuptools for installation. ```bash python -m pip install setuptools, wheel --upgrade ``` ```bash python -m pip install pyqt5 ``` -------------------------------- ### Set MSBUILD and install on Windows Source: https://erwinjr2.readthedocs.io/en/stable/_sources/manual/install.rst.txt On Windows, set the MSBUILD environment variable to the Visual Studio MSBuild.exe path, then run python setup.py install to compile with Visual Studio. The path depends on your Visual Studio installation. ```bash set MSBUILD=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe ``` ```bash python setup.py install ``` -------------------------------- ### PQLiu.json sample data file Source: https://erwinjr2.readthedocs.io/en/stable/Profiling.html Sample ErwinJr2 data file used in the profiling example. Contains QCLayers and Waveguide definitions with material properties, doping, and custom active core settings. ```json { "FileType": "ErwinJr2 Data File", "Version": "210330", "Description": "dx.doi.org/10.1038/nphoton.2009.262", "QCLayers": { "Wavelength": 4.7, "Substrate": "InP", "EField": 102.0, "x resolution": 1.0, "E resolution": 0.5, "No of states": 20, "Solver": "ODE", "Temperature": 300.0, "Repeats": 4, "MaterialDefs": { "Compostion": ["InGaAs", "AlInAs"], "Mole Fraction": [0.66, 0.31] }, "Material": [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], "Width": [23.0, 28.0, 26.0, 22.0, 21.0, 18.0, 18.0, 15.0, 13.0, 12.0, 10.0, 42.0, 12.0, 39.0, 14.0, 33.0], "Doping": [0.0, 0.0, 1.5, 1.5, 1.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], "Active Region": [false, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true], "IFR": false }, "Waveguide": { "wavelength": 4.7, "materials": ["Air", "Au", "SiNx", "InxGa1-xAs", "InxGa1-xAs", "Al1-xInxAs", "Al1-xInxAs", "InxGa1-xAs", "Active Core", "InxGa1-xAs", "InP"], "moleFracs": [0.0, 0.0, 0.35, 0.53, 0.53, 0.52, 0.52, 0.53, 0.53, 0.53, 0.0], "dopings": [0.0, 0.0, 0.0, 1200.0, 90.0, 2.0, 3.0, 0.5, 0.5, 0.5, 0.0], "width": [1.0, 0.45, 0.4, 0.01, 0.5, 0.5, 0.6, 0.2, 1.384, 0.2, 2.0], "mobilities": [null, null, null, null, null, null, null, null, null, null, null], "custom": {"Active Core": {"index": "(3.286+0j)", "period": [346.0, 40], "gain": 53.4}} } } ``` -------------------------------- ### Run ErwinJr2 and create shortcut Source: https://erwinjr2.readthedocs.io/en/stable/manual/install.html Start the software with the ErwinJr command, or create a desktop shortcut with ErwinJr-genshortcut. ```bash ErwinJr ``` ```bash ErwinJr-genshortcut ``` -------------------------------- ### Build C library and run without installation Source: https://erwinjr2.readthedocs.io/en/stable/manual/install.html Build the C library manually with make and make MP, then run the software without installation by setting PYTHONPATH to the code directory. ```bash cd [PATH_TO_THE_CODE]/ErwinJr2/OneDQuantum make make MP ``` ```bash cd [PATH_TO_THE_CODE] PYTHONPATH=[PATH_TO_THE_CODE] python ErwinJr2 ``` -------------------------------- ### Construct and plot QCLayers with QCPlotter Source: https://erwinjr2.readthedocs.io/en/stable/_sources/QCPlotter.rst.txt Example of loading a QCLayers instance from a JSON file, solving for eigen states, and plotting potential and wave function. Make sure the sample JSON file (referenced as PQLiu.json) is available and run with the appropriate working directory. ```python from ErwinJr2 import SaveLoad from ErwinJr2.QCPlotter import plotPotential, plotWF import matplotlib.pyplot as plt with open("../ErwinJr2/example/PQLiu.json", 'r') as f: qcl = SaveLoad.qclLoad(f) qcl.populate_x() qcl.solve_whole() plotPotential(qcl) plotWF(qcl) plt.xlabel('Position (Å)') plt.ylabel('Energy (eV)') plt.show() ``` -------------------------------- ### Run ErwinJr2 with python -m ErwinJr2 Source: https://erwinjr2.readthedocs.io/en/stable/_sources/manual/install.rst.txt Run ErwinJr2 after installation using the python -m ErwinJr2 command, or create a desktop shortcut with ErwinJr-genshortcut. ```bash python -m ErwinJr2 ``` ```bash ErwinJr-genshortcut ``` -------------------------------- ### Install and compile on macOS with gcc Source: https://erwinjr2.readthedocs.io/en/stable/_sources/manual/install.rst.txt On macOS, install Xcode command line tools, then install gcc via Homebrew and use it as the compiler with CC=gcc-10 python setup.py install. The gcc version number may differ (e.g., gcc-11). ```bash xcode-select —-install ``` ```bash brew install gcc ``` ```bash CC=gcc-10 python setup.py install ``` -------------------------------- ### Install ErwinJr2 with pip Source: https://erwinjr2.readthedocs.io/en/stable/manual/install.html Upgrade pip first, then install ErwinJr2 via pip. Requires Python 3.6 or later and pip. ```bash python -m pip install pip --upgrade ``` ```bash python -m pip install ErwinJr2 ``` -------------------------------- ### Build local documentation with make html Source: https://erwinjr2.readthedocs.io/en/stable/_sources/manual/install.rst.txt Build the local documentation. Requires doxygen and the dependencies listed in requirements.txt. Run from the docs directory. ```bash cd docs python -m install -r requirements.txt make html ``` -------------------------------- ### OptStrata constructor Source: https://erwinjr2.readthedocs.io/en/stable/OptStrata.html Initializes an OptStrata instance with wavelength, material list, mole fractions, dopings, thicknesses, mobilities, and custom material dictionaries. ```APIDOC ## OptStrata constructor ### Description Creates a new OptStrata object representing a group of strata, wrapping MaxwellLayer with material parsing support. ### Method Constructor ### Parameters - **wl** (float) - Wavelength in vacuum to guide in the stratum. - **materials** (list of str) - Name of the material for each strata, with materials[0] being the top (usually air) and materials[-1] the substrate. - **moleFracs** (list of float) - Mole fractions for each material. The number should be between 0 and 1. For strata that the parameter is not applicable, the number doesn't influence the result. - **dopings** (list of float) - The doping level in unit 1E17 cm^-3 for the material. For strata that the parameter is not applicable, the number doesn't influence the result. - **Ls** (list of float) - Thickness of stratum, same unit as wl. The first and last elements are for top and substrate and is not used for calculation. - **mobilities** (None or list of float) - Mobility influence the relaxation rate for plasmon resonance. When it's None, it is assumed to have 1E13 s^1 relaxation. - **cstmIdx** (dict) - A dictionary of customized material, with key the name and value the complex refractive index. - **cstmPrd** (dict) - A dictionary of customized material, with key the name and value a list of two elements, 0-th being the period length (float in unit Angstrom) and 1-st (int) being the number of periods. If the 0-th value is 0 or not key not exists, it's not a periodic structure. The variable is only for book keeping and is not used to validate Ls within the class. - **cstmGain** (dict) - A dictionary of customized material, with key the name and value the gain coefficient. The variable is only for book keeping and is not used for any calculation. ### Returns An OptStrata instance. ```