# The plbnds utility

### Purpose

plbnds is designed to generate data to make figures of energy bands along a specified symmetry lines. Questaal codes generate energy bands when the --band command-line argument is invoked, in the (default) symmetry line mode. Usually Questaal codes write bands to bnds.ext. This page contains files for symmetry lines for any crystal structure here

plbnds can make postscript files directly, but this tool is is mostly used to set up render bnds.ext into files with a simple, easy-to-read format. plbnds also makes a script for the fplot graphics tool that will make the postscript file. You can tailor the figure by editing the script file; alternatively the simple data format is suitable for use by any graphics package.

### Preliminaries

Executables plbnds and fplot are required and are assumed to be in your path. You will also need a postscript viewer. This document assumes you are using the generic apple-style open command to view postscript files.

### 1. Introduction

Energy bands provide a great deal of information, and the Questaal codes provide a fair amount of flexibility in generating them. Drawing bands with color weights is a particularly useful feature, as shown in Section 2.

Questaal lmf, lm, and tbe can generate energy bands along symmetry lines you specify. They share a common input and output format. You must choose the symmetry lines yourself, but prepackaged symmetry line files are available that greatly facilitate the selection and labelling of lines. Bands are written to file bnds.ext, or bbnds.ext if --band~bin is used. This file is not written in a friendly format; but it is often the case that you need only a subset of the bands or to provide extra information such as data for color weights.

plbnds may be used to make postscript files of bands directly, without other software. It is quick and dirty, andthere is no easy way to modify the figure.

Alternatively plbnds can efficiently convert data in bnds.ext to a simpler format. In this mode (plbnds --fplot), data in bnds.ext is converted to a friendly format useful for a variety of circumstances. A separate file bndn.ext is created for each panel, one panel per symmetry line. bndn.ext is tailored to how many bands are in an energy window of interest, whether color weights are present, and so on. Together with the data files, a script plot.plbnds is automatically created designed for fplot. You can use fplot directly to make the figure, or make it with your favorite graphics package.

plbnds will provide a synopsis of its usage by typing

$open fplot.ps  Notes: • The energy bands are plotted in an energy window -0.8,0.6 Ry, in 5 panels. • Arguments 10,15 specify the width and height of the entire figure (in cm, approximately). • The symmetry labels M, Γ, A, L, Γ, K, were extracted from -lbl=M,G,A,L,G,K. (G is turned into Γ.) • Energy bands are in Ry. • The Fermi level is drawn as a dashed line at -0.02136 Ry. • Bands are plotted as fat dots at the points where they are generated. • It is easy to distinguish the dense tangle of flat d bands approximately between -0.3 and +0.1 Ry. The sp bands are highly dispersive and approximately quadratic; see Example 3 for more details. ##### Example 2 For a better and more modifiable figure, run plbnds again with: $ echo -10,8 / | plbnds -fplot -ef=0 -scl=13.6 -nocol -lbl=M,G,A,L,G,K bnds.co


 plbnds : bands file contains two sets of color weights
plbnds: 36 bands  fermi=-0.02136  scaled by 13.6  shifted to 0
panel 1  nq=25  ebot=-9.232224  etop=33.866176  delta q=0.577353
panel 2  nq=21  ebot=-9.232224  etop=33.235136  delta q=0.30619
panel 3  nq=41  ebot=-7.005904  etop=29.214976  delta q=0.57735
panel 4  nq=45  ebot=-9.232224  etop=33.503056  delta q=0.653518
panel 5  nq=41  ebot=-9.232224  etop=33.603696  delta q=0.666665
nq=173  npan=5  emin=-9.232224  ef=0  emax=33.866176  sum dq=2.781075
emin, emax, width(cm), height(cm) ?
write file bnd1.dat, bands 1 - 26
write file bnd2.dat, bands 1 - 26
write file bnd3.dat, bands 1 - 26
write file bnd4.dat, bands 1 - 26
write file bnd5.dat, bands 1 - 26
... to plot, invoke:
fplot -disp -f plot.plbnds


The new switches indicate the following:

• -fplot tells plbnds to generate data files for each of the five panels, and also a script for the fplot tool.
The fplot script is written to a file, plot.plbnds.
The five panels are written to files (bnd[1-5].dat) (see standard output). They take a standard Questaal format, which is easily read by other packages.
The first column is a fractional distance along the symmetry line (0 for starting point, 1 for ending point).
The remaining 26 columns comprise energy bands in the window (-10,8) eV.
• -ef=0 tells plbnds to shift the bands by a constant so the Fermi energy falls at 0.
Note: in an infinite periodic system the energy zero is ill defined; it can be chosen arbitrarily.
• -scl=13.6 scales the energy bands by this factor, converting the raw bands (in Ry) to eV.
• -nocol tells plbnds to ignore information about color weights.

The energy window is now -10,8 eV. The last two arguments from stdin (formerly 10,15) are not used in this mode since plbnds makes no figure.

Make and view a postscript file with

$fplot -f plot.plbnds$ open fplot.ps


This figure is much closer to publication quality. You can of course customize the figure by editing plot.plbnds. To interpret and customize the script, see the fplot manual.

##### Example 3

This example illustrates a very useful feature of the Questaal band plotting capabilities. It uses two color weights to distinguish spin-up and spin-down bands. The first color selects out the majority bands of d character, the second the minority d bands.

Consider orbital component i of band n. Its wave function has eigenvector element zin. The wave function is normalized, and so

The sum runs over all of the orbitals in the basis. By “decomposing the norm” of z, that is summing over a subset of orbitals i, the result is less than unity and is a measure of the contribution of that subset to the unit norm. Note: this decomposition is essentially a Mulliken analysis.

We will simply take bnds.co as given (it is generated from one of the validation scripts in the Questaal source directory).

$cp ~/lm/fp/test/bnds.co .  The structure of the bnds file is documented on this page. bnds.co was generated with two color weights, as can be seen from the first line of the file  36 -0.02136 2 col= 5:9,14:18 col2= 23:27,32:36  All d orbitals in the Co majority spin channel are combined for the first weight, and the corresponding d orbitals in the Co minority channel the second. Thus, the first color weight is zero if there is no projection of the eigenfunction onto majority d channel, and 1 if the entire eigenfunction is of majority d character. The same applies for the second weight, but for the minority d channel. Assuming your source directory is ~/lm, you can create the bands yourself running this script: $ ~/lm/fp/test/test.fp co 1


The script runs lmf as:

$lmf co -vmet=4 -vlmf=1 -vnk=8 -vnit=10 --pr31,20 --no-iactiv -vso=t --band~col=5:9,dup=9~col2=18+5:18+9,dup=9~fn=syml  -vmet=4 -vlmf=1 -vnk=8 -vnit=10 assign algebraic variables which will modify ctrl.co when run through the preprocessor. They are of secondary interest here. -vso=t does the same, but it is important in this context because the input file contains the following: HAM ... SO={so}  -vso=t sets variable so to true (or 1). The proprocessor transforms SO={so} into SO=1. Token SO controls spin orbit coupling. --band~col=5:9,dup=9~col2=18+5:18+9,dup=9~fn=syml tells lmf to draw energy bands with two color weights (col=.. and col2=..) Orbitals 5-9 comprise the majority spin d orbitals of the first atom, 14-8 those of the second. (In this test, there is only one Hankel function per L per atom.) How the orbitals are ordered within the hamiltonian can be seen by running lmf with high verbosity, viz: $ lmf   co -vmet=4 -vlmf=1 -vnk=8 -vnit=10 --pr55 --quit=ham


The standard output should display a table like this:

 Site  Spec  Total    By l ...
1   A    1:9    1:1(s)   2:4(p)   5:9(d)
2   A   10:18   10:10(s) 11:13(p) 14:18(d)


