# Generating and plotting energy bands with lmf

This tutorial demonstrates how to plot bands, using Si as an example (there is a corresponding tutorial for ASA). This tutorial builds on the basic DFT tutorial for silicon. Plotting bands with color weights to elucidate orbital character is given as an additional exercise.

Spectral functions are the analog of energy bands for interacting hamiltonians such as generated by GW or Dynamical Mean Field Theory. See this tutorial to draw the spectral function for Fe from a GW calculation.

The following steps require init.si, which can be obtained here.

blm init.si --simple --wsite --nk,ins --ctrl=ctrl && lmfa ctrl.si && lmf ctrl.si > out.lmfsc
lmchk ctrl.si --syml~n=51~mq~lblq:G=0,0,0,L=1/2,1/2,1/2,X=0,1/2,1/2,W=1/4,1/2,3/4,K=3/8,3/8,3/4~lbl=LGXWGK
lmf si --band~fn=syml
plbnds -range=-6,6 -fplot -ef=0 -scl=13.6 -lbl bnds.si
fplot -f plot.plbnds && gs fplot.ps                                     #plot and view


### Tutorial

The starting point is a self-consistent LDA calculation. You will need the init.si from the basic DFT tutorial for silicon. Starting in a clean directory, paste the init file from that tutorial into init.si and do

blm init.si --simple --wsite --nk,ins --ctrl=ctrl && lmfa ctrl.si && lmf ctrl.si > out.lmfsc


The command above repeats all the steps of that tutorial. To plot the band structure you need to specify the symmetry lines, stored in an ASCII file (syml.si in this tutorial).

You can create this file by hand, but it is simpler to use the --syml switch of the lmchk utility to generate syml.si for you. Here we use the semiautomatic mode of --syml. There is also a fully automatic mode, where you don’t need to supply anything. Click on the link below for a brief explanation of how to use it.

lmchk ctrl.si --syml generates syml.si fully automatically. It is fastest and simplest of all the modes, and it also provides lots of crystallographic information. You do not need to supply any information about k points and paths.

This mode uses a predefined set of high-symmetry points and suggested paths, taken from this paper: (10.1016/j.commatsci.2016.10.015).

Note: this fully automatic mode requires that spglib be linked into your executable. It is not difficult to do, but you must download the library and ensure it is linked when compiling (see flags.mk).

Probably the autogenerated path is different from what you want. You can modify syml.si with a text editor, or alternatively use a nice property of this mode. As port of the output it prints a --syml instruction in the style of the semiautomatic mode which we actually use in this tutorial. For elemental Si it generates the following:
--syml~n=31~mq~lblq:G=0,0,0,X=1/2,0,1/2,L=1/2,1/2,1/2,W=1/2,1/4,3/4,K=3/8,3/8,3/4,U=5/8,1/4,5/8~lbl=GXU,KGLWX.
Compare it to the instruction used in the tutorial.

You can make a new syml.si and avoid the tedious editing of syml.si, job by customizing this switch and rerunning lmchk in semiautomatic mode.

Si has a face-centered cubic (fcc) lattice; an instruction to generate file syml.si for the fcc lattice is given here. Adapt the command given there as follows:

lmchk ctrl.si --syml~n=51~mq~lblq:G=0,0,0,L=1/2,1/2,1/2,X=0,1/2,1/2,W=1/4,1/2,3/4,K=3/8,3/8,3/4~lbl=LGXWGK


This should generate file syml.si, which we will use to draw bands in the first Brillouin zone, on lines that connect high-symmetry points: L→Γ ; Γ→X ; X→W ; W→Γ ; Γ→K. Points, L, Γ, X, W, K are well known and can be found on the Wikipedia page and in many textbooks. A particularly useful reference is the paper by Setyawan and Curtarolo, Computational Materials Science 49, 299 (2010), which provides a list of high-symmetry points for every crystal system.

syml.si should appear as follows:

# generated from switch --syml~n=51~mq~lblq:G=0,0,0,L=1/2,1/2,1/2,X=0,1/2,1/2,W=1/4,1/2,3/4,K=3/8,3/8,3/4~lbl=LGXWGK
44    0.5000000   0.5000000   0.5000000     0.0000000   0.0000000   0.0000000  L  to  G
51    0.0000000   0.0000000   0.0000000     1.0000000   0.0000000   0.0000000  G  to  X
26    1.0000000   0.0000000   0.0000000     1.0000000   0.5000000   0.0000000  X  to  W
57    1.0000000   0.5000000   0.0000000     0.0000000   0.0000000   0.0000000  W  to  G
54    0.0000000   0.0000000   0.0000000     0.7500000   0.7500000   0.0000000  G  to  K


Consider the first line above, which is the line connecting points L and Γ. The first entry ( 41 ) specifies the number of k points along the line segment:  0.5 0.5 0.5  and  0 0 0  are the L and Γ points for the fcc lattice, expressed in Cartesian coordinates, in units of $2\pi/a$, with $a$ the lattice constant (10.26 a.u. for Si). Alternatively, you can build syml.si with end points expressed as fractional multiples of the reciprocal lattice vectors. To do this, simply add ~wmq to the --syml switch.

Hazard: When generating energy bands generated by --syml~wmq, be sure to generate bands with --band~mq. Users have found this to be a source of confusion and it advised that you stick with Cartesian coordinates unless you are confident in what you are doing.

