# LMF band plotting

This tutorial demonstrates how to plot bands. This is done for silicon starting from a self-consistent LDA density. An example of color plotting is provided as an additional exercise.

### Command summary

```
$ blm si --express --nk=4 --gmax=5 && cp actrl.si ctrl.si && lmfa si && cp basp0.si basp.si && lmf si > out.lmfsc
$ lmf si --rs=1,0 -vnit=1 --band~fn=syml #calculate bands
$ echo -6,6 / | plbnds -fplot -ef=0 -scl=13.6 -lbl=L,G,X,W,G bnds.si #set up plotting
$ fplot -f plot.plbnds && gs fplot.ps #plot and view
```

### Tutorial

The starting point is a self-consistent LDA calculation, you may want to review the DFT tutorial for silicon. Copy the following lines to a file called *init.si*:

```
LATTICE
ALAT=10.26
PLAT= 0.00000000 0.50000000 0.50000000
0.50000000 0.00000000 0.50000000
0.50000000 0.50000000 0.00000000
# pos means cartesian coordinates, units of alat
SITE
ATOM=Si POS= 0.00000000 0.00000000 0.00000000
ATOM=Si POS= 0.25000000 0.25000000 0.25000000
```

Run the following command to obtain a self-consistent density.

```
$ blm si --express --nk=4 --gmax=5 && cp actrl.si ctrl.si && lmfa si && cp basp0.si basp.si && lmf si > out.lmfsc
```

To plot the band structure you need to specify the symmetry lines in a file called *syml.si*. Create this file with the following lines:

```
41 .5 .5 .5 0 0 0 L to G
41 0 0 0 1 0 0 G to X
21 1 0 0 1 .5 0 X to W
41 1 .5 0 0 0 0 W to G
0 0 0 0 0 0 0
```

Each line specifies a line segment in k-space. Consider the first line above, which is the line between the high-symmetry points $L$ and $\Gamma$. In the first column, **‘41’** specifies the number of k points along the line segment. The **‘.5 .5 .5’** and **‘0 0 0’** parts are the xyz coordinates for the $L$ and $\Gamma$ points in units of $2\pi/a$, where $a$ is the lattice constant. The last line indicates the end of the file.

To generate the bands (i.e. calculate the energy at each k-point), simply run the following command. Notes that writing **lmf si** is the same as writing **lmf ctrl.si**, see DFT tutorial for silicon for more.

```
$ lmf si --rs=1,0 -vnit=1 --band~fn=syml #calculate bands
```

The **’--rs=1,0’** switch specifies that the restart file *rst.si* (containing the density) is to be read but not written to. The **‘-vnit=1’** switch changes the number of iterations in the ctrl file to 1. The **--band** switch tells **lm** to generate energy bands, contained in the *bnds.si* file, along the specified k-points. The start of your bnds file should look like this:

```
26 0.18551 0
41
0.50000 0.50000 0.50000
-0.5219 -0.3297 0.0980 0.0980 0.2913 0.4307 0.4307 0.8146 0.9718 0.9718
1.0286 1.0952 1.0952 1.1809 1.6466 1.7134 1.8691 1.8691 2.0960 2.0960
2.2431 2.5998 2.5998 2.7835 2.7836 3.1076
```

The first line is header and specifies the maximum number of bands, the Fermi level (in Rydbergs) and a number to do with colored plotting (see additional exercises). The ‘41’ in the second line specifies the number of k points in the line segment. The third line lists the coordinates of the first k point and the following three lines are the energies for the 26 bands. The rest of the file is ordered in this way: number of k points in line, followed by alternating lines of coordinates and blocks of energies for each k point in the line segment.

Now plot the bands by running the following two commands:

```
$ echo -6,6,10,15 | plbnds -fplot -ef=0 -scl=13.6 -lbl=L,G,X,W,G bnds.si #set up plotting
$ fplot -f plot.plbnds #plot
```

The first line uses the **plbnds** tool to do some data conversion and generates a script for the graphics package **fplot**. More details can be found in the plbnds documentation page and the fplot documentation page. The **‘echo -6,6,10,15 | plbnds’** part of the command specifies a y axis (energy window) from -6 ro 6 and that the overall figure width is 10 cm width and height is 15 cm. The **‘-fplot’** generates files for fplot, **‘-ef=0’** shifts the fermi energy to zero, **‘-scl=13.6’** scales the band energies by 13.6 (converts from Ry to eV) and the **‘-lbl’** supplies the high-symmetry point labels for the x axis. The second command plots the band structure, it uses **fplot** to create a postscript file fplot.ps. Open this file with a document viewer of your choice, for example do:

```
$ gs fplot.ps
```

