calc-SiAgSi-Qabs.py 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #!/usr/bin/env python
  2. # -*- coding: UTF-8 -*-
  3. #
  4. # Copyright (C) 2009-2015 Ovidio Peña Rodríguez <ovidio@bytesfall.com>
  5. # Copyright (C) 2013-2015 Konstantin Ladutenko <kostyfisik@gmail.com>
  6. #
  7. # This file is part of python-scattnlay
  8. #
  9. # This program is free software: you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation, either version 3 of the License, or
  12. # (at your option) any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU General Public License for more details.
  18. #
  19. # The only additional remark is that we expect that all publications
  20. # describing work using this software, or all commercial products
  21. # using it, cite the following reference:
  22. # [1] O. Pena and U. Pal, "Scattering of electromagnetic radiation by
  23. # a multilayered sphere," Computer Physics Communications,
  24. # vol. 180, Nov. 2009, pp. 2348-2354.
  25. #
  26. # You should have received a copy of the GNU General Public License
  27. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  28. # This test case calculates the electric field in the
  29. # E-k plane, for an spherical Si-Ag-Si nanoparticle.
  30. import scattnlay
  31. from scattnlay import fieldnlay
  32. from scattnlay import scattnlay
  33. import numpy as np
  34. import cmath
  35. # from fieldplot import GetFlow3D
  36. # from fieldplot import GetField
  37. from fieldplot import fieldplot
  38. ###############################################################################
  39. def SetXM(design):
  40. """ design value:
  41. 1: AgSi - a1
  42. 2: SiAgSi - a1, b1
  43. 3: SiAgSi - a1, b2
  44. """
  45. epsilon_Si = 18.4631066585 + 0.6259727805j
  46. epsilon_Ag = -8.5014154589 + 0.7585845411j
  47. index_Si = np.sqrt(epsilon_Si)
  48. index_Ag = np.sqrt(epsilon_Ag)
  49. isSiAgSi=True
  50. isBulk = False
  51. if design==1:
  52. #36 5.62055 0 31.93 4.06 49 5.62055 500
  53. isSiAgSi=False
  54. WL=500 #nm
  55. core_width = 0.0 #nm Si
  56. inner_width = 31.93 #nm Ag
  57. outer_width = 4.06 #nm Si
  58. elif design==2:
  59. #62.5 4.48866 29.44 10.33 22.73 0 4.48866 500
  60. WL=500 #nm
  61. core_width = 29.44 #nm Si
  62. inner_width = 10.33 #nm Ag
  63. outer_width = 22.73 #nm Si
  64. elif design == 3:
  65. #81.4 3.14156 5.27 8.22 67.91 0 3.14156 500
  66. WL=500 #nm
  67. core_width = 5.27 #nm Si
  68. inner_width = 8.22 #nm Ag
  69. outer_width = 67.91 #nm Si
  70. elif design==4:
  71. WL=800 #nm
  72. epsilon_Si = 13.64 + 0.047j
  73. epsilon_Ag = -28.05 + 1.525j
  74. core_width = 17.74 #nm Si
  75. inner_width = 23.31 #nm Ag
  76. outer_width = 22.95 #nm Si
  77. elif design==5:
  78. WL=354 #nm
  79. core_r = WL/20.0
  80. epsilon_Ag = -2.0 + 0.28j #original
  81. index_Ag = np.sqrt(epsilon_Ag)
  82. x = np.ones((1), dtype = np.float64)
  83. x[0] = 2.0*np.pi*core_r/WL
  84. m = np.ones((1), dtype = np.complex128)
  85. m[0] = index_Ag
  86. # x = np.ones((2), dtype = np.float64)
  87. # x[0] = 2.0*np.pi*core_r/WL/4.0*3.0
  88. # x[1] = 2.0*np.pi*core_r/WL
  89. # m = np.ones((2), dtype = np.complex128)
  90. # m[0] = index_Ag
  91. # m[1] = index_Ag
  92. return x, m, WL
  93. core_r = core_width
  94. inner_r = core_r+inner_width
  95. outer_r = inner_r+outer_width
  96. nm = 1.0
  97. if isSiAgSi:
  98. x = np.ones((3), dtype = np.float64)
  99. x[0] = 2.0*np.pi*core_r/WL
  100. x[1] = 2.0*np.pi*inner_r/WL
  101. x[2] = 2.0*np.pi*outer_r/WL
  102. m = np.ones((3), dtype = np.complex128)
  103. m[0] = index_Si/nm
  104. m[1] = index_Ag/nm
  105. # m[0, 1] = index_Si/nm
  106. m[2] = index_Si/nm
  107. else:
  108. # bilayer
  109. x = np.ones((2), dtype = np.float64)
  110. x[0] = 2.0*np.pi*inner_r/WL
  111. x[1] = 2.0*np.pi*outer_r/WL
  112. m = np.ones((2), dtype = np.complex128)
  113. m[0] = index_Ag/nm
  114. m[1] = index_Si/nm
  115. return x, m, WL
  116. ###############################################################################
  117. #design = 1 #AgSi
  118. #design = 2
  119. #design = 3
  120. design = 4 # WL=800
  121. comment='SiAgSi-flow'
  122. #design = 5 # Bulk Ag
  123. # comment='bulk-Ag-flow'
  124. x, m, WL = SetXM(design)
  125. WL_units='nm'
  126. print "x =", x
  127. print "m =", m
  128. npts = 101
  129. factor=2.1
  130. flow_total = 39
  131. #flow_total = 21
  132. #flow_total = 0
  133. crossplane='XZ'
  134. #crossplane='YZ'
  135. #crossplane='XY'
  136. # Options to plot: Eabs, Habs, Pabs, angleEx, angleHy
  137. field_to_plot='Pabs'
  138. #field_to_plot='angleEx'
  139. fieldplot(x,m, WL, comment, WL_units, crossplane, field_to_plot, npts, factor, flow_total)