Skip to content

Commit

Permalink
add pythtb band visualization example
Browse files Browse the repository at this point in the history
  • Loading branch information
lxvm committed Oct 29, 2024
1 parent 6177ea9 commit 62dbae3
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install documentation dependencies
run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
- name: Install dependencies
run: DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
run: DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs/ -e 'ENV["PYTHON"]=""; using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate(); using Conda; Conda.pip_interop(true); Conda.pip("install", "pythtb")'
- name: Build and deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
Expand Down
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
Brillouin = "23470ee3-d0df-4052-8b1a-8cbd6363e7f0"
Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
Expand Down
47 changes: 44 additions & 3 deletions docs/src/pages/viz/band.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,50 @@ visualize k-paths.

## Energy bands

!!! note "In progress"
This will be added soon
In the following example, we plot the band structure of graphene defined as a tight binding model in PythTB.
This serves to reproduce the [PythTB homepage example](https://www.physics.rutgers.edu/pythtb/) using AutoBZ.jl and highlight the [`load_pythtb_data`](@ref) interface.

```@example
using PyCall
py"""
from pythtb import *
# lattice vectors and orbital positions
lat=[[1.0, 0.0], [0.5, np.sqrt(3.0)/2.0]]
orb=[[1./3., 1./3.], [2./3., 2./3.]]
# two-dimensional tight-binding model
gra=tb_model(2, 2, lat, orb)
# define hopping between orbitals
gra.set_hop(-1.0, 0, 1, [ 0, 0])
gra.set_hop(-1.0, 1, 0, [ 1, 0])
gra.set_hop(-1.0, 1, 0, [ 0, 1])
k=[[0.0, 0.0],[1./3., 2./3.],[0.5,0.5]]
path=gra.k_path(k, 100)
"""
gra = py"gra"
(k_vec,k_dist,k_node)=py"path"
using AutoBZ
h,bz = load_pythtb_data(gra)
using LinearAlgebra
hk = getproperty.(eigen.(h.(eachrow(k_vec))), :values)
using GLMakie
fig = Figure()
ax = Axis(fig[1,1]; xticks = (k_node, ["Γ", "K", "M"]))
series!(ax, k_dist, stack(hk))
save("grapheneband.png", fig); nothing # hide
```

![Graphene band kpath](grapheneband.png)

## Band velocities

To overlay band velocities on the k-ath
!!! note "In progress"
This will be added soon

To overlay band velocities on the k-path

0 comments on commit 62dbae3

Please sign in to comment.