from subprocess import check_output from indexes import Au_index, H2O_index gold = Au_index() length = 60. width = 25. AR = (length - width) / width # Definition of ADDA for Aspect Ratio medium_n = 1.3330 # Refractive index of Water Q_abss = [] C_abss = [] Q_extt = [] C_extt = [] for wavelength in range(500, 800): wl = wavelength / 1000 # change wl to micrometers gold_n = gold.r_i(wl) wl = wl / medium_n gold_n = gold_n / medium_n stdout = check_output( "adda -shape capsule " + str(AR) + " -size " + str(width / 1000) + " -grid 16 -orient 0 90 0 -lambda " + str(wl) + " -m " + str(gold_n.real) + " " + str(gold_n.imag), shell=True) # Format the output to a usable format std = str(stdout) std = std.split('\n') Q_abss.append(float(std[-2].split("\t=")[1])) C_abss.append(float(std[-3].split("\t=")[1])) Q_extt.append(float(std[-4].split("\t=")[1]))
from subprocess import check_output from indexes import Au_index, H2O_index gold = Au_index() length = 60. width = 25. AR = (length-width)/width # Definition of ADDA for Aspect Ratio medium_n = 1.3330 # Refractive index of Water Q_abss = [] C_abss = [] Q_extt = [] C_extt = [] for wavelength in range(500,800): wl = wavelength/1000 # change wl to micrometers gold_n = gold.r_i(wl) wl = wl/medium_n gold_n = gold_n / medium_n stdout = check_output("adda -shape capsule " + str(AR) + " -size " + str(width/1000) + " -grid 16 -orient 0 90 0 -lambda " + str(wl) + " -m " + str(gold_n.real) + " " + str(gold_n.imag),shell=True) # Format the output to a usable format std = str(stdout) std = std.split('\n') Q_abss.append(float(std[-2].split("\t=")[1])) C_abss.append(float(std[-3].split("\t=")[1])) Q_extt.append(float(std[-4].split("\t=")[1])) C_extt.append(float(std[-5].split("\t=")[1]))
init_width = float(conf_param[2]) etching = float(conf_param[3]) print("Starting Simulation with the following parameters:") print("Starting wavelength: {}nm.".format(starting_wavelength)) print("Initial length: {}nm. Initial width: {}nm".format(init_length, init_width)) print("Etching step: {}nm. Total number of simulations: {}\n".format(etching, number_simulations)) #total_wl = 200 # Total number of wavelengths #start_wl = 600 # Starting wavelength in nm #stop_wl = 800 # Ending wavelength in nm gold = Au_index() water = H2O_index() #init_length = 60 # Initial length in nm #init_width = 25 # Initial width in nm #etching = .5 # Etching rate between simulations #number_simulations = 20 directory = str(init_length) + "X" + str(init_width) if not os.path.exists(directory): os.mkdir(str(init_length) + "X" + str(init_width)) # Variables to store the data Q_abss = []