Purpose: This tutorial gives a basic introduction into electronic-structure calculations. It explains how to set up and execute a simple exciting calculation, using elemental Ag as example. It is described how to prepare the input, how to run the calculation, and how to analyze the output. In addition, it is shown how basic properties like the density of states and the band structure can be calculated.
Table of Contents
0. General preparation
Define relevant environment variables
Read the following paragraph before starting with the rest of this tutorial!
Before starting, be sure that the relevant shell variables are defined as specified in How to set environment variables for tutorials scripts.
From now on the symbol $ will indicate the shell prompt.
Units in exciting
By default, all quantities in the exciting code are given in atomic units: Energies in Hartree, lengths in Bohr, etc. (see Input Reference). In case other units are desirable, they can be converted using templates as a post-processing to exciting's standard output.
1. Electronic structure of silver: Groundstate calculation
The first step of any density-functional calculation is the determination of the groundstate total energy and electron density.
The starting point of a groundstate calculation is the crystal structure, only. At the beginning of a groundstate calculation, an initial electron density is generated, which is obtained from a superposition of atomic densities. Thus, this initial electron density lacks of the interaction between atoms and is normally a rather crude approximation of the density.
Then, the calculation iteratively goes through the following steps:
- Determine the potential from the electron density.
- Solve the Kohn-Sham (KS) equations to get the eigenfunctions and eigenvalues as well as the total energy.
- Calculate the electron density from the KS eigenfunctions.
- Create a new charge density, mixing the electron density from the current iteration with the ones of previous iteration (to ensure a good convergence behavior).
- Start again with (1).
Such a sequence of steps is usually called an iteration. The code will repeat such iterations, until the potential (or total energy, or charge density, …) obtained at the end of the last iteration is consistent with the one of the previous iteration. Thus, this kind of calculations is often called self-consistent field (SCF) calculation, and an iteration is often referred to as an SCF cycle.
To prepare your calculation, create a new, empty directory named Ag somewhere on your filesystem.
$ mkdir Ag $ cd Ag
In this directory, save the following lines as input.xml.
<input> <title>Ag</title> <structure speciespath="$EXCITINGROOT/species"> <crystal scale="7.7201"> <basevect>0.5 0.5 0.0</basevect> <basevect>0.5 0.0 0.5</basevect> <basevect>0.0 0.5 0.5</basevect> </crystal> <species speciesfile="Ag.xml" chemicalSymbol="Ag"> <atom coord="0.0 0.0 0.0" /> </species> </structure> <groundstate ngridk="8 8 8" outputlevel="normal"> </groundstate> </input>
N.B.: Do not forget to replace in the input.xml the string "$EXCITINGROOT" by the actual value of the environment variable $EXCITINGROOT using the command
If the visualization program XCrySDen is set up appropriately (find here how to do this: XCrySDen Setup for exciting) you can visualize the structure in the exciting input file executing
$ xcrysden --exciting input.xml &
Executing xcrysden this way will write some (non relevant) output on the screen. If you want to skip this output use instead
$ xcrysden --exciting input.xml >/dev/null 2>&1 &
After this, start the groundstate calculation by executing the following command in the Ag directory:
$ time excitingser
The time command here will simply write on the screen the elapsed time at the end of the execution. The calculation should roughly take less than 1 minute. During the calculation, output files are created, which contain all kind of information on your material system and on the calculation. Some of the output files are already created at the beginning of the calculation and will not be changed anymore during the run. Output files created by exciting in a standard groundstate calculation are described in the next section.
2. Output files in exciting.
- The main output file in exciting is INFO.OUT. A detailed description of the content of this file can be found in How to Start an exciting Calculation.
- Other relevant files which are updated or extended at each iteration contain information about the SCF calculation:
- Output files containing structural information, symmetries, etc.:
- Output files in XML format, useful for data storage, databases, etc.
- Some of the output files are not directly readable, because they are written as binary files. They are used by exciting for current storage of vectors and matrices. They are relevant when restarting or extending an existing calculation.
With the table above, find out the following properties of your calculation — to do so, find out first in which output files they are contained:
- How many iterations did the calculation go through?
- What is the total energy for the first iteration (which started from the superposition of atomic electron densities), and of the converged calculation (last iteration)?
- What was the change in total energy between the
- first two iterations?
- last two iterations?
- What is the Fermi energy of the system?
- How many occupied valence bands are there in the system?
- How much charge is there inside the muffin-tin sphere, and how much is found in the interstitial region?
3. Electronic structure of silver: Density of states
After you have completed the groundstate run and have obtained the corresponding total energy, you can go for more properties of the system. One of the most fundamental ones is the density of states (DOS). The DOS gives you information on the energy levels in your system, or — more precisely — about how many electronic states there are at any given energy.
To calculate it, you need to do the following simple modifications in input.xml (for more details, see Input Reference):
- add the attribute do = "skip" to the element groundstate;
- add the element properties after the groundstate element;
- insert the subelement dos into the element properties;
- add the attribute nsmdos = "1" to the element dos.
The corresponding part of the input.xml should now look like this:
... <groundstate do="skip" ngridk="8 8 8"> </groundstate> <properties> <dos nsmdos="1"> </dos> </properties> ...
Then execute excitingser again on the command line:
$ time excitingser
This time, the program will produce the following files:
To visualize the DOS, execute
$ xsltproc $EXCITINGVISUAL/xmldos2grace.xsl dos.xml > Ag_dos.agr
This produces the file Ag_dos.agr for xmgrace. Open it with the command
$ xmgrace Ag_dos.agr &
You can use xmgrace to change the plot appearance in any way you want. For instance, zoom in to see details of the DOS, or produce a figure in any format you like (ps, jpg, png, etc.).
- Do the following modifications inside xmgrace (see Xmgrace: A Quickstart for help …):
- Change the x-range of the plot to [-0.4, 0.25].
- Autoscale the x axis.
- Add axes labels.
- Add a title.
- Increase the line-width of the DOS curve to 3.
- Change the colour of the DOS curve to red.
- Add a legend.
- Generate the file Ag_dos.png.
- We were using the attributes do = "skip" for the element groundstate for generating the DOS after the groundstate SCF run. Find out why, by searching for the element groundstate in Input Reference and proceeding to its attribute do.
4. Electronic structure of silver: Band structure
Now, we are ready for a more detailed view on the electronic structure: The band structure. In addition to the energy of each state, the band structure shows the dependence of the energy eigenvalues on the coordinates in k-space.
To calculate the band structure of silver, insert the subelement bandstructure in the element properties with the following specifications:
... <properties> <bandstructure> <plot1d> <path steps="100"> <point coord="0.750 0.500 0.250" label="W" /> <point coord="0.500 0.500 0.500" label="L" /> <point coord="0.000 0.000 0.000" label="GAMMA"/> <point coord="0.500 0.500 0.000" label="X" /> <point coord="0.750 0.500 0.250" label="W" /> <point coord="0.750 0.375 0.375" label="K" /> </path> </plot1d> </bandstructure> </properties> ...
As you may have realized, we have removed the subelement dos now. The new element bandstructure allows for the calculation of energy eigenvalues as a function of k. Inside this element, the subelement plot1d create a line plot where the abscissa is taken along a path consisting of straight lines joining the points defined by each element point. The coordinates of these points are given in terms of the basis vectors of the reciprocal lattice. The number of points along the full path, for which the ordinate(s) of the line plot (in this case the KS energies) are calculated, is established by the element path. Further details about the visualization of line plots can be found in How to visualize Kohn-Sham states.
Now execute excitingser again on the command line:
$ time excitingser
This makes the code produce the band structure, which is written to bandstructure.xml. To visualize the band structure, execute the following command:
$ xsltproc $EXCITINGVISUAL/xmlband2agr.xsl bandstructure.xml
Now you have produced the xmgrace file Ag_bandstructure.agr, which you can open, visualize and manipulate with xmgrace:
$ xmgrace Ag_bandstructure.agr &
- Use the Bilbao Crystallographic Server -> Space Groups Retrieval Tools -> KVEC to find out about the location of the special k-points within the Brillouin zone. The spacegroup of Ag is 225, Fm-3m. Select Choose to choose the corresponding spacegroup, and then click Brillouin zone to see the Brillouin zone with the special k-points.
- The band structure of our plot is plotted along the path W -> L -> Γ (Gamma) -> X -> W -> K. In which parts of this path do you find strong or weak dispersion, respectively? Try to explain why by using the Brillouin zone plot from above.
- In xmgrace: Use the autoscale button to see all bands. Look at the dispersion of the bands for low energies and high energies:
- What trend do you see relating the band width to the energy?
- How can you explain this trend (think about how the "dispersion" of an isolated atom would look like …)?