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


Here you can download the qstem software for different TEM/STEM/Diffraction simulations

Current version:


  • qstem2.51_Win64_setup.exe [May 11, 2018] (6.4 MB): This self-installing package contains the programs qstem.exe, stem3.exe, gbmaker.exe, qmb.exe, convert2cfg.exe, virtualGoniometer.exe, showImage.exe, and imageSim.exe, qeda_gui.exe, und qeda.exe.
  • Matlab Component Runtime Library (64-bit, V7.13) (423 MB): You only need to install this once if you plan to run qstem V2.20 or higher.  This means you also have to install this if you are upgrading from qstem V2.16.
  • MSVCR100.dll: In case you encounter a problem reading the atomic configuration related to the *.mexw64 function, you may need to install this dll to your system32 folder.


  • qstem2.30_Win32_setup.exe [October 13, 2015] (3.9 MB): This self-installing package contains the programs qstem.exe, stem3.exe, gbmaker.exe, qmb.exe, convert2cfg.exe, virtualGoniometer.exe, showImage.exe, and imageSim.exe.
  • Matlab Component Runtime Library (32-bit, V7.13) (457 MB): You only need to install this once if you plan to run qstem V2.20 or higher.  This means you also have to install this if you are upgrading from qstem V2.16.
  • MSVCR100.dll: In case you encounter a problem reading the atomic configuration related to the *.mexw32 function, you may need to install this dll to your system32 folder.

Examples and supporting DM scripts:

  • In case the examples folder did not get properly installed on your system you can also download the content of that folder separately.
  • Contains a few DigitalMicrograph (Gatan Inc.) scripts for reading images and wave functions generated by qstem or imageSim, and also for assembling thickness-defocus maps from individually simulated images.

What you are downloading:

(If you ended up on this page before reading the qstem main page you should go there first.)
The graphical user interfaces of qstem, qmb, showimage, imageSim, etc. are written in Matlab and have been compiled as a standalone application. They need, however, the Matlab runtime component library of Matlab to be installed (see installation step 1). The actual simulation code “stem3.exe” is written in C and may also be called by itself from the command line. The FFT routines contained in fftw.dll are compiled from the source code provided at and must be in the same folder as “stem3.exe” for the simulations to work.


  1. If you have not done so yet install the appropriate Matlab Runtime Component library MCRInstaller.exe (can be run directly from the link provided above).
  2. Run the qstem installation package provided above to install qstem on your Windows system. If you decided to install qstem into the ‘Programs Folder’ on a Windows system with user access control (UAC) [e.g. Vista, Windows 7] please note the following: For Versions prior to 2.20 it is important that you execute the programs qstem, qmb, imageSim, virtualGoniometer, convert2cfg, and showimage at the end of the installation because the first time these codes are run they must be run with administrative privileges in order to properly unpack the ctf archives generated by the Matlab compiler into the Programs folder. The easiest way to do this is by simply keeping the checkboxes on the last page of the installation GUI checked.
  3. In case you did a proper installation using qstem_setup.exe you can now double click any .cfg file or .qsc file in the Examples folder to get started.
  4. Please note that on Windows 7 the GUI will not be displayed properly for versions < 2.20.  Setting the program’s (i.e. qstem.exe, imageSim.exe, and showimage.exe) properties to “Windows Vista service pack 2″ compatibility in the [right-click–>properties–>compatibility] tab will fix this problem (thanks to Christopher Winkler from Drexel University).
  5. In case you have a problem running the stem simulation (executing stem3.exe) or the super-cell creator gbmaker.exe you may be missing some essential runtime libraries which you can install from this (Microsoft) website.
  6. Note that, because of UAC, qstem will automatically set the working folder of the installed programs to your local AppData folder.  This is also the directory where the provided Examples are stored.  If you want to change this you have to adjust the working directory of all the installed programs individually.

Source Code

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

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

Old Versions

  • qstem2.40_Win64_setup.exe [October 3, 2016] (4.7 MB): This self-installing package contains the programs qstem.exe, stem3.exe, gbmaker.exe, qmb.exe, convert2cfg.exe, virtualGoniometer.exe, showImage.exe, and imageSim.exe.

Progress log

Version 2.50, posted October 19, 2017

  • Fixed a bug regarding wrong temperature scaling (used to be factor 3 too low)
  • Added QEDA, a GUI for doing Bloch wave simulations of CBED, LARBED, PED, and SAD patterns of crystal structures in .cfg format.

Version 2.31, posted November 20, 2015

  • This version contains a small bug fix in how the CFG files are read in. Please update to this version from 2.30 if you have trouble loading .cfg files into qstem.

