.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/condensed/periodic_potentials/plot_kronig_penney_bands.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_condensed_periodic_potentials_plot_kronig_penney_bands.py: Kronig and Penney: exact bands of a periodic potential ====================================================== Kronig and Penney (1931) solved Schrödinger's equation exactly in a periodic array of barriers. In the delta-function limit :math:`V(x) = (\hbar^2P/ma)\sum_n\delta(x - na)` Bloch's theorem gives the condition .. math:: \cos ka = \cos Ka + P\,\frac{\sin Ka}{Ka}, \qquad E = \frac{\hbar^2K^2}{2m}, which has solutions only where the right-hand side lies in :math:`[-1, 1]`: allowed bands separated by gaps (:func:`~physicskit.condensed.models.kronig_penney_bands`, :func:`~physicskit.condensed.models.kronig_penney_band_edges`). Weak combs open gaps of :math:`2|U_G|` at the zone boundary, as the nearly-free-electron central equation predicts (:func:`~physicskit.condensed.models.nearly_free_electron_bands`); strong combs shrink the bands onto the levels of a box of width :math:`a`. Units are :math:`\hbar = m = 1`. .. GENERATED FROM PYTHON SOURCE LINES 24-32 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from physicskit.condensed.models import kronig_penney_band_edges, kronig_penney_bands, nearly_free_electron_bands a = 1.0 .. GENERATED FROM PYTHON SOURCE LINES 33-35 The Kronig-Penney condition --------------------------- .. GENERATED FROM PYTHON SOURCE LINES 35-49 .. code-block:: Python Ka = np.linspace(1e-3, 4 * np.pi, 2000) P = 3.0 fig, axes = plt.subplots(1, 2, figsize=(12, 4.5)) rhs = np.cos(Ka) + P * np.sin(Ka) / Ka axes[0].plot(Ka / np.pi, rhs, lw=2) axes[0].fill_between(Ka / np.pi, -1, 1, where=np.abs(rhs) <= 1, color="C1", alpha=0.25, label="allowed") axes[0].axhline(1, color="k", lw=0.8) axes[0].axhline(-1, color="k", lw=0.8) axes[0].set_xlabel(r"$Ka / \pi$") axes[0].set_ylabel(r"$\cos Ka + P\,\sin Ka / Ka$") axes[0].set_title(f"P = {P}") axes[0].legend(fontsize=8) .. image-sg:: /api/gallery/condensed/periodic_potentials/images/sphx_glr_plot_kronig_penney_bands_001.png :alt: P = 3.0 :srcset: /api/gallery/condensed/periodic_potentials/images/sphx_glr_plot_kronig_penney_bands_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 50-52 Bands in the reduced zone, against free electrons ------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 52-65 .. code-block:: Python k = np.linspace(-np.pi / a, np.pi / a, 201) E = kronig_penney_bands(k, P, a=a, n_bands=4) free = kronig_penney_bands(k, 0.0, a=a, n_bands=4) axes[1].plot(k * a, free, color="0.6", ls=":", lw=1) axes[1].plot(k * a, E, lw=2) for lo, hi in zip(kronig_penney_band_edges(P, a=a, n_bands=4)[:-1, 1], kronig_penney_band_edges(P, a=a, n_bands=4)[1:, 0]): axes[1].axhspan(lo, hi, color="0.9") axes[1].set_xlabel("ka") axes[1].set_ylabel("E") axes[1].set_title("Kronig-Penney bands (dotted: free electrons)") fig.tight_layout() .. GENERATED FROM PYTHON SOURCE LINES 66-72 From nearly free electrons to tight binding ------------------------------------------- Band edges as the comb strength grows: gaps of :math:`2P/a^2` for weak combs, bands collapsing onto the box levels :math:`(n\pi)^2/2a^2` for strong ones. .. GENERATED FROM PYTHON SOURCE LINES 72-85 .. code-block:: Python Ps = np.logspace(-2, 2.5, 80) edges = np.array([kronig_penney_band_edges(p, a=a, n_bands=3) for p in Ps]) fig2, axes2 = plt.subplots(1, 2, figsize=(12, 4.5)) for n in range(3): axes2[0].fill_between(Ps, edges[:, n, 0], edges[:, n, 1], alpha=0.5, label=f"band {n + 1}") axes2[0].axhline((n + 1) ** 2 * np.pi**2 / 2, color="k", ls=":", lw=0.8) axes2[0].set_xscale("log") axes2[0].set_xlabel("P") axes2[0].set_ylabel("E") axes2[0].set_title("Allowed bands vs comb strength") axes2[0].legend(fontsize=8) .. image-sg:: /api/gallery/condensed/periodic_potentials/images/sphx_glr_plot_kronig_penney_bands_002.png :alt: Allowed bands vs comb strength :srcset: /api/gallery/condensed/periodic_potentials/images/sphx_glr_plot_kronig_penney_bands_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 86-88 The central equation with every Fourier component :math:`U_G = P/a^2` reproduces the exact bands, shifted by the average potential :math:`U_0`. .. GENERATED FROM PYTHON SOURCE LINES 88-105 .. code-block:: Python P_nfe = 1.0 E_kp = kronig_penney_bands(k, P_nfe, a=a, n_bands=3) E_nfe = nearly_free_electron_bands(k, np.full(400, P_nfe / a**2), a=a, n_bands=3) + P_nfe / a**2 E_two = nearly_free_electron_bands(k, [P_nfe / a**2], a=a, n_bands=3) + P_nfe / a**2 axes2[1].plot(k * a, E_kp, "k", lw=2.5) axes2[1].plot(k * a, E_nfe, "C1--", lw=1.5) axes2[1].plot(k * a, E_two, "C2:", lw=1.5) axes2[1].plot([], [], "k", label="Kronig-Penney (exact)") axes2[1].plot([], [], "C1--", label="central equation, 400 $U_G$") axes2[1].plot([], [], "C2:", label="central equation, $U_1$ only") axes2[1].set_xlabel("ka") axes2[1].set_ylabel("E") axes2[1].set_title(f"P = {P_nfe}") axes2[1].legend(fontsize=8) fig2.tight_layout() .. GENERATED FROM PYTHON SOURCE LINES 106-111 Check ----- Every band satisfies the Kronig-Penney condition and ends at Ka = n pi; a weak comb's first gap is 2 U_G = 2P/a^2; a strong one gives box levels; the converged central equation matches the exact bands. .. GENERATED FROM PYTHON SOURCE LINES 111-118 .. code-block:: Python K = np.sqrt(2 * E) np.testing.assert_allclose(np.cos(K * a) + P * np.sin(K * a) / (K * a), np.cos(k * a)[:, None] * np.ones(4), atol=1e-10) np.testing.assert_allclose(kronig_penney_band_edges(P, a=a)[:, 1], (np.arange(1, 5) * np.pi) ** 2 / 2, rtol=1e-12) weak = kronig_penney_band_edges(0.01, a=a, n_bands=2) assert abs((weak[1, 0] - weak[0, 1]) / 0.02 - 1) < 1e-2 assert np.allclose(kronig_penney_band_edges(1e5, a=a, n_bands=3)[:, 0], (np.arange(1, 4) * np.pi) ** 2 / 2, rtol=1e-4) np.testing.assert_allclose(E_nfe, E_kp, rtol=5e-3) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 3.447 seconds) .. _sphx_glr_download_api_gallery_condensed_periodic_potentials_plot_kronig_penney_bands.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_kronig_penney_bands.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_kronig_penney_bands.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_kronig_penney_bands.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_