Skip to content
Snippets Groups Projects
Verified Commit 39f9bd5d authored by Anton Akhmerov's avatar Anton Akhmerov
Browse files

pythonize and recolor NFEM

parent 609e94d6
No related branches found
No related tags found
1 merge request!108rework plots
```python tags=["initialize"]
import matplotlib
from matplotlib import pyplot
import numpy as np
import plotly.offline as py
import plotly.graph_objs as go
from common import draw_classic_axes, configure_plotting
configure_plotting()
pi = np.pi
```
......@@ -50,7 +55,39 @@ In the free electron model, the dispersion is $E = \hbar^2 |\mathbf{k}|^2/2m$. T
Within the **nearly free electron model** we start from the dispersion relation of free electrons and analyze the effect of introducing a weak lattice potential. The logic is very similar to getting optical and acoustic phonon branches by changing atom masses (and thereby reducing the size of the Brillouin zone). The lattice potential results in a band structure that is periodic in $k$-space, with a period given by the period of the reciprocal lattice:
![](figures/nearly_free_electron_bands.svg)
```python
# Use colors from the default color cycle
default_colors = pyplot.rcParams['axes.prop_cycle'].by_key()['color']
blue, orange, *_ = default_colors
def energy(k, V=1):
k = (k + pi) % (2*pi) - pi
k_vals = k + 2*pi * np.arange(-1, 2)
h = np.diag(k_vals**2) + V * (1 - np.identity(3))
return np.linalg.eigvalsh(h)
energy = np.vectorize(energy, signature="(),()->(m)")
fig, ax = pyplot.subplots(1, 1)
momenta = np.linspace(-3*pi, 3*pi, 400)
energies = energy(momenta, 0)
max_en = 60
energies[energies > max_en] = np.nan
ax.plot(momenta, energies, c=blue)
energies = energy(momenta, 3)
max_en = 60
energies[energies > max_en] = np.nan
ax.plot(momenta, energies, c=orange)
ax.set_xlabel("$ka$")
ax.set_ylabel("$E$")
ax.set_ylim(-.5, max_en + 5)
ax.set_xticks(pi * np.arange(-3, 4))
ax.set_xticklabels(fr"${i}\pi$".replace("1", "") if i else "$0$" for i in range(-3, 4))
draw_classic_axes(ax, xlabeloffset=4)
```
In this figure, the red curves represent the nearly-free electron dispersion, which differs from the free-electron dispersion (black curves) because of the interaction with the lattice. We see that **band gaps** open where two copies of the free-electron dispersion cross. A key goal of this lecture is to understand how the weak interaction with the lattice leads to this modified band structure.
......@@ -165,21 +202,65 @@ There are several common ways to **plot** the same dispersion relation (no diffe
Repeated BZ (all possible Bloch bands):
![](figures/nearly_free_electron_bands.svg)
```python
fig
```
* Contains redundant information
* May be easier to count/follow the bands
Reduced BZ (all bands within 1st BZ):
![](figures/reduced_nearly_free_electron_bands.svg)
```python
fig, ax = pyplot.subplots(1, 1)
momenta = np.linspace(-pi, pi, 400)
energies = energy(momenta, 0)
max_en = 60
energies[energies > max_en] = np.nan
ax.plot(momenta, energies, c=blue)
energies = energy(momenta, 3)
max_en = 60
energies[energies > max_en] = np.nan
ax.plot(momenta, energies, c=orange)
ax.set_xlabel("$ka$")
ax.set_ylabel("$E$")
ax.set_ylim(-.5, max_en + 5)
ax.set_xticks(pi * np.arange(-1, 2))
ax.set_xticklabels(r"$-\pi$ $0$ $\pi$".split())
draw_classic_axes(ax, xlabeloffset=4)
```
* No redundant information
* Hard to relate to original dispersion
Extended BZ (n-th band within n-th BZ):
![](figures/extended_nearly_free_electron_bands.svg)
```python
fig, ax = pyplot.subplots(1, 1)
momenta = np.linspace(-3*pi, 3*pi, 400)
energies = energy(momenta, 0)
max_en = 60
energies[energies > max_en] = np.nan
energies[~((abs(momenta) // pi).reshape(-1, 1) == np.arange(3).reshape(1, -1))] = np.nan
ax.plot(momenta, energies, c=blue)
energies = energy(momenta, 3)
max_en = 60
energies[energies > max_en] = np.nan
energies[~((abs(momenta) // pi).reshape(-1, 1) == np.arange(3).reshape(1, -1))] = np.nan
ax.plot(momenta, energies, c=orange)
ax.set_xlabel("$ka$")
ax.set_ylabel("$E$")
ax.set_ylim(-.5, max_en + 5)
ax.set_xticks(pi * np.arange(-3, 4))
ax.set_xticklabels(fr"${i}\pi$".replace("1", "") if i else "$0$" for i in range(-3, 4))
draw_classic_axes(ax, xlabeloffset=4)
```
* No redundant information
* Easy to relate to free electron model
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment