objects module

objects.py is a subroutine of EMUstack that contains the NanoStruct, ThinFilm and Light objects. These represent the properties of a structured layer, a homogeneous layer and the incident light respectively.

Copyright (C) 2015 Bjorn Sturmberg, Kokou Dossou, Felix Lawrence

EMUstack is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

class objects.EMUstack

Bases: object

class objects.Light(wl_nm, max_order_PWs=2, k_parallel=None, theta=None, phi=None, n_inc=1.0)[source]

Bases: object

Represents the light incident on structure.

Incident angles may either be specified by k_parallel or by incident angles theta and phi, together with the refractive index n_inc of the incident medium.

wl_nm and k_pll are both in unnormalised units.

At normal incidence and TE polarisation the E-field is aligned with the y-axis.

At normal incidence some plane waves and Bloch modes become degenerate. This causes problems for the FEM solver and the ordering of the plane waves. To avoid this a small (1e-5) theta and phi are introduced.

Parameters:

wl_nm (float) – Wavelength, in nanometers.

Keyword Arguments:
 
  • max_order_PWs (int) – Maximum plane wave order to include.
  • k_parallel (tuple) – The wave vector components (k_x, k_y) parallel to the interface planes. Units of nm^-1.
  • theta (float) – Polar angle of incidence in degrees.
  • phi (float) – Azimuthal angle of incidence in degrees measured from x-axis.
class objects.NanoStruct(periodicity, period, diameter1, period_y=None, inc_shape='circle', ellipticity=0.0, ff=0, ff_rand=False, small_space=None, edge_spacing=False, len_vertical=0, len_horizontal=0, background=<materials.Material object at 0x7f2dc8f7f390>, inclusion_a=<materials.Material object at 0x7f2dc8f7f510>, inclusion_b=<materials.Material object at 0x7f2dc8f7f550>, inclusion_c=<materials.Material object at 0x7f2dc8f7f590>, inclusion_d=<materials.Material object at 0x7f2dc8f7f5d0>, inclusion_e=<materials.Material object at 0x7f2dc8f7f610>, loss=True, height_nm=100.0, diameter2=0, diameter3=0, diameter4=0, diameter5=0, diameter6=0, diameter7=0, diameter8=0, diameter9=0, diameter10=0, diameter11=0, diameter12=0, diameter13=0, diameter14=0, diameter15=0, diameter16=0, gap=0, smooth=0, hyperbolic=False, world_1d=None, posx=0, posy=0, make_mesh_now=True, force_mesh=True, mesh_file='NEED_FILE.mail', lc_bkg=0.09, lc2=1.0, lc3=1.0, lc4=1.0, lc5=1.0, lc6=1.0, plotting_fields=False, plot_real=1, plot_imag=0, plot_abs=0, plot_field_conc=False, plt_msh=True)[source]

Bases: object

Represents a structured layer.

Parameters:
  • periodicity (str) – Either 1D or 2D structure ‘1D_array’, ‘2D_array’.
  • period (float) – The period of the unit cell in nanometers.
  • diameter1 (float) – The diameter of the inclusion in nm.
