diff --git a/configure.ac b/configure.ac
index ab46c4472..533360578 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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)
##############################################################################
diff --git a/doc/docs/Materials.md b/doc/docs/Materials.md
index cb5787550..d41b63f9e 100644
--- a/doc/docs/Materials.md
+++ b/doc/docs/Materials.md
@@ -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) (SiO2), [indium tin oxide](https://en.wikipedia.org/wiki/Indium_tin_oxide) (ITO), [alumina](https://en.wikipedia.org/wiki/Aluminium_oxide) (Al2O3), [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) (Si3N4), [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) (SiO2), [indium tin oxide](https://en.wikipedia.org/wiki/Indium_tin_oxide) (ITO), [alumina](https://en.wikipedia.org/wiki/Aluminium_oxide) (Al2O3), [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) (Si3N4), [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).
@@ -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.
diff --git a/doc/docs/Scheme_Tutorials/Material_Dispersion.md b/doc/docs/Scheme_Tutorials/Material_Dispersion.md
index 39c623d53..94285a5e3 100644
--- a/doc/docs/Scheme_Tutorials/Material_Dispersion.md
+++ b/doc/docs/Scheme_Tutorials/Material_Dispersion.md
@@ -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)
diff --git a/python/tests/simulation.py b/python/tests/simulation.py
index c2e817457..3b7e37f55 100644
--- a/python/tests/simulation.py
+++ b/python/tests/simulation.py
@@ -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)
diff --git a/scheme/Makefile.am b/scheme/Makefile.am
index 1b10d410f..bfc252972 100644
--- a/scheme/Makefile.am
+++ b/scheme/Makefile.am
@@ -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
@@ -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
##############################################################################
diff --git a/scheme/examples/refl-quartz.ctl b/scheme/examples/refl-quartz.ctl
index a8f2be746..fa7317ace 100644
--- a/scheme/examples/refl-quartz.ctl
+++ b/scheme/examples/refl-quartz.ctl
@@ -1,5 +1,3 @@
-(include "/path/to/materials_library.scm")
-
(set-param! resolution 400) ; pixels/um
(define-param sz 10)
diff --git a/scheme/examples/materials-library.scm b/scheme/materials.scm
similarity index 100%
rename from scheme/examples/materials-library.scm
rename to scheme/materials.scm
diff --git a/scheme/meep.scm.in b/scheme/meep.scm.in
index 56268e803..a8b68f68d 100644
--- a/scheme/meep.scm.in
+++ b/scheme/meep.scm.in
@@ -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