To generate energy bands, run lmf with the --band  switch. (Note that lmf si and lmf ctrl.si do the same thing.)

lmf si --band~fn=syml


Switch --band~fn=syml tells lmf to operate in a special band generating mode, generating bands on particular lines in k, as specified in syml.si in this case. --band has a large number of optional modifiers; the instruction shown is the simplest one.

lmf writes energy bands to file bnds.si, an ASCII file whose syntax is explained here. The first line (header) should look similar to:

    26   0.16114     0  lbl=L,G,X,W,G,K


These entries specifiy the number of bands, the Fermi level (in Rydbergs) the number of color weights (0 in this case, but see additional exercises); and finally an optional tag specifying labels for the endpoints of the line segments. Generally the Fermi level should come out not too far from zero. This has to do with the choice of reference potential: this a constant potential shift cannot change the electronic structure, but can be chosen arbitrarily

Plot the bands by running the following:

plbnds -range=-6,6 -fplot -ef=0 -scl=13.6 -lbl bnds.si
fplot -f plot.plbnds


The first line uses the plbnds utility to do some data conversion and generate a script for the graphics package fplot. More details can be found in the plbnds documentation page and the fplot documentation page.

Command-line arguments to plbnds have the following meaning:

• -range-6,6  specifies the energy window over which to draw the bands
• -fplot  generates data files and a script for the fplot utility. (Note that  -fplot  has a number of optional modifiers to help tailor the format of the figure.)
• -ef=0  shifts the Fermi energy to zero
• -scl=13.6  scales the band energies by 13.6, that is converts from Ry to eV
• -lbl supplies the symmetry point labels for the end points. (You could specify them explicitly, e.g. -lbl=L,G,X,W,G, but they are already supplied in bnds.si, and you don’t need to.)

The fplot command creates a postscript file for the band structure, reading script plot.plbnds generated by plbnds. It generates fplot.ps. Open this file with a document viewer of your choice, e.g. gs fplot.ps.

You can see that silicon has an indirect band gap of around 0.55 eV (the experimental gap is about 1.2 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 position matching closely the known value.

### 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.

1) Elucidating orbital character : drawing bands with color weights

In the above tutorial, bands were calculated and the k points and energies were recorded in bnds.si. In addition, it is possible to generate orbital character weights (based on a Mulliken decomposition) together with the levels themselves. The weights can be used with a graphics package to draw bands with continuously varying color. To demonstrate the color weights feature, this exercise draws the Si bands with blue, green, and red associated with s, p, d character. 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). Modify the --band switch as follows (see documentation)

lmf si --band~scol@z=14@l=0~scol2@z=14@l=1~scol3@z=14@l=2~fn=syml


The first weight is assigned to all orbitals associated with a site of atomic number 14, and $\ell{=}0$; the second $\ell{=}1$, the third $\ell{=}2$.

Before generating the bands, lmf prints out a table like this one:

      4 components, color 1:  1,10,14,23
12 components, color 2:  2:4,11:13,15:17,24:26
10 components, color 3:  5:9,18:22


It says the system has four orbitals of s character, 12 of p character, 10 of d character (see below).

plbnds is run similarly as before, but with an extra switch specifying the colors associated with the first, second and third weights. Bands are drawn over a wider window to highlight the orbital character.

plbnds -range=-12,6 -fplot -ef=0 -scl=13.6 -lt=1,bold=3,col=0,0,0,colw=0,0,1,colw2=0,1,0,colw3=1,0,0 -lbl bnds.si
fplot -f plot.plbnds


The color weights are specified in RGB notation following col, colw, colw2 and colw3. Weights for the s, p, d character are blue indicated by colw=0,0,1 green (colw2=0,1,0) and red (colw2=1,0,0). col=0,0,0 specifies that character of all other orbitals is black.

This figure elucidates how the bottom of the valence band is composed of Si s orbitals (blue) with symmetric combination of orbitals both Si sublattices; there is a corresponding antibond where the two Si sublattices combine antisymmetrically (look for a blue band near 3.5 eV at the Γ point). Bands near the Fermi level are of p character (green), also splitting into bonding (valence bands with E<0) and antibonding levels (conduction bands with E>0). You can also see a bit of d character near X (red).

To see how the orbitals are ordered in the hamiltonian array, and which orbitals correspond to s, p, d character, run lmf with high verbosity and terminate execution after hamiltonian information is printed out (--quit=ham)

lmf si --quit=ham --pr50


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)


Orbitals 1:13 belong to the first Si atom, 14:26 to the second. The four s orbitals are in columns 1,10,14,23; the twelve p in columns 2:4,11:13,15:17,24:26; the ten p in columns 5:9,18:22. We could have equivalently run lmf this way:

 lmf si --rs=1,0 -vnit=1 --band~fn=syml~col=1,10,14,23~col2=2:4,11:13,15:17,24:26~col3=5:9,18:22


The bnds file should be the same. This way of specifying is more cumbersome, but it is completely flexible (which is sometimes needed.) The header contains information about how the weights were generated (this information isn’t used anywhere)

26   0.16102     3  lbl=LGXWGK col1=1,10,14,23 col2=2:4,11:13,15:17,24:26 col3=5:9,18:22