Skip to content

Instantly share code, notes, and snippets.

@ltalirz
Created March 7, 2023 11:28
Show Gist options
  • Select an option

  • Save ltalirz/41fb91cbb55893b70a8bf9ee862c1fa6 to your computer and use it in GitHub Desktop.

Select an option

Save ltalirz/41fb91cbb55893b70a8bf9ee862c1fa6 to your computer and use it in GitHub Desktop.
One-dimensional chain of atoms with 2 different orbitals
#!/usr/bin/env python
from pythtb import * # import TB model class
import matplotlib.pyplot as plt
lat=[[1.0]]
# one s and one p orbital (at the same site)
orb=[[0.0],[0.0]]
my_model=tb_model(1,1,lat,orb)
# p-orbital is at higher energy (2)
my_model.set_onsite([0,2])
# set hoppings (one for each connected pair of orbitals)
# (amplitude, i, j, [lattice vector to cell containing j])
# p orbital is more extended, thus larger hopping
my_model.set_hop(-0.5, 0, 0, [1])
my_model.set_hop(-1, 1, 1, [1])
# define a path in k-space
(k_vec,k_dist,k_node)=my_model.k_path('fullc',100)
k_label=[r"$0$",r"$\pi$", r"$2\pi$"]
# solve model
evals=my_model.solve_all(k_vec)
# plot band structure
fig, ax = plt.subplots()
for band in evals:
ax.plot(k_dist, band)
ax.set_title("s- and p-orbital chain")
ax.set_xlabel("Path in k-space")
ax.set_ylabel("Band energy")
ax.set_xticks(k_node)
ax.set_xticklabels(k_label)
ax.set_xlim(k_node[0],k_node[-1])
for n in range(len(k_node)):
ax.axvline(x=k_node[n], linewidth=0.5, color='k')
fig.tight_layout()
fig.savefig("s_and_p.pdf")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment