Skip to content

Building FHI-aims

Before doing anything with FHI-aims, the first step is to have a compiled binary for the computer on which you intend to run your simulations. If you already have access to a compiled binary, you will not need this step.

FHI-aims is distributed in source code form, not usually in binary format. The reason is that it will usually run on high-performance computers. These runs require efficient library for simple numerical tasks (e.g., linear algebra), libraries that facilitate communication using the networking layer on the computer in question, as well as binary files that are optimized for a given processor type at the compilation stage of the source code. Since the necessary libraries and compilers are usually provided along with the computer itself and they are specific to the computer, it is usually necessary to compile the code for a given computer in order to run efficiently.

This tutorial provides an introduction to the first steps of compiling FHI-aims, using a standard build system (also usually distributed with any supercomputer) called CMake. CMake is a free and open-source build system generator. CMake generates build scripts, such as makefiles, tailored to a user's environment. While CMake is designed to be cross-platform (the C stands for cross-platform), this guide focuses on supporting FHI-aims in a Linux or Unix environment.

One more note: Building any reasonably capable high-performance compute code on a new supercomputer can be tricky. This tutorial is a starting point, but we cannot predict or maintain complete FHI-aims builds on every available computing platform and computer. Similarly, we cannot generally favour specific compilers, libraries, etc. over others. More detailed information can also be found in our manual or, for certain platforms for which users are kind enough to maintain up to date configuration files, on our Wiki in the FHI-aims gitlab server.

The Objective

This tutorial aims to build FHI-aims on a given platform, making the minimum number of necessary choices (but not less) that we cannot make for you because they are platforms dependent.

The minimum choices typically include:

  • Which Fortran, C and C++ compilers you intend to use,
  • The optimization flags for each of these compilers, which can depend on the specific computer hardware.
  • The MPI library (for parallel execution), which is often already implicitly chosen through the compiler commands selected above.
  • The appropriate, optimized math library for linear algebra.
  • Additional choices can relate to libraries such as the eigenvalue solver ELPA, which is performance critical, or optional other software.
  • For accelerators (GPUs), architecture specific choices can be more complex. They are currently not covered in this tutorial but some details can be found in the manual or in our Wiki.

The goal is to streamline the compilation process as much as possible. At the end of the process, you should have a compiled, executable binary of the FHI-aims code that you can execute on your computer.

For further background on how to compile FHI-aims, please also see our manual (chapter 1 as well as several appendices).


Users of this tutorial should have:

  • A sufficiently good understanding of the Unix command line.
  • Access to the FHI-aims source code which requires a license. Information on how to obtain a license can be found here:

General Remarks

The performance of a particular computer will critically depend on the particular software installed and available on that machine: Compilers, numerical libraries (especially highly optimized linear algebra libraries), and MPI (message passing interface) libraries that facilitate parallel execution. Without linking to the right libraries for a specific computer (which requires compiling), many - especially the most valuable - computing platforms cannot be used effectively.

As mentioned above, it really pays to invest in a good platform specific compiler instead of using easy system defaults that deliver a fraction of the performance. In our experience, performance is frequently not good with system default compilers and non-optimized open-source linear algebra libraries, even if these tools are themselves easy to install. The previous statement may or may not be right for every platform, but making sure that optimal compiler and libraries are used is really critical. There is little benefit in spending tens of thousands of $$ on a computer only to have it run at (say) half speed due to not using the optimal compiler/library environment.

What this Tutorial is not

This tutorial does not serve as a complete reference on how to compile FHI-aims on any given platform. However, we do have a broader (but not complete) list of appropriate compilation settings for various platforms in our FHI-aims wiki page. You are free to contribute additional compilation settings for other systems. Additionally, details on the compilation on GPUs is not included here. For more on GPUs, please refer to the manual or our FHI-aims wiki.