Add analytical solution of Cext calculation
@@ -1178,3 +1178,27 @@ def constant_charge_twosphere_identical(sigma, a, R, kappa, epsilon):
1 + kappa * a) - 1 / (kappa * a * 1 / numpy.tanh(kappa * a) - 1))
return E_inter
+
+def Cext_analytical(radius, wavelength, diel_out, diel_in):
+ """
+ Calculates the analytical solution of the extinction cross section.
+ This solution is valid when the nano particle involved is a sphere.
+
+ Arguments:
+ ----------
+ radius : float, radius of the sphere in [nm].
+ wavelength: float/array of floats, wavelength of the incident
+ electric field in [nm].
+ diel_out : complex/array of complex, dielectric constant inside surface.
+ diel_in : complex/array of complex, dielectric constant inside surface.
+
+ Returns:
+ --------
+ Cext_an : float/array of floats, extinction cross section.
+
+ """
+ wavenumber = 2*numpy.pi*numpy.sqrt(diel_out)/wavelength
+ C1 = wavenumber**2*(diel_in/diel_out-1)/(diel_in/diel_out+2)
+ Cext_an = 4*numpy.pi*radius**3/wavenumber.real * C1.imag
+
+ return Cext_an
