This package is written mainly in fortran, with parts in c, c++, and python. The minimum requirements are

  • fortran compiler. Tested with gcc 5+, ifort 14+. Several f2003/2008 features are extensively used, so the compiler needs to be rather new.
  • MPI
  • fftw
  • hdf5
  • python

In addition, to make use of all features you might want to install

  • gnuplot, tested with 4+ on OSX with aquaterm
  • this documentation is generated with FORD.




Nothing special is required by the MPI installation, except that it needs to support MPI_IN_PLACE. I have never had any issues with specific MPI implementations.


It is likely that the cluster you use already has hdf5 installed. If not, compiling is a breeze (except on Cray systems) usually, I use

./configure FC=XX CC=XX --with-fortran --with-fortran2003 --prefix=XX
make install

Note that the fortran compiler needs to be exactly the same as the one used to compile TDEP later on.


The build system is a little unorthodox, but straightforward. You need to create a file called important_settings, and put it in the root directory of tdep. Several examples are provided, start with the one that seems closest to what you have. An example follows here, for OSX:

# A central place to put all the important paths. You probably have to modify this to make things work.

# the fortran compiler
# optimization stuff. Go all in.
# the flag that sets the default real to a double.
# The flag that tells the compiler where to put .o and .mod files.

# the header to put in python scripts.

# Which gnuplot terminal to use by default.
GNUPLOTTERMINAL="aqua"  # nice on OSX, needs aquaterm installed and gnuplot compiled with support for it.

# Precompiler flags. Selecting default gnuplot terminal, and make the progressbars work.

# these are the flags that are needed for gfortran
FCFLAGS="-Wl,-commons,use_dylibs -ffree-line-length-none -std=f2008 -fall-intrinsics -cpp -fopenmp"

# These are the BLAS/LAPACK libraries. On OSX with gfortran, use the built-in 'framework accelerate'
BLASLAPACK_LIBS="-framework accelerate" 

# I use fftw for Fourier transforms.

# Also need MPI
MPI_LIBS="-lmpi_mpifh -lmpi"

# I also use HDF5 every now and then
HDF5_LIBS="-lhdf5 -lhdf5_fortran"

# We also need a C-compiler

# Things below this line is strictly optional, and not really needed except for testing purposes.
# If you want to try and use CGAL. Not recommended for people who do not like to sort out compiler errors. 

# CGAL is written in c++. I have wrapper functions in C, that I call from Fortran.
CPP_FLAGS="--std=c++0x -frounding-math -O3 -Dusecgal -DCGAL_USE_GMP -DCGAL_USE_MPFR -DCGAL_EIGEN3_ENABLED -DNDEBUG -DBOOST_PARAMETER_MAX_ARITY=12 -Wno-deprecated-declarations"
CGALLINKLINE="-lstdc++ -lCGAL -lmpfr -lgmp -lboost_system -lboost_thread-mt"

# It's important at least a majority of these libraries are compiled with the same c++ compiler 
# as above. You can get strange, strange errors otherwise. As I said, getting this up and running
# is not easy.
PATH_TO_CGAL_LIB="-L/Users/olle/software/CGAL-4.9/build/lib -L/usr/local/lib"
PATH_TO_CGAL_INC="-I/Users/olle/software/CGAL-4.9/build/include -I/usr/local/include -I/usr/local/include/eigen3"

# If I want to link with AIMS, I have to specify where it is

once that is set up, run


And things should start compiling. It will stop at any error, you probably have to install some library or adjust some path in important_settings.

Setting paths

once has finished, it should have printed a bashrc_tdep file. The rest of the usage guides assumes you put this in your .bashrc or equivalent. It sets the path, manpath and a few minor things, contains the following lines:

export MANPATH
export PATH
alias gnuplot='gnuplot -persist'

If this is set up, you are good to go.

Complicated dependencies


You might have noticed that there is an optional dependency on CGAL in the provided important_settings. I wrote a Fortran interface to (a very small subset of) CGAL that can be used to generate meshes, triangulations and other things. The reason it is not enabled by default is that making CGAL and Fortran talk to each other is not straightforward. I can only describe how I got it to work. I don't know if all of these steps are necessary, or if there is some other thing I did that got it to work. This is all for OSX 10.11.4

  • get the latest CGAL source, I used 4.11, and read the manual installation.
  • when configuring cgal with cmake, specify C and c++ compilers manually to gcc-7 and g++-7, installed via homebrew. (I never got it working with clang, my guess is that linking becomes easier if the fortran, C and c++ compilers are all gcc.)
  • configure cgal to produce static libraries (untick the box that says BUILD_SHARED_LIBS)
  • add -DBOOST_PARAMETER_MAX_ARITY=12 to the compile line

If this made no sense whatsoever, you probably do not want to try and enable this.