elif(software=="nextnano.MSB"): my_input_file_no_extension = my_input_file_no_extension_nnMSB #=========================== if(software=="nextnano.NEGF" or software=="nextnano.MSB"): FileExtension = '.xml' # for nextnano.NEGF and nextnano.MSB else: FileExtension = '.in' # for nextnano++ and nextnano3 my_input_file = my_input_file_no_extension+FileExtension # plt.ion() # interactive mode print(f"starting nextnano...") input_file_name = os.path.join(folder_examples,my_input_file) input_file = nn.InputFile(input_file_name) #++++++++++++++++++++++++++++++++++++++++++++++ # These lines have to be adjusted by the user. #++++++++++++++++++++++++++++++++++++++++++++++ print(f"List of variables: {input_file.variables}") for var in input_file.variables.values(): # print(f'${var.name} = {var.value} ! {var.comment}') print(f'{var.text}') # --> better method to preview #SweepVariable = 'ThicknessAlGaN' SweepVariable = 'ThicknessGaNcap' comment_original = input_file.variables[SweepVariable].comment #ListOfValues = ["10.0"] #ListOfValues = ["10.0", "15.0", "20.0"]
# ```python # my_input = nextnanopy.InputFile('example.in') # my_input.config # ``` # # When you want to execute the input file, # # ```python # my_input.execute() # ``` # # It will automatically detect the nextnano product (nextnano++, nextnano3 or nextnano.NEGF) and will load the corresponding configuration parameters. # In[8]: my_input = nn.InputFile(r'..\..\tests\datafiles\nextnano++\example.in') my_input.config # In[9]: my_input.execute() # ## Execute with different parameters # # ### Method 1: use another configuration file # # If you want to execute an input file with another configuration file, you can do # # ```python # my_input = nextnanopy.InputFile('example.in',configpath=r'C:\new_path\random_name.nextnanopy-config') # my_input.config
# detect software based on input file software, software_short, FileExtension = detect_software( input_folder, filename) # Define output folders. If they do not exist, they are created. folder_output = nn.config.config[software]['outputdirectory'] folder_output_python = os.path.join(folder_output, r'nextnanopy') mkdir_if_not_exist(folder_output_python) print("Output folder: ", folder_output) print("Output folder python: ", folder_output_python) # plt.ion() # interactive mode print("starting nextnano...") input_path = os.path.join(input_folder, filename) input_file = nn.InputFile(input_path) filename_no_extension = filename.replace(FileExtension, '') folder_total = os.path.join(folder_output, filename_no_extension) print("output folder_total:") print(folder_total) my_input_file_python = os.path.join(folder_output_python, filename) my_input_file_new = os.path.join(folder_total, filename) print("input file:") print(my_input_file_new) input_file.save(my_input_file_python, overwrite=True, automkdir=True) input_file.save(my_input_file_new, overwrite=True, automkdir=True)
my_input_file_no_extension = my_input_file_no_extension_nnMSB #=========================== if (software == "nextnano.NEGF" or software == "nextnano.MSB"): FileExtension = '.xml' # for nextnano.NEGF and nextnano.MSB else: FileExtension = '.in' # for nextnano++ and nextnano3 my_input_file = my_input_file_no_extension + FileExtension # plt.ion() # interactive mode print(f"starting nextnano...") input_file_name = os.path.join(folder_examples, my_input_file) input_file = nn.InputFile( r'C:\Users\naoki.mitsui\Documents\nextnano\My input files\laser_diode_tutorial\LaserDiode_InGaAs_1D_qm_nnp_nnmat_AvsAscii_one_file.in' ) print(f'') print(f'=====================================') ############################ # Execute nextnano software ############################ # input_file.execute() # Put line into comment if you only want to to post-processing of results print(f'=====================================') ############################ # plot energy-resolved density + conduction bandedge (cb) ############################ ListOfValues = [ '00000', '00001', '00002', '00003', '00004', '00005', '00006', '00007',
import os import nextnanopy as nn from nextnanopy.nnp.shapes import GdsPolygons from nextnanopy.nnp.assistants import InputAssistant import matplotlib.pyplot as plt import numpy as np plt.ion() def find_line_by_pattern(_str, lines): for i, line in enumerate(lines): if _str in line: return i raise ValueError(f'{_str} is not in the input file') input_template = nn.InputFile(r'example3D_gds.in') raw_lines = list(input_template.lines) # Here gates gdspols = GdsPolygons(r'example3.gds') gdspols.labels = ['up', 'down'] if True: fig, ax = plt.subplots(1) gdspols.show(ax=ax) f = InputAssistant() # Helper for generating text for nextnano++ input files zi = 0 # nm, gate initial z zf = 50 # nm, gate final z pols = gdspols.get_polygonal_prisms(zi, zf) # get the polygonal_prisms text # Generate the region block with the contact name and the material