Co d orbitals then occupy positions 5:9 for the first atom, and 14:18 for the second. dup=9 replicates whateve list exists up to that point, adding 9 to each element in the list. Thus col=5:9,dup=9 pick up all the Co d orbitals of the first spin. The syntax for integer lists is explained here.

Spin orbit coupling is included, so the hamiltonian has twice the rank of a single spin: it is doubled into a 2×2 supermatrix with spin 1 orbitals occuring first and spin 2 orbitals following. To get the rank of the hamiltonian for one spin, look for Makidx in the standard output:

lmf   co -vmet=4 -vlmf=1 -vnk=8 -vnit=10 --pr55 --quit=ham | grep Makidx


It says that there are 18 orbitals (this is also apparent from the table above: the last orbital is 18). Minority spin orbitals are ordered in the same way as the majority spin, but staggered by 18: col2=18+5:18+9,dup=9 then picks up all the Co d states of the second spin.

Run plbnds as follows

$echo -10,8 / | plbnds -fplot -ef=0 -scl=13.6 -lt=1,bold=3,col=0,0,0,colw=.7,0,0,colw2=0,.7,0 -lbl=M,G,A,L,G,K bnds.co  This is similar to Example 2 except -nocol is not used and line types are added. The line type specifes a solid line (-lt=1), the line thickness (bold=3); the default line color (col=0,0,0) which is the color when the first and second weights vanish; colors of the first weight (colw=.7,0,0) and second weight colw2=0,.7,0), respectively. The three numbers correspond to fractions of (red, green, blue). Thus, if a band has no d character it will be black; it will be red with 100% majority d character and green with 100% minority d character. plbnds will generate a file bnd1.dat for the first panel, bnd2.dat for the second, and so on. Use your favorite graphics package to draw the figure, or use the fplot with a ready-made script generated by plbnds $ fplot -f plot.plbnds
$open fplot.ps  Colors provide an extremely helpful guide to interpret the bands. It shows clearly which bands have majority and minority d character. Your postscript file should look like the figure below. Notes: • The highly dispersive band between Γ and A in the window (-2,0) eV, is black, indicating its sp character. The band continues on Γ-M line to positive energy. You can also see traces of it on the Γ-K line, starting at Γ near -0.5 eV, The bottom of the band starts occurs around -9 eV at Γ. • The majority and minority d bands are quite distinct. This means that sz is almost a good quantum number. In the absence of spin-orbit coupling it is a good quantum number. If spin-orbit coupling significantly admixes ↑ and ↓ character, red and green would bleed together, which would appear as yellow. • The majority and minority d bands are approximately the same shape, but split by about 1.6 eV. It is known that the spin part of potential is similar for all the d orbitals. The bands are spin split by an approximately constant value of I×M, where I and M are respectively the Stoner parameter and the magnetic moment. In 3d transition metals Cr, Mn, Fe, Co and Ni, I is close to 1 eV. Also for Co, M=1.6 μB. ### 3. plbnds manual Invoke plbnds in one of the following ways: plbnds [-switches] filename echo emin, emax, w, h | plbnds [-switches] filename  filename is the file name (bnds.co in this case). You can also use just the extension (co). plbnds reads four numbers from stdin: emin, emax, width(cm), height(cm) emin and emax comprise the lower and upper bounds of figure. Data is written only for bands that fall in this range. The third and fourth arguments determine the size of the figure; they are used only when plbnds makes a postscript file directly (Example 1). Optional switches perform the following functions. A reference to expr indicates a real number or an algebraic expression. • −help | --help | --h prints out a help message and exits. • −lbl=a,b,c,d,… a,b,c,d,… are k point (symmetry) labels at the points where panels meet. (See Example 1) For now, labels must be one character each. You should supply n+1 labels, where n is the number of panels. Note: G is turned into the Greek character Γ. • −ef=expr shifts the energy bands so that the Fermi energy lies at expr. (See Example 2) • −scl=expr scales bands by expr. (See Example 2) • −wscl=w[,h] scales the default figure size by w. w is a real number or expression. If the second argument is present the width is scaled by w, the height by h. An example can be found in this tutorial. • −tl=title Adds a title to appear at the top of the figure. • −spin1 | −spin2 plots bands of first or second spin (bnds.ext must contain data for two spins). • −skip=lst skip panels in list, e.g. −skip=1,3. This page documents integer list syntax. • −col3:bnds2,fnout merges the color weights in bnds.ext and bnds2 into file fnout (fnout and bnds2 refer to the full file name). The Questaal codes are equipped to generate energy bands with only one or two color weights; however plbnds and fplot has the capability to manage up to three color weights. −col3 enables you to merge back-to-back band calculations with respectively two and one color weights, into a single bnds file, suitable for processsing by plbnds and fplot. • bnds.ext should contain two color weights, bnds2 one color weight. • bnds.ext and bnds2 must contain identical bands generated at the same k points. • −fplot[:s] causes plbnds to create input for fplot or another graphics package. (See Example 2.). It does the followng: 1. write energy bands to files bnd1.dat, bnd2.dat, … (one file for every panel). 2. generate a script plot.plbnds. 3. suppress directly creating a postscript file 4. −fplot:s tells plbnds that bnds.ext has two spins. It will generate bands for both spins. To draw spin1 or spin2 bands only, use −spin1 or −spin2. You can create and view a postscript figure of the bands with $ fplot -f plot.plbnds
\$ open fplot.ps


