Humboldt-Universität zu Berlin - Faculty of Mathematics and Natural Sciences - Strukturforschung / Elektronenmikroskopie

QSTEM: Quantitative TEM/STEM Simulations



  • If you have read this page before and just want the newest version, you may go directly to the download page.
  • If you are looking for presentations or tutorials about qstem, you may directly to this documentation page, or browse the qstem FAQ list.
  • Jacob Madsen (DTU) has recently also created an open source python library based on qstem: pyqstem 

This site contains a suite of programs intended for quantitative simulations of TEM and STEM images. The qstem package come the contains the following tools:

  • QSTEM: a code for simulating TEM and STEM images
  • ImageSim: although integral part of QSTEM, this program can also be called independently and may be used to apply various aberrations to complex-valued wave functions. These wave functions can be the result of a QSTEM simulation or a focal series reconstruction.
  • ShowImage: a simple tool for displaying .img images.


  • QMB: the QSTEM Model Builder. This GUI-based tool lets you build super structures containing arbitrarily many crystalline grains. It also lets you load images (.dm3, .img, .tif, .jpg, etc.) and build the atomic model to match the atomic columns in the image.
  • Convert2CFG: this little tool converts crystal structure data in .xtl or .xyz format to the .cfg format that can be read by qstem and the other tools.
  • VirtualGoniometer: a tool for converting unit cell parameters to the structure matrix and then finding the required tilt angles to tilt to a specific zone axis.
  • GBMaker: a command line tool for constructing arbitrary super structure containing crystalline and amorphous phases.




QSTEM was initially written to do HAADF-/ADF-/ABF-STEM simulations, but also offers the possibility to do TEM and CBED calculations, all using the multislice algorithm. Much of how the STEM simulation works, and the particular strengths of the simulation software provided on this website is described in my PhD thesis. STEM simulations are inherently slow. With the fast increase in computer speed that we experience today, it was not my aim to make this code as fast as possible (to my shame: Although I’ve tried to be efficient [i.e. the code uses fftw routines] I have not even attempted to parallelize this code, which would, in principle, be very straight forward to do). However, one can prepare several simulations, save the configurations files and then run them all in parallel (or even better: on separate PCs) over night, all from the graphical user interface (GUI).

Here is a list of features that I paid particular attention to when designing this software:

  1. Potential slicing should work for arbitrary samples (e.g. interfaces, defects, not just perfect crystals in zone axis).
  2. It should be possible to compute images for arbitrary orientations, not just low-index zone axes of single crystals.
  3. Atomic scattering factors should be accurate up to the large angles needed for STEM simulations.
  4. The simulation should be quantitative.
  5. Accuracy over speed, but still try to be as fast as possible.
  6. Allow very large simulations to be run on any computer.

For those interested in using this software, there is a short introduction and a tutorial on running the GUI. This tutorial describes mainly how to simulate STEM images. For TEM images you should turn off TDS when simulating electron exit face wabe functions and use the ImageSim tool to compute images, focal series, or thickness-defocus maps (see this tutorial).

Since this code was originally intended for the simulation of STEM images of large super-cells (e.g. dislocations, interfaces) I decided to use a simple version of the .cfg format as it is used by the AtomEye atomistic configuration viewing program for defining unit cell and super-cell atom positions. The software recognizes no other format at the moment, but I may find some time in the future to add support for further file formats as well.

Images generated by QSTEM will be in a non-standard format. They can be displayed using the showimage tool that comes with the zip-archive below. They can also be imported into Gatan Digitalmicrograph using the script readImg.s.

In case any publications result from simulations done using this software, I ask for a reference to my dissertation, until we find time to put all this into a regular publication.

You may also find a documentation of the input (*.cfg) and output (*.img) data formats here.

Download & Installation

You can download everything you need to run qstem here.


Source Code

Thanks to Michael Sarahan formerly at the SuperSTEM in Daresbury, UK, you may also obtain the source code for this project. It is hosted on

A Linux version of stem3 can be compiled from that, and a parallel version of stem3 will soon be available as well.

Please make sure to update your source code if you have a version prior to March 2012 since it now includes some important bug-fixes.