Version 2.30, posted October 13, 2015

  • This version includes some of the very nice improvements to qmb, showimage, and convert2cfg made by Robert McLeod from.
  • ImageSim now also lets you define isotropic and anisotropic vibrations of the sample (e.g. a nanotube vibrating predominantly perpendicular to its axis), resulting in a corresponding image blur.

Version 2.22, posted September 11, 2012

  • Fixed a number of bugs there crept in because of updating to a more recent version of Matlab.
  • Improved qmb.exe.  It is now possible to also warp atom positions smoothly (e.g. for generating strained structures or dislocations).
  • Also improved convert2cfg.exe

Version 2.20, posted August 17, 2012

  • Fixed a small scaling problem in the scattering factors
  • Compiled GUIs using a new Matlab verision (R2011b).  This now avoids problems with the GUIs crashing when closing the program.  Also, the GUI elements should now display properly on Windows 7, without having to manual set the Windows Vista SP2 compatibility.

Version 2.16, posted March 7, 2012

  • convert2cfg has been improved significantly for converting .xyz files to the .cfg format.
  • stem3.exe has now become much faster on 32-bit multi-processor systems. A dedicated 64-bit version will follow soon.
  • The source code on bitbucket has now been updated to this version.

Version 2.15, posted November 22, 2011:

  • imageSim has been extended quite a bit. It is now possible to include vibrations of the sample as a whole, i.e. the final image can be convoluted by an elliptical Gaussian with freely adjustable short and long axis as well as orientation of the Gaussian.
  • imageSim now also includes ALL aberration coefficients (via ‘higher orders’ button) up to 5th order and also computes the partial spatial coherence envelope accordingly (still within the quasi-coherent approximation though).
  • stem3 now saves the high voltage and imaging parameters (cs, df, coma, astigmatism, alpha, Delta) with the wave functions, and these values will be automatically filled in when running imageSim.

Version 2.14, posted August 31, 2011:

  • The beam tilt along the y-direction did not work properly. This has now been fixed. However, the ’tilt back’ option (cancels the beam tilt just below the sample, still before the objective lens) is not complete yet.
  • In qmb the selection of atomic columns for moving or deleting has become more comfortable. One can also just click anywhere in the figure in order to ‘forget’ the selection.
  • In ImageSim the beam tilt now does what it is supposed to do.

Version 2.13, posted July 16, 2011:

  • Ruben Bjorge from NTNU in Trondheim, Norway, has discovered a bug in the scaling of the 3D scattering potential. This bug has now been fixed.
  • Also, thanks to Li Chang from National Chiao Tung University in Hsinchu, Taiwan I was able to fix another bug which was related to inconsistent rotation between the GUI and stem3.exe of non-cubic unit cells in box mode.

Version 2.12, posted May 11, 2011:

  • Fixed a memory leak in stem3.exe (thanks to Michael Sarahan for discovering it!!!)
  • Increased the speed of model building with qmb by more than an order of magnitude.

Version 2.11, posted May 5, 2011:

  • Fixed a bug in the GUI that occurred when loading non-orthogonal unit cells
  • Improved 3D display in qstem: the unit cell boundaries are now shown in the proper position.

Version 2.10, posted April 28, 2011:

  • Added qmb (QSTEM Model Builder) to the qstem suite. This code lets you easily build super structures containing arbitrarily many different crystal structures and orientations. If you already have an image you can build the model to match the atomic column positions of the image.
  • Added convert2cfg to the qstem suite. This code lets you convert .xtl files, or .xyz files to the .cfg format.
  • Added virtualGoniometer to the qstem suite. This code lets you construct the structure matrix from unit cell angles and vector lengths. It also gives you the rotation angles for arbitrary zone axes.
  • Added a feature to automatically determine the rotation angles to tilt to a specific zone axis to qstem.
  • The 3D view in qstem now includes different colors for different atoms.
  • Added a sanity check whether TDS is accidentally turned on when doing TEM simulations.
  • Updated the user manual (finally).

Version 2.08, posted March 31, 2011:

  • Fixed a bug in stem3.exe: The displacement of atoms when simulating TDS was not correct for non-standard unit cell definitions. This has been fixed now.
  • I have also included a feature to export the current atomic structure in the .cfg format at each TDS iteration. This is achieved by manually editing the .qsc file and inserting the line ‘CFG-file: configdump.cfg’, where configdump.cfg can be replaced by any filename, of course (the ending .cfg will be appended if it is not provided, and there will also be the number of the tds iteration appended to the file name).
  • The energy spread was not correctly considered inSTEM simulations. This has now been fixed.