To customize the figure, edit plot.plbnds. Refer to the fplot manual to learn about the capabilities and switches in the fplot tool.
Alternatively, generate energy bands with your favorite graphics tool. bnd1.datbnd2.dat, … are in Questaal’s standard form, an easily readable format.

• −sp[~switches]  sets up plots for drawing spectral functions along symmetry lines. It:
1. reads spectral information from a file spq.ext, normally generated by lmfgws
2. creates a data file spf.ext that gnuplot reads to generate the figure.
3. creates a gnuplot script gnu.plt. Alternatively it writes spf.ext in a form that SpectralFunction.sh can read.

On exit, plbnds will print out a brief message giving you the instruction to make a postscript (or other) file.
It draws the bands in the window given by the input spq.ext; however, you can edit the gnu.plt to adjust it.

Switches: the first character after −sp (assumed to be  ’~’  here) delimits the different switches.
○ ~lst=list  specifies which bands to include in the spectral function.  See this page for the syntax of integer lists.
○ ~out=eps  |  out=svg  |  out=png  |  out=i
Specify whether gnuplot is to generate a postscript file (.eps), a Portable Networks Graphics file (.png),
or a Scalable Vector Graphics (.svg).  i = 1, 2, or 3, corresponds to these three formats.
○ ~escl=val  scales the frequency mesh by val.
○ ~window=#,#  sets the energy window for the band plot. It defaults to energy window in spf.ext.
○ ~out=lmgf  tells plbnds to format spf.ext for the SpectralFunction.sh script.
Note: If you make spectral functions with lmfgws and the output is in eV, use escl=1/13.6, since SpectralFunction.sh assumes the file is in Ry units.
○ ~ascal=val  scales the spectral function by val. Only affects the scale in the colorbar.
○ ~atop=val sets the top of the colorbar scale to val.

• −dat=ext (may be used in conjunction with −fplot)
Substitute .ext for .dat when writing data files. This is useful when merging two or more sets of bands into one figure.
• −nocol  |  --nocol (may be used in conjunction with −fplot)

• −merge=file2[,file3]  |  −mergep=file2[,file3]
merges two bands file (one for each spin in the spin-pol case).
Optional file3 causes plbnds to write the merged file to file3.
-mergep pads a file containing fewer bands so that the number of bands in the merged file is fixed.