123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- from scattnlay import mie
- import matplotlib.pyplot as plt
- import numpy as np
- from optical_constants import read_refractive_index_from_yaml as get_index
- def gauss(x, mu, sigma):
- return 1/(sigma * np.sqrt(2 * np.pi)) * np.exp( - (x - mu)**2 / (2 * sigma**2))
- fill_factor = 0.8
- from_WL = 300
- to_WL = 1100
- WL_points= 100
- WLs = np.linspace(from_WL, to_WL, WL_points)
- r_points = 200
- from_r = 40/2.
- to_r =80/2.
- all_r = np.linspace(from_r, to_r, r_points)
- r_mean = 58.3/2.
- r_std = 6.3/2.
- core_r = 30
- inner_shell_h = 8
- outer_shell_h = 10
- host_media = 1.33
- r_weights = gauss(all_r, r_mean,r_std)/len(all_r)
- plt.plot(all_r, r_weights )
- plt.xlabel("R, nm")
- plt.ylabel("amount")
- index_SiO2 = get_index("refractiveindex_info/SiO2-Gao.yml", WLs, units='nm')
- index_Au = get_index("refractiveindex_info/Au-Johnson.yml", WLs, units='nm')
- index_TiO2 = get_index("refractiveindex_info/TiO2-Sarkar.yml", WLs, units='nm')
- print("Au index before correction, max = ", np.max(np.imag(index_Au[:,1])))
- eps_exp = index_Au[:,1]**2
- c=299792458
- h= 4.135667516e-15
- w = h*c/(WLs*1e-9)
- w_p =8.55
- g_b = 18.4e-3
- v_f = 1.4e6
- A = 1.33
- L_b = (4.*((core_r+inner_shell_h)**3 - core_r**3)/
- (3.*((core_r+inner_shell_h)**2 + core_r**2)))
- g_s = h*A*v_f/(inner_shell_h*1e-9)
- eps_Au = (eps_exp
- +
- w_p**2 / ( w * (w + 1j*g_b) )
- -
- w_p**2 / ( w * (w + 1j*(g_b+g_s)) )
- )
- index_Au[:,1] += 1.6j
- print(f"L_b={L_b}")
- print(f"g_s={g_s}, g_b={g_b} ")
- print("Au index after, max = ", np.max(np.imag(index_Au[:,1])))
- x = np.ones((3), dtype = np.float64)
- m = np.ones((3), dtype = np.complex128)
- Qext_core_shell = np.zeros(len(WLs))
- Qext_3l = np.zeros(len(WLs))
- for i in range(len(WLs)):
- WL = WLs[i]
- for j in range(len(all_r)):
- core_r = all_r[j]
-
- weight = r_weights[j]
-
- x = host_media*2.0*np.pi/WL*np.array([core_r,
- core_r+inner_shell_h,
- core_r+inner_shell_h+outer_shell_h])
- m = np.array([index_SiO2[i][1], index_Au[i][1],
- index_TiO2[i][1]]
- )/host_media
-
- mie.SetLayersSize(x)
- mie.SetLayersIndex(m)
- mie.RunMieCalculation()
- Qext_3l[i] += mie.GetQext()*weight
- x = host_media*2.0*np.pi/WL*np.array([core_r,
- core_r+inner_shell_h])
- m = np.array([index_SiO2[i][1], index_Au[i][1]])/host_media
- mie.SetLayersSize(x)
- mie.SetLayersIndex(m)
- mie.RunMieCalculation()
- Qext_core_shell[i] += mie.GetQext()*weight
- fig, axs2 = plt.subplots(1,1)
- axs2.plot(WLs, Qext_3l, color="purple")
- axs2.plot(WLs, Qext_core_shell, color="lime")
- axs2.set_xlabel("WL, nm")
- axs2.set_ylabel("Extinction, a.u.")
- plt.savefig("spectra.pdf",pad_inches=0.02, bbox_inches='tight')
- plt.show()
- plt.clf()
- plt.close()
|