Skip to content

Commit

Permalink
Include materials library in scheme (#483)
Browse files Browse the repository at this point in the history
* Auto load materials library in scheme

* materials library renamed
  • Loading branch information
ChristopherHogan authored and stevengj committed Aug 31, 2018
1 parent 9eb00fa commit 411b88c
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,9 @@ fi # with_python
AC_SUBST(PYTHON_INCLUDES)
AM_CONDITIONAL(WITH_PYTHON, test x"$have_python" = "xyes")

# Copy/symlink casimir.scm to builddir for out-of-tree builds
# Copy/symlink casimir.scm and materials.scm to builddir for out-of-tree builds
AC_CONFIG_LINKS(scheme/casimir.scm:scheme/casimir.scm)
AC_CONFIG_LINKS(scheme/materials.scm:scheme/materials.scm)

##############################################################################

Expand Down
6 changes: 3 additions & 3 deletions doc/docs/Materials.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ All of the above features that are supported for the electric permittivity ε ar
Materials Library
-----------------

A materials library is available for [Python](https://github.com/stevengj/meep/tree/master/python/materials.py) and [Scheme](https://github.com/stevengj/meep/tree/master/scheme/examples/materials-library.scm) containing [crystalline silicon](https://en.wikipedia.org/wiki/Crystalline_silicon), [amorphous silicon](https://en.wikipedia.org/wiki/Amorphous_silicon) (including hydrogenated), [silicon dioxide](https://en.wikipedia.org/wiki/Silicon_dioxide) (SiO<sub>2</sub>), [indium tin oxide](https://en.wikipedia.org/wiki/Indium_tin_oxide) (ITO), [alumina](https://en.wikipedia.org/wiki/Aluminium_oxide) (Al<sub>2</sub>O<sub>3</sub>), [gallium arsenide](https://en.wikipedia.org/wiki/Gallium_arsenide) (GaAs), [aluminum arsenide](https://en.wikipedia.org/wiki/Aluminium_arsenide) (AlAs), [aluminum nitride](https://en.wikipedia.org/wiki/Aluminium_nitride) (AlN), [borosilicate glass](https://en.wikipedia.org/wiki/Borosilicate_glass) (BK7), [fused quartz](https://en.wikipedia.org/wiki/Fused_quartz), [silicon nitride](https://en.wikipedia.org/wiki/Silicon_nitride) (Si<sub>3</sub>N<sub>4</sub>), [germanium](https://en.wikipedia.org/wiki/Germanium) (Ge), [indium phosphide](https://en.wikipedia.org/wiki/Indium_phosphide) (InP), [poly(methyl methacrylate)](https://en.wikipedia.org/wiki/Poly(methyl_methacrylate)), [polycarbonate](https://en.wikipedia.org/wiki/Polycarbonate), [polystyrene](https://en.wikipedia.org/wiki/Polystyrene), [cellulose](https://en.wikipedia.org/wiki/Cellulose), as well as 11 elemental metals: [silver](https://en.wikipedia.org/wiki/Silver) (Ag), [gold](https://en.wikipedia.org/wiki/Gold) (Au), [copper](https://en.wikipedia.org/wiki/Copper) (Cu), [aluminum](https://en.wikipedia.org/wiki/Aluminium) (Al), [berylium](https://en.wikipedia.org/wiki/Beryllium) (Be), [chromium](https://en.wikipedia.org/wiki/Chromium) (Cr), [nickel](https://en.wikipedia.org/wiki/Nickel) (Ni), [palladium](https://en.wikipedia.org/wiki/Palladium) (Pd), [platinum](https://en.wikipedia.org/wiki/Platinum) (Pt), [titanium](https://en.wikipedia.org/wiki/Titanium) (Ti), and [tungsten](https://en.wikipedia.org/wiki/Tungsten) (W).
A materials library is available for [Python](https://github.com/stevengj/meep/tree/master/python/materials.py) and [Scheme](https://github.com/stevengj/meep/tree/master/scheme/materials.scm) containing [crystalline silicon](https://en.wikipedia.org/wiki/Crystalline_silicon), [amorphous silicon](https://en.wikipedia.org/wiki/Amorphous_silicon) (including hydrogenated), [silicon dioxide](https://en.wikipedia.org/wiki/Silicon_dioxide) (SiO<sub>2</sub>), [indium tin oxide](https://en.wikipedia.org/wiki/Indium_tin_oxide) (ITO), [alumina](https://en.wikipedia.org/wiki/Aluminium_oxide) (Al<sub>2</sub>O<sub>3</sub>), [gallium arsenide](https://en.wikipedia.org/wiki/Gallium_arsenide) (GaAs), [aluminum arsenide](https://en.wikipedia.org/wiki/Aluminium_arsenide) (AlAs), [aluminum nitride](https://en.wikipedia.org/wiki/Aluminium_nitride) (AlN), [borosilicate glass](https://en.wikipedia.org/wiki/Borosilicate_glass) (BK7), [fused quartz](https://en.wikipedia.org/wiki/Fused_quartz), [silicon nitride](https://en.wikipedia.org/wiki/Silicon_nitride) (Si<sub>3</sub>N<sub>4</sub>), [germanium](https://en.wikipedia.org/wiki/Germanium) (Ge), [indium phosphide](https://en.wikipedia.org/wiki/Indium_phosphide) (InP), [poly(methyl methacrylate)](https://en.wikipedia.org/wiki/Poly(methyl_methacrylate)), [polycarbonate](https://en.wikipedia.org/wiki/Polycarbonate), [polystyrene](https://en.wikipedia.org/wiki/Polystyrene), [cellulose](https://en.wikipedia.org/wiki/Cellulose), as well as 11 elemental metals: [silver](https://en.wikipedia.org/wiki/Silver) (Ag), [gold](https://en.wikipedia.org/wiki/Gold) (Au), [copper](https://en.wikipedia.org/wiki/Copper) (Cu), [aluminum](https://en.wikipedia.org/wiki/Aluminium) (Al), [berylium](https://en.wikipedia.org/wiki/Beryllium) (Be), [chromium](https://en.wikipedia.org/wiki/Chromium) (Cr), [nickel](https://en.wikipedia.org/wiki/Nickel) (Ni), [palladium](https://en.wikipedia.org/wiki/Palladium) (Pd), [platinum](https://en.wikipedia.org/wiki/Platinum) (Pt), [titanium](https://en.wikipedia.org/wiki/Titanium) (Ti), and [tungsten](https://en.wikipedia.org/wiki/Tungsten) (W).

Experimental values of the complex refractive index are fit to a [Drude-Lorentz susceptibility profile](#material-dispersion) over various wavelength ranges. For example, the fit for crystalline silicon is based on [Progress in Photovoltaics, Vol. 3, pp. 189-92, 1995](https://onlinelibrary.wiley.com/doi/full/10.1002/pip.4670030303) for the wavelength range of 0.4 to 1.0 µm as described in [J. Optical Society of America A, Vol. 28, pp. 770-77, 2011](https://www.osapublishing.org/josaa/abstract.cfm?uri=josaa-28-5-770). The fit for the elemental metals is over the range of 0.2 to 12.4 μm and is described in [Applied Optics, Vol. 37, pp. 5271-83, 1998](https://www.osapublishing.org/ao/abstract.cfm?uri=ao-37-22-5271).

Expand All @@ -132,10 +132,10 @@ from meep.materials import Al
```
Then, the material can be simply used as `geometry = [meep.Cylinder(material=Al, ...]`.

In Scheme, the required lines are:
In Scheme, the materials library is already included when meep is run, so you can use it without any initialization:

```scm
(include "/path/to/materials-library.scm")
(set! geometry (list (make cylinder (material Al) ...)))
```

Note: for narrowband calculations, some of the Lorentzian susceptibility terms may be unnecessary and will contribute to consuming more computational resources than are required (due to the additional storage and time stepping of the polarization fields). Computational efficiency can be improved (without significantly affecting accuracy) by removing from the material definitions those Lorentzian suspeptibility terms which are far outside the spectral region of interest.
4 changes: 1 addition & 3 deletions doc/docs/Scheme_Tutorials/Material_Dispersion.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ The wavelength-dependent, lossless permittivity of fused quartz, measured experi

$$\varepsilon(\lambda) = 1 + \frac{0.6961663\lambda^2}{\lambda^2-0.0684043^2} + \frac{0.4079426\lambda^2}{\lambda^2-0.1162414^2} + \frac{0.8974794\lambda^2}{\lambda^2-9.896161^2}$$

The wavelength λ is in units of microns. This equation is valid from 0.21 to 6.7 μm. The Sellmeier form for the permittivity of fused quartz can be imported into Meep as a [Lorentzian susceptibility](Materials/#material-dispersion) via a slight reorganization to convert the wavelength dependence into frequency. This is implemented in the [materials library](https://github.com/stevengj/meep/blob/master/scheme/examples/materials-library.scm#L163-L180).
The wavelength λ is in units of microns. This equation is valid from 0.21 to 6.7 μm. The Sellmeier form for the permittivity of fused quartz can be imported into Meep as a [Lorentzian susceptibility](Materials/#material-dispersion) via a slight reorganization to convert the wavelength dependence into frequency. This is implemented in the [materials library](https://github.com/stevengj/meep/blob/master/scheme/materials.scm#L163-L180).

The simulation involves a 1d cell. A planewave current source with a pulsed profile spanning visible wavelengths of 0.4 to 0.8 μm is normally incident on the quartz from air. The reflectance is computed using the convention of two separate runs: (1) an empty cell to obtain the incident power, and (2) with the quartz to obtain the reflected power. The details of this type of calculation are described in [Tutorial/Basics](Basics/#transmittance-spectrum-of-a-waveguide-bend). The grid resolution, and by direct extension the time resolution via the [Courant condition](https://en.wikipedia.org/wiki/Courant%E2%80%93Friedrichs%E2%80%93Lewy_condition), must be made sufficiently fine to obtain agreement with the analytic results and to ensure [numerical stability](Materials/#numerical-stability). Coarse resolutions may lead to field instabilities.

The simulation script is below and in [refl-quartz.ctl](https://github.com/stevengj/meep/blob/master/scheme/examples/refl-quartz.ctl).

```scm
(include "/path/to/materials-library.scm")
(set-param! resolution 200) ; pixels/μm
(define-param sz 10)
Expand Down
2 changes: 1 addition & 1 deletion python/tests/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def test_in_box_volumes(self):
sim.field_energy_in_box(v)

def test_load_dump_structure(self):
from meep.materials_library import Al
from meep.materials import Al
resolution = 50
cell = mp.Vector3(5, 5)
sources = mp.Source(src=mp.GaussianSource(1, fwidth=0.2), center=mp.Vector3(), component=mp.Ez)
Expand Down
4 changes: 2 additions & 2 deletions scheme/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bin_PROGRAMS = meep
EXTRA_DIST = meep.scm.in meep-enums.scm casimir.scm meep_wrap.patch examples
EXTRA_DIST = meep.scm.in meep-enums.scm casimir.scm materials.scm meep_wrap.patch examples

LIBMEEP = $(top_builddir)/src/libmeep.la

Expand Down Expand Up @@ -62,7 +62,7 @@ MY_DEFS = -DHAVE_CTL_HOOKS=1 -DHAVE_CTL_EXPORT_HOOK=1

PROGRAM_NAME = meep
SPECIFICATION_FILE = $(PROGRAM_NAME).scm
nodist_pkgdata_DATA = $(SPECIFICATION_FILE) meep-enums.scm casimir.scm
nodist_pkgdata_DATA = $(SPECIFICATION_FILE) meep-enums.scm casimir.scm materials.scm

##############################################################################

Expand Down
2 changes: 0 additions & 2 deletions scheme/examples/refl-quartz.ctl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(include "/path/to/materials_library.scm")

(set-param! resolution 400) ; pixels/um

(define-param sz 10)
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions scheme/meep.scm.in
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@
; (one specifications file can include another specifications file)
(include "@LIBCTL_DIR@/utils/geom.scm")

; Include materials library
(include "materials.scm")

(if (defined? 'meep-component-Ex) (include "meep-enums.scm"))

(define CYLINDRICAL -2) ; special value of dimensions for cylindrical coords
Expand Down

0 comments on commit 411b88c

Please sign in to comment.