1. Installation

To download the Spex code, please register at https://forms.gle/Zu1QXFU94FMfmuzx9
For questions about the Spex code, write to spex-users@fz-juelich.de

1.1. Prerequisite software

For compiling the source you need:

  • a modern FORTRAN compiler,
  • the BLAS, LAPACK, FFTW, and HDF5 libraries as well as the Wannier90 library if you need maximally localized Wannier functions,
  • an implementation of the MPI-3 standard if you intend to compile the parallel version.

1.2. Compilation

Once you have obtained the code (“spexVERSION.tgz”) unpack it and change to the “spexVERSION” directory, where “VERSION” is the version number, e.g. “05.00”. There, you find a configure shell script that helps to generate a Makefile for your system. Consult the file “INSTALL” for a detailed description of the compilation process. In short, if all necessary libraries are in standard directories, ./configure and make should suffice to create working executables. Special options can be given to the configure script:

  • --enable-mpi: Build parallel version (requires an MPI-3 compiler).
  • --enable-load: Load wavefunctions from harddisc when needed, otherwise stored in memory (experimental).
  • --with-wan: Build with Wannier90 support (keywords MAXIMIZE and FROZEN require the Wannier90 library, whose location can be specified with --with-wan=DIR).
  • --with-dft=PROG: Build with an interface to the DFT program “PROG” instead of the default, which currently is Fleur MaX Release 5.1 version 34; supported interfaces are “fleur”: Fleur v0.26b (2019.03), “fleurR3”: Fleur MaX Release 3 v0.27, “fleurR5”: Fleur MaX Release 5 version 33, and “fleurR5.1”: Fleur MaX Release 5.1 version 34.
  • --prefix=PREF: Executables will be installed in directory “PREF” (/usr/local is default).

Enter ./configure -h for a full list of configuration options.


If the configuration fails, the file “config.log” should be consulted for more details about the failure. In most cases, the compiler does not find a required library or an include file, in which case the corresponding directories can be specified with the options --with-libdir and --with-includedir, respectively. Also see Section 9.1 for common problems in the configuration step.

The compilation creates the executables

for systems with inversion symmetry and without spin-orbit coupling,
for systems without inversion symmetry or with spin-orbit coupling,
data extraction utility,

The reason for having two executables, one for systems with inversion symmetry and the other for systems without, is that many quantities (such as the Coulomb matrix, the screened interaction on the imaginary axis, the exchange self-energy, etc.) can be declared in the code as real-valued instead of complex-valued arrays in the case of inversion symmetry, which speeds up the computation considerably. (The floating-point multiplication of complex numbers are about eight times slower than the multiplication of real numbers.) For the sake of code clarity, it is then advantageous to have two executables.

The user can call “spex.inv” or “spex.noinv” directly or use the Spex launcher script “spex”, which executes the proper executable according to the DFT data in the current directory.

The executables and shell scripts may be installed with make install. Installation is optional. See the file “INSTALL” for details. If the directory “PREF/bin” (see –prefix option) is in the $PATH environment variable, Spex can be called from the command line simply by “spex”.


If the executables are to be installed in a directory outside your $HOME directory tree, you might have to run the sudo command sudo make install requiring you to be in the “sudoers” list.

1.3. Upgrading

The Spex directory “spexVERSION” contains a script to upgrade Spex to the latest version. To upgrade, simply type:

$ ./upgrade

To just check if there is a newer version available, type:

$ ./upgrade --check

Upgrading requires the parent directory “spexVERSION/..” to be writable. The upgrade script creates a directory “spexNEW_VERSION” there, unpacks the new archive, configures, and compiles the source. For the configuration, the upgrade script uses the last configuration command issued for the old version (in “spexVERSION”). Note that for the last step (compilation), all modules required for compilation (if applicable) have to be loaded.

In case of failure, consult the file “upgrade.log” for more information. An error will cause the upgrade script to stop immediately. It does not undo all steps up to the point of failure. If you want to try upgrading again, you might have to remove the directory “spexNEW_VERSION” by hand (rm -r ../spexNEW_VERSION from the directory “spexVERSION”).