You can see that silicon has an indirect band gap of around 0.60 eV. The valence band maximum falls at the $\Gamma$ point while the conduction band minimum lies between $\Gamma$ and X, at about 0.85 of the distance to X. The experimental gap is about 1.2 eV.

### Other Resources

See Additional Exercises for an example of drawing bands with color weights. The band-edge tutorial demonstrates how to find extremal points based on gradients optimization and how to calculate effective masses.

### Additional Exercises

**1) Drawing bands with color weights**

In the above tutorial, bands were calculated and the k points and energies were recorded in the bnds file. In addition, it is possible to generate orbital character weights (based on a Mulliken decomposition) which are also added to the bnds file. The weights can be used with a graphics package to draw bands with continuously varying color. To demonstrate the color weights feature, we will consider the $s$ and $p$ orbital character in silicon. More details can be found in the plbnds documentation page.

It is assumed that you already have a self-consistent LDA density (see above tutorial). Edit the ctrl file to change the number of iterations to 1 **nit=1**:

```
$ nano ctrl.si
```

To see how the orbitals are ordered, run the lmf program with high verbosity:

```
$ lmf si --rs=1,0 --quit=ham --pr60
```

The **–quit=ham** tells lmf to stop after assembling the hamiltonian (we only want to print some information). Towards the end of the output, you will see the following section:

```
Orbital positions in hamiltonian, resolved by l:
Site Spec Total By l ...
1 Si 1:13 1:1(s) 2:4(p) 5:9(d) 10:10(s) 11:13(p)
2 Si 14:26 14:14(s) 15:17(p) 18:22(d) 23:23(s) 24:26(p)
```

The **‘1:18’** specifies that the basis functions from the first silicon atom occupy columns 1:18 in the hamiltonian. The basis functions are then ordered by angular momentum ($s$, $p$, $d$ etc). Here we are actually using a basis set with two sets of energies (double kappa), the first set is listed as 1:9 and the second as 10:13 ($s$, $p$ and $d$ for first set but only $s$ and $p$ for the second). To highlight the $s$ and $p$ contributions from both atoms, run the lmf band plotting command with lists of the $s$ and $p$ orbitals:

```
$ lmf si --rs=1,0 -vnit=1 --band~fn=syml~col=1,10,14,23~col2=2:4,11:13,15:17,24:26
```

Here, **‘col’** specifies the $s$ basis functions and **‘col2’** specifies the $p$. Take a look at the bnds file and you will see that color weights information has been added to the first header line. The k points are also now repeated three times, each followed by a block of values. The first block is the same as before, it has the energies for each of the bands (lines 4-7 in the text below). The other two blocks (lines 9-12 and 14-17) list the $s$ and $p$ weights respectively.

```
26 0.18551 2 col= 1,10,14,23 col2= 2:4,11:13,15:17,24:26
41
0.50000 0.50000 0.50000
-0.5219 -0.3297 0.0980 0.0980 0.2913 0.4307 0.4307 0.8146 0.9718 0.9718
1.0286 1.0952 1.0952 1.1809 1.6466 1.7134 1.8691 1.8691 2.0960 2.0960
2.2431 2.5998 2.5998 2.7835 2.7836 3.1076
0.50000 0.50000 0.50000
0.5497 0.4301 0.0000 0.0000 0.3380 -0.0000 -0.0000 0.8391 0.0000 0.0000
0.3080 0.0000 0.0000 0.8107 0.0436 0.1563 -0.0000 -0.0000 0.0000 0.0000
-0.3558 0.0000 0.0000 0.0000 0.0000 0.8804
0.50000 0.50000 0.50000
0.3421 0.5736 0.9191 0.9191 0.3794 0.5009 0.5009 -0.0133 0.0486 0.0486
0.4355 0.3679 0.3679 0.1944 0.4686 0.5662 0.1194 0.1194 0.4461 0.4461
0.9106 0.9129 0.9129 0.6851 0.6851 0.1429
```

Now plot the color-weighted bands by running the following commands:

```
$ echo -6,6 / | plbnds -fplot -ef=0 -scl=13.6 -lt=1,bold=3,col=0,0,0,colw=1,0,0,colw2=0,0,1 -lbl=L,G,X,W,G bnds.si
$ fplot -f plot.plbnds
```

The color weights are specified in RGB notation after col, colw and colw2. The first color weight (for $s$ contribution) is red, indicated by **‘colw=1,0,0’** and the second is blue **‘colw2=0,0,1’**. The **‘col=0,0,0’** specifies that the rest of the orbital character is black. Open the fplot.ps file and you will see the $s$ and $p$ character highlighted in red and blue.

Edit This Page