Calculation of STM Spectra

by Christian Vorwerk for exciting carbon

Purpose: In this tutorial you will learn how to execute simulations of Scanning Tunneling Microscope (STM) images and also how to visualize the results. Both differential-conductance and constant-voltage imaging will be performed in the usual modes of operation in STM, namely, constant-height and topographic.

0. Define relevant shell variables and download scripts

Read the following paragraphs before starting with the rest of this tutorial!

Before starting, be sure that relevant shell variables are already defined as specified in How to set environment variables for tutorials scripts.

From now on the symbol $ will indicate the shell prompt.

1. Groundstate Calculations

i) Preparation of the input file

At first, we have to create a working directory. Since we are calculating the example of a W(110) surface, we create a directory called W-110-stm and move into it:

$ mkdir W-110-stm
$ cd W-110-stm

As a starting point we have to do a groundstate calculation of the W(110) surface. To this end, we will create an input file by copying the following example.

   <title>Tungsten groundstate calculation</title>
   <structure speciespath="$EXCITINGROOT/species" cartesian="true">
         <basevect> 5.9952538681 0.0000000000  0.0000000000 </basevect>
         <basevect> 2.9976269341 4.2392846651  0.0000000000 </basevect>
         <basevect> 0.0000000000 0.0000000000 27.3758289122 </basevect>
      <species chemicalSymbol="W" speciesfile="W.xml">
         <atom coord="0.000000 0.0 0.000"/>
         <atom coord="2.997627 0.0 4.239"/>
         <atom coord="0.000000 0.0 8.478"/>
      ngridk="6 6 1"
i) Running the Groundstate Calculation

Once this file is created, do not forget to replace the string $EXCITINGROOT by the actual value of the environment variable in the input.xml file. This can be done by the command


Now, you can execute the ground-state calculation with the command

$ dci

After the run is finished, the result of the calculation are stored inside the directory dci. Move to this directory, then, we use the result to proceed with the calculation of the STM images.

The reason for doing in this way is that usually a fine k-grid is needed for the generation of STM images, i.e., finer than what is needed for a reasonable convergence of groundstate properties. As you will see below, the strategy consists in performing a further one-step ground-state calculation with a fine k-grid appropiate for STM simulations, taking as starting point the potential and density from the previous calculation (that was performed using a coarser grid).

2. Performing differential-conductance imaging

Now we will perform a differential-conductance image at zero bias using the ground-state calculation that we did before.

To this end, first you have to move inside the directory dci:

$ cd dci

Then, change here the input file by adding the attributes do = "fromfile" and maxscl = "1" inside the element groundstate. We will also set a finer k-grid for the generation of the STM image ngridk = "15 15 1".

We also have to add the following block inside the input element in order to specify the parameters for the generation of the STM image:

            grid2d="40 40"/>

By setting the attribute stmtype to "differentialConductance", we will perform a differential-conductance imaging, i.e., a map of the derivative of the total tunneling current with respect to the bias potential. Strictly speaking, inside the Tersoff-Hamann approximation that we are using (see the Reference Section at the bottom of this page), a quantity proportional to this derivative is generated. By setting the bias attribute to zero, this derivative is calculated at the Fermi level.

The attribute stmmode = "constantHeight" sets the operational mode of STM to constant height, i.e., the tip of the microscope is kept at a fixed height from the sample.

Inside the stm element the region subelement is set. Through it, we indicate, by means of the attributes height and grid2d, the fixed height of the STM's tip and the real space grid for the generated two-dimensional image, respectively.

Summarizing what discussed above, the calculation of the STM spectrum is performed starting from the density and potential from the previous ground-state run. After that, in a single additional ground-state iteration, a new set of Kohn-Sham orbitals and occupations is obtained on a finer k-grid. The new added blocks contain the following information:

  • stm: Perform an STM image simulation.
  • stmtype: Set to "differentialConductance" to generate a differential-conductance image.
  • stmmode: Allows you to choose between "constantHeight" (this example) and "topographic" (see below) images.
  • region: This element is used to define the plane for the constant-height image or the region for a topographic image. The attribute height sets the height (z-coordinate) of the STM tip, measured from the origin of the unit cell. The attribute grid2D serves to set the real-space two-dimensional grid for a constant-height image.

