Bandstructures in

Calculating a bandstructure with and an IPython notebook

This post has three goals. 1) Show we can run simulations in the IPython notebook (instead of org-mode), second, to directly post the notebook to the dft-book blog, and finally to show how to calculate a band-structure.

First we import the libraries we need.

In [1]:
%matplotlib inline
from vasp import Vasp
In [2]:
from ase.lattice.surface import fcc111
In [3]:
slab = fcc111('Al', size=(1, 1, 4), vacuum=10)
Atoms(symbols='Al4', positions=..., tags=..., cell=[[2.8637824638055176, 0.0, 0.0], [1.4318912319027588, 2.4801083645679673, 0.0], [0.0, 0.0, 27.014805770653954]], pbc=[True, True, False])

Now we setup and run a calculation. We need a base calculation to get the electron density from. Then, we will run a non-self-consistent calculation with a k-point path using that density.

In [4]:
from vasp.vasprc import VASPRC
VASPRC['queue.nodes'] = 'n5'  # specify to run on node named n5

calc = Vasp('../../Al-bandstructure',
            kpts=[6, 6, 6],
            lcharg=True,  # We need the charge and wavefunctions for the second step
            atoms=slab)  # we need to wait for this to finish

Once the calculation is done, we can run the bandstructure calculation. We specify a path through k-space as a series of pairs of points, and the number of "intersections" we want on each path. This path has 4 segments, with 10 points on each segment.

In [5]:
n, bands, p = calc.get_bandstructure(kpts_path=[(r'$\Gamma$', [0, 0, 0]),
                                                ('$K1$', [0.5, 0.0, 0.0]),
                                                ('$K1$', [0.5, 0.0, 0.0]),
                                                ('$K2$', [0.5, 0.5, 0.0]),
                                                ('$K2$', [0.5, 0.5, 0.5]),
                                                (r'$\Gamma$', [0, 0, 0]),
                                                (r'$\Gamma$', [0, 0, 0]),
                                                ('$K3$', [0, 0, 1])],

The figure above shows why we only need $m \times n \times 1$ k-point meshes for slabs. From $\Gamma$ to $K3$ the bands are flat, so one k-point is sufficient to characterize the band energy in that direction (that is the z-direction in this calculation.).

That is basically it! I didn't find this as easy to use as Emacs + org-mode, but since I have 5+ years of skill with that, and a day of experience with this, that might be expected ;)


Comments powered by Disqus