|
@@ -25,53 +25,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
-from scattnlay import fieldnlay, scattnlay, expansioncoeffs, scattcoeffs
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-import numpy as np
|
|
|
-import cmath
|
|
|
|
|
|
-WL=550
|
|
|
-core_r = 102
|
|
|
-
|
|
|
+from scattnlay import fieldnlay, scattnlay, expansioncoeffs, scattcoeffs
|
|
|
+import cmath
|
|
|
+import matplotlib.pyplot as plt
|
|
|
+import numpy as np
|
|
|
|
|
|
-index_NP = 4.0
|
|
|
x = np.ones((1), dtype = np.float64)
|
|
|
m = np.ones((1), dtype = np.complex128)
|
|
|
|
|
|
-import matplotlib.pyplot as plt
|
|
|
+WL=550
|
|
|
+core_r = 180
|
|
|
+index_NP = 4.0
|
|
|
+
|
|
|
+from_R = 120/2.0
|
|
|
+to_R = 240/2.0
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
npts = 151
|
|
|
ext = ".png"
|
|
|
-
|
|
|
+npts = 351
|
|
|
|
|
|
-x[0] = 2.0*np.pi*core_r/WL
|
|
|
-m[0] = index_NP
|
|
|
-
|
|
|
-comment='bulk-NP-R'+str(core_r)+'nm-WL'+str(WL)
|
|
|
-
|
|
|
-x = np.array([x])
|
|
|
-m = np.array([m])
|
|
|
-
|
|
|
-terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2 = scattnlay(x, m)
|
|
|
-nmax = terms
|
|
|
-
|
|
|
-terms, an, bn = scattcoeffs(x, m, nmax)
|
|
|
-
|
|
|
-terms, aln, bln, cln, dln = expansioncoeffs(x, m, nmax)
|
|
|
-print(terms, dln)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+comment='bulk-NP-WL'+str(WL)
|
|
|
+
|
|
|
+val_all = []
|
|
|
+
|
|
|
+all_R = np.linspace(from_R, to_R, npts)
|
|
|
+for core_r in all_R:
|
|
|
+ x[0] = 2.0*np.pi*core_r/WL
|
|
|
+ m[0] = index_NP
|
|
|
+ terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2 = scattnlay(np.array([x]), np.array([m]))
|
|
|
+ terms, an, bn = scattcoeffs(np.array([x]), np.array([m]),terms)
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ terms, aln, bln, cln, dln = expansioncoeffs(np.array([x]), np.array([m]), terms)
|
|
|
+ order = 0
|
|
|
+ val_all.append([
|
|
|
+ np.abs(aln[0][-1][order]),np.abs(dln[0][0][order])
|
|
|
+
|
|
|
+ ])
|
|
|
+
|
|
|
+val_all = np.array(val_all)
|
|
|
+
|
|
|
+
|
|
|
+fig, axs = plt.subplots(1,1)
|
|
|
+fig.tight_layout()
|
|
|
+fig.subplots_adjust(hspace=0.3, wspace=-0.1)
|
|
|
+all_R = all_R*2
|
|
|
+plt.plot(all_R, val_all[:,0],label="electric dipole, scatt.")
|
|
|
+plt.plot(all_R, val_all[:,1],label="electric dipole, internal")
|
|
|
+plt.legend()
|
|
|
+
|
|
|
+plt.ylim(0,4)
|
|
|
+plt.xlabel("D, nm")
|
|
|
+plt.ylabel("Mie coefficients")
|
|
|
+plt.savefig(comment+"-R"+str(int(round(x[-1]*WL/2.0/np.pi)))+ext,
|
|
|
+ pad_inches=0.02, bbox_inches='tight')
|
|
|
+plt.clf()
|
|
|
+plt.close()
|
|
|
|
|
|
|