Once everything is set as explained above, we run exciting again:

$ time excitingser &

To visualize the result use the script This script accepts several command-line arguments. One of them is -mode. We set it to either 1, to visualize constant-height two-dimensional images, or 2, for the visualization of three-dimensional topographic images. Another command-line argument is -tile n1 n2, where n1 and n2 must be replaced by integers indicating the repetition of the unit cell along the first and second unit cell vectors (this argument is only used when -mode is set to 1. The argument -skip n allows for a faster visualization by skipping points of the grid by reading the data in steps of n points. For instance, for generating 2$\times$2=4 unit cells skipping every second step, to make the grid coarser, we can use the command

$ -mode 1 -tile 2 2 -skip 1
As a result of the command an image like the following will appear on the screen.
Note on differential-conductance imaging

In differential-conductance imaging the density is calculated in a very small energy interval. This requires high accuracy in the choice of the values for ngridk.

3. Performing constant-voltage imaging

In the element stm the attribute bias allows you to define a finite bias between tip and surface. If the attribute stmtype = "integratedLDOS" is selected, the integrated local density of states is calculated in the energy range defined by this bias. This allows for the simulation of an STM image in constant-voltage mode. For starting the new calculation, first move to the parent directory and create there a new subfolder named bdi.

$ cd ..
$ mkdir bdi
$ cd bdi

In order to avoid a second calculation of the grounds-tate properties, copy all files from the directory dci to the new directory bdi.

$ cp ../dci/* ./

Then, modify the input file by setting the attributes bias = "0.0514" and stmtype = "integratedLDOS" inside the stm element. Furthermore, set the attribute rgkmax = 5.0 in the element groundstate. This will, analogously to the calculation in the second paragraph, recalculate eigenvalues and eigenfunctions on a finer k-grid. Using the modified input file, we can generate a constant-voltage image for an energy window of 1.4 eV at a height of 2 Angstrom. To do that, run again exciting:

$ time excitingser &

The output can be visualized with the command

$ -mode 1 -tile 2 2
Reversal bias

For the system we are considering in this example, you can also investigate the influence of the sign of the applied energy bias on the STM image. The W(100) surface shows a corrugation reversal between 1.4 and -1.4 eV. To show this result, we perform a new calculation with the attribute bias = "-0.05145" in a new directory. Use the following command for the preparation

$ cd ..
$ mkdir bdi2
$ cp bdi/* ./bdi2
$ cd bdi2

After changing the input file, run the calculation

$ time excitingser &

and use the same command as before to visualize the result.

$ -mode 1 -tile 2 2


3.Topographic imaging

For both types of STM imaging (differential-conductance and constant-voltage) topographic images are possible. In this mode of operation the height of the STM tip is varied in order to keep the differential-conductance or total current fixed. In the following we perform a differential-conductance image in the topographic mode. Create a new directory and copy the ground-state results from one of the older calculations using:

$ cd ..
$ mkdir topo
$ cp ./dci/* ./topo
$ cd topo

Change the input file to perform a topographic image. Now, the properties part of the input file should contain the following block:

      <stm  stmmode="topographic">
            zrange="8.5 15.0" 
            grid3d="20 20 20"/>

In this case, the region element contains the attribute zrange, defining the minimum and maximum z-coordinate for the sampling of the desired property. After you run the calculation you can visualize the results by typing -mode 2
This will generate a visualization of the isosurfaces using XCrysDen. You can change the isovalue and use the various settings of the XCrysDen visualization program. An image with an isovalue of 0.0027 should look similar to the following image:



  • Dawn A. Bonnell, Scanning Tunneling Microscopy and Spectroscopy (VCH Publishers, Inc. 1993)
  • J. Tersoff and D.R. Hamann, Phys. Rev. B 31, 805 (1985)
  • S. Heinze, S. Bl├╝gel, R. Pascal, M. Bode, and R. Wiesendanger, Phys. Rev. B 58, 16432 (1998)

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License