Keyword Arguments:
 
  • period_y (float) – The period of the unit cell in the y-direction. If None, period_y = period.
  • inc_shape (str) – Shape of inclusions that have template mesh, currently; ‘circle’, ‘ellipse’, ‘square’, ‘ring’, ‘SRR’, ‘dimer’, ‘square_dimer’, ‘strip_circle’, ‘strip_square’.
  • ellipticity (float) – If != 0, inclusion has given ellipticity, with b = diameter, a = diameter-ellipticity * diameter. NOTE: only implemented for a single inclusion.
  • len_vertical (float) – Vertical length of split ring resonator (if inc_shape = ‘SRR’).
  • len_horizontal (float) – Horizontal length of split ring resonator (if inc_shape = ‘SRR’).
  • diameter2-16 (float): The diameters of further inclusions in nm. Implemented up to diameter6 for 1D_arrays.
  • gap (float) – The dimer gap in nm. (if inc_shape = ‘dimer’ or ‘square_dimer’).
  • smooth (float) – smoothness of square_dimer angles, between 0 (sharp). and 1 (circle). (if inc_shape = square_dimer’).
  • inclusion_a – A :Material: instance for first inclusion, specified as dispersive refractive index (eg. materials.Si_c) or nondispersive complex number (eg. Material(1.0 + 0.0j)).
  • inclusion_b – A :Material: instance for the second inclusion medium.
  • inclusion_c – A :Material: instance for the third inclusion medium.
  • inclusion_d – A :Material: instance for the fourth inclusion medium.
  • inclusion_e – A :Material: instance for the fifth inclusion medium.
  • background – A :Material: instance for the background medium.
  • loss (bool) – If False, Im(n) = 0, if True n as in :Material: instance.
  • height_nm (float) – The thickness of the layer in nm or ‘semi_inf’ for a semi-infinite layer.
  • hyperbolic (bool) – If True FEM looks for Eigenvalues around n**2 * k_0**2 rather than the regular n**2 * k_0**2 - alpha**2 - beta**2.
  • world_1d (bool) – Does the rest of the stack have exclusively 1D periodic structures and homogeneous layers? If True we use the set of 1D diffraction order PWs. Defaults to True for ‘1D_array’, and False for ‘2D_array’.
  • ff (float) – The fill fraction of the inclusions. If non-zero, the specified diameters are overwritten s.t. given ff is achieved, otherwise ff is calculated from parameters and stored in self.ff.
  • ff_rand (bool) – If True, diameters overwritten with random diameters, s.t. the ff is as assigned. Must provide non-zero dummy diameters.
  • posx (float) – Shift NWs laterally towards center (each other), posx is a fraction of the distance possible before NWs touch.
  • posy (float) – Shift NWs vertically towards center (each other), posx is a fraction of the distance possible before NWs touch.
  • small_space (float) – Only for 1D_arrays with 2 interleaved inclusions. Sets distance between edges of inclusions. By default (d_in_nm - diameter1 - diameter2) / 2. The smaller distance is on the, which left of center (inclusion_a remains centered).
  • edge_spacing (bool) – For 1D_array with >= 3 inclusions. Space inclusion surfaces by equal separations. Else their centers will be equally spaced.
  • make_mesh_now (bool) – If True, program creates a FEM mesh with provided :NanoStruct: parameters. If False, must provide mesh_file name of existing .mail that will be run despite :NanoStruct: parameters.
  • force_mesh (bool) – If True, a new mesh is created despite existence of mesh with same parameter. This is used to make mesh with equal period etc. but different lc refinement.
  • mesh_file (str) – If using a set premade mesh give its name including .mail if 2D_array (eg. 600_60.mail), or .txt if 1D_array. It must be located in backend/fortran/msh/
  • lc_bkg (float) – Length constant of meshing of background medium (smaller = finer mesh)
  • lc2 (float) – factor by which lc_bkg will be reduced on inclusion surfaces; lc_surface = cl_bkg / lc2.
  • lc3-6’ (float): factor by which lc_bkg will be reduced at center of inclusions.
  • plotting_fields (bool) – Unless set to true field data deleted. Also plots modes (ie. FEM solutions) in gmsh format. Plots epsilon*|E|^2 & choice of real/imag/abs of x,y,z components & field vectors. Fields are saved as gmsh files, but can be converted by running the .geo file found in Bloch_fields/PNG/
  • plot_real (bool) – Choose to plot real part of modal fields.
  • plot_imag (bool) – Choose to plot imaginary part of modal fields.
  • plot_abs (bool) – Choose to plot absolute value of modal fields.
  • plt_msh (bool) – Save a plot of the 1D array geometry.
calc_modes(light, **args)[source]

Run a simulation to find the NanoStruct’s modes.

Parameters:
  • light (Light instance) – Represents incident light.
  • args (dict) – Options to pass to :Simmo.calc_modes:.
Returns:

Simmo:object

make_mesh()[source]
class objects.ThinFilm(period, period_y=None, height_nm=1.0, num_pw_per_pol=0, world_1d=False, material=<materials.Material object at 0x7f2dc8f7f650>, loss=True)[source]

Bases: object

Represents an unstructured homogeneous film.

Parameters:

period (float) – Artificial period imposed on homogeneous film to give consistently defined plane waves in terms of diffraction orders of structured layers.

Keyword Arguments:
 
  • period_y (float) – The period of the unit cell in the y-direction. If None, period_y = period.
  • height_nm (float) – The thickness of the layer in nm or ‘semi_inf’ for a semi-infinte layer.
  • num_pw_per_pol (int) – The number of plane waves per polarisation.
  • world_1d (bool) – Does the rest of the stack have exclusively 1D periodic structures and homogeneous layers? If True we use the set of 1D diffraction order PWs.
  • material – A :Material: instance specifying the n of the layer and related methods.
  • loss (bool) – If False sets Im(n) = 0, if True leaves n as is.
calc_modes(light)[source]

Run a simulation to find the ThinFilm’s modes.

Parameters:
  • light (Light instance) – Represents incident light.
  • args (dict) – Options to pass to :Anallo.calc_modes:.
Returns:

Anallo:object

objects.calculate_ff(inc_shape, d, dy, a1, a2=0, a3=0, a4=0, a5=0, a6=0, a7=0, a8=0, a9=0, a10=0, a11=0, a12=0, a13=0, a14=0, a15=0, a16=0, el1=0)[source]

Calculate the fill fraction of the inclusions.

Parameters:
  • inc_shape (str) – shape of the inclusions.
  • d (float) – period of structure, in same units as a1-16.
  • dy (float) – period of structure along y-axis, in same units as a1-16.
  • a1 (float) – diameter of inclusion 1, in same units as d.
Keyword Arguments:
 
  • a2-16 (float): diameters of further inclusions.
  • el1 (float) – ellipticity of inclusion 1.
objects.dec_float_str(dec_float)[source]

Convert float with decimal point into string with ‘_’ in place of ‘.’