Skip to content
Snippets Groups Projects
Commit 10e67c50 authored by Anton Akhmerov's avatar Anton Akhmerov
Browse files

add numerical DOS plots

parent 3386feca
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -118,6 +118,25 @@ def phonons_1d_2masses():
draw_classic_axes(ax, xlabeloffset=.2)
pyplot.savefig('phonons6.svg')
def DOS_finite_phonon_chain(n, output_name):
rhs = 2 * np.eye(n) - np.eye(n, k=1) - np.eye(n, k=-1)
rhs[0, 0] -= 1
rhs[-1, -1] -= 1
pyplot.figure()
pyplot.hist(np.sqrt(np.abs(np.linalg.eigvalsh(rhs))), bins=30)
pyplot.xlabel("$\omega$")
pyplot.ylabel("Number of levels")
pyplot.savefig(output_name)
def DOS_finite_electron_chain(n, output_name):
rhs = - np.eye(n, k=1) - np.eye(n, k=-1)
pyplot.figure()
pyplot.hist(np.linalg.eigvalsh(rhs), bins=30)
pyplot.xlabel("$E$")
pyplot.ylabel("Number of levels")
pyplot.savefig(output_name)
def main():
os.chdir('figures')
......@@ -126,6 +145,10 @@ def main():
phonons_1d_2masses()
meff_1d_tb()
tight_binding_1d()
DOS_finite_phonon_chain(3, 3_phonons.svg)
DOS_finite_phonon_chain(300, 300_phonons.svg)
DOS_finite_electron_chain(3, 3_electrons.svg)
DOS_finite_electron_chain(300, 300_electrons.svg)
if __name__ == "__main__":
main()
......@@ -261,74 +261,23 @@ $$
Diagonalizing large matrices is unwieldy, but let's try and check it numerically to see if we notice a trend.
Eigenfrequencies of 3 atoms: `[0.0 1.0 1.732050]`
```python
%matplotlib inline
import numpy as np
from matplotlib import pyplot
![](figures/3_phonons.svg)
# Phonons
rhs = np.array([[1, -1, 0], [-1, 2, -1], [0, -1, 1]])
print("Eigenfrequencies of 3 atoms:", np.sqrt(np.linalg.eigvalsh(rhs)))
pyplot.hist(np.sqrt(np.linalg.eigvalsh(rhs)), bins=30)
pyplot.show()
Energies of 3 orbitals: `[-1.41421356 0.0 1.41421356]`
# Electrons
![](figures/3_electrons.svg)
rhs = np.array([[0, -1, 0], [-1, 0, -1], [0, -1, 0]])
print("Energies of 3 orbitals:", np.linalg.eigvalsh(rhs))
pyplot.hist(np.linalg.eigvalsh(rhs), bins=30);
```
### From 3 atoms to 300
Eigenfrequencies of 3 atoms: [6.26502485e-09 1.00000000e+00 1.73205081e+00]
Frequencies of many phonons:
![](figures/300_phonons.svg)
Energies of many electrons:
![png](lecture_3_files/lecture_3_14_1.png)
Energies of 3 orbitals: [-1.41421356e+00 -8.06646416e-17 1.41421356e+00]
![png](lecture_3_files/lecture_3_14_3.png)
### From 3 atoms to 100
```python
n = 100
# Phonons
rhs = 2 * np.eye(100) - np.eye(100, k=1) - np.eye(100, k=-1)
rhs[0, 0] -= 1
rhs[-1, -1] -= 1
print('Frequencies of many phonons')
pyplot.hist(np.sqrt(np.abs(np.linalg.eigvalsh(rhs))), bins=30)
pyplot.show()
# Electrons
rhs = - np.eye(100, k=1) - np.eye(100, k=-1)
print("Energies of many electrons")
pyplot.hist(np.linalg.eigvalsh(rhs), bins=30);
```
Frequencies of many phonons
![png](lecture_3_files/lecture_3_16_1.png)
Energies of many electrons
![png](lecture_3_files/lecture_3_16_3.png)
![](figures/300_electrons.svg)
## Summary
......
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