Version 2.07, posted Nov 26, 2010:

  • Fixed a bug in stem3.exe: The super cell is now rotated correctly in NCell mode. It was done correctly in the GUI but in the actual calculation the super cell would be shifted from where it appeared in the GUI.

Version 2.06, posted Oct 5, 2010:

  • Fixed a bug in stem3.exe: The super cell is now constructed correctly in box mode even when TDS is turned off (this was a bug introduced with version 2.03).

Version 2.05, posted Sept 8, 2010:

  • Changed compiler options of gbmaker to be the same as for stem3 to make it work even better under some Windows XP systems.
  • Fixed a problem with super cell re-centering when tilting in Ncell mode.

Version 2.04, posted Sept 7, 2010:

  • gbmaker now uses statically linked libraries instead of dynamical ones. It should now work better under Windows XP.

Version 2.03, posted Aug 21, 2010:

  • Fixed a memory leak in stem3.exe. This seems to have caused a crash when setting up alloy configurations with multiple atoms on a single site (to let the code decide randomly which one to pick).
  • Now no atoms will be removed anymore from the super-cell in box-mode by TDS displacements.
  • There were some problems with the alloy creation when TDS was turned on. These problems have been fixed now. Please do not use previous versions of qstem if you are working with alloys (more than 1 atom per site) or vacancies (partial occupancies).

Version 2.02, posted July 12, 2010:

  • Fixed a bug in stem3.exe in coherent CBED mode. Waves may now be written to disc even if the model contains multiple slabs.

Version 2.01, posted July 7, 2010:

  • Display of model is now drastically faster. This is important for bigger models.
  • It is now possible to easily simulate random alloys: simply define 2 atoms at the same atom position (or within less than 0.1 A of eachother). The probability that the site is occupied by one or the other atom is defined by the relative occupancy (see for example  alloyTestCell.cfg). The random alloy is not created inside the GUI, but during the actual calculation.
  • You can now also create random alloy super cells using ‘gbmaker.exe’ (e.g.alloyTestSuperCellGenerator.gbm). The atomic distribution is then fixed. [‘ModelBuilder’, a GUI for building big super structures is almost ready and will included in the next major version.]

Version 2.00, posted June 29, 2010:

  • Includes option for computing CBED patterns and save the wave function for intermediate specimen thicknesses.
  • Greatly enhanced user-friendliness (e.g. double click files in explorer starts qstem (.cfg or .qsc files) or showimage (.img files), qstem now remembers the folders you have worked with, making saving and opening different files much easier, etc.).
  • Showimage has been extended by a few features (e.g. surface plots and color).
  • Showimage can now compute quantitative STEM images (with absolute counts) based on source brightness, convergence angle, dwell time and effective source size. It can also include Poissonian noise in the STEM images, based on the absolute counts.
  • A few bugs (all I could remember) in stem3.exe have been removed.

Version 1.20, posted April 12, 2010:

  • Fixed a bug in the TEM simulation code stem3.exe regarding slicing.
  • The code also lets you know now when you try to use too much memory. This probably eliminates a lot of unclear ‘crashes’.

Version 1.10, posted Oct 5, 2009:

  • Fixed a bug in the TEM simulation code stem3.exe. It now does not crash anymore of you run simulations in box-mode and TDS turned on.

Version 1.09, posted Feb 17, 2009:

  • Fixed a bug in qstem GUI. Simulations with unequal number of pixels in x- and y-direction are treated correctly now.
  • Fixed bug in imageSim, which would display images of unequal edge length improperly.
  • Included zoom feature in showImage.
  • Fixed improper wave function indexing in TEM simulation code stem3.exe in case of multiple sub-slabs.

Version 1.07, posted September 11, 2008:

  • Improved imageSim (for simulating TEM images from wave functions):
    • Window is now resizable, added toolbar to window.
    • Once the user has zoomed into an image, diffraction pattern, or wave function, the zoom seting will be kept when the image is recomputed.
    • The thickness is now displayed correctly (was shown factor 10 too thick before)
    • Thickness defocus maps are now easier to compute, the sequence in which the files are selected does not matter anymore.
  • Included DM script ThicknessDefocusMap.s for loading thickness and defocus image series as a map into DM.
  • Included DM script ThicknessDefocusMapTDS.s for loading thickness and defocus TEM image series including TDS as a map into DM.

Version 1.03, posted March 3, 2008:

  • Added TEM simulation capabilities. I will add documentation for TEM simulations at a later time, but one can start playing around with it already.