Installation of DFT+ embedded DMFT Functional
The program consists of many independent programs and executables,
which are written in C++, fortran90, and Python.
Before you start the installation, you should check your system if the
required packages are installed, which include:
- C++ compiler (either gnu or intel)
- fortran compiler (either gnu or intel)
- Python (version 3) with numpy and scipy as well as pybind11
- blas/lapack library (intel mkl or similar). If installation
does not find it, it will try to download it and install it. You
will be prompted.
- gsl library: gnu scienific library. If you do not have it, you
will be prompted to do download and install it.
- fftw library for fast Fourier transform
- Finally, Wien2K needs to be installed to run charge
self-consistent calculations.
- pymatgen is not required for running the code, but is needed
for cif2struct.py and cif2indmf.py scripts
The simplest type of compilation (after un-taring the code tar xzvf
EDMFTF.tgz) consist of running the python setup script,
i.e.,
python setup.py
To clean the previous compilation (all object files and libraries, but
not removing the final binary files), you should type
python setup.py --clean
However, before you start compilation, it is advisable to first edit
configure.py file, which contains information about
existing libraries.
There are several examples of the configuration script provided, for example,
configure.py.macos, configure.py.intel,
configure.py.gnu. If you are trying the code on MacOS,
simply copy configure.py.macos
to configure.py.
On system with all intel compilers one can
copy configure.py.intel to
configure.py and then run python setup.py.
The configuration script, which is being used by the program, is called
configure.py, and by default it takes the form:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
class Config:
prefix = "./bin" # Installation path
compiler = "INTEL" # Compiler
cflags = "-O2 -std=c++11" # compiling flags for C++ programs
fflags = "-O2" # compiling flags for Fortran programs
ldflags = "" # linking flags for Fortran programs
ompflag = "-fopenmp" # linker/compiler flag for openmp
mpi_define = "-D_MPI" # should be -D_MPI for mpi code and empty for serial code.
pcc = "mpicc" # C compiler
pcxx = "mpicxx" # C++ compiler
pfc = "mpif90" # Fortran compiler
blasname = "MKL" # BLAS library
blaslib = "-mkl" # BLAS library
lapacklib = "" # LAPACK library
fftwlib = "-lfftw3_omp -lfftw3" # FFTW library
gsl = "-lgslcblas -lgsl" # GSL library
f2pylib = "--f90flags='-fopenmp ' --opt='-fast'" # adding extra libraries for f2py
f2pyflag = "--opt='-O2' " # adding extra options to f2py
arflags = "rc" # ar flags
make = "make"
def __init__(self, version):
self.version = version
def __getattr__(self,key):
return None
The first variable prefix specifies the directory for the
binaries, i.e., where the binaries will be copied during installation.
The second variable compiler specifies that we will use
intel compilers (ifort and icc). The alternative for this variable is
"GNU", which will than use gcc and gfortran.
Next we specified the optimization flags for C++ and fortran code
(cflags, fflags). The linkking flags
(ldflags)
for fortran code
sometimes need extra flags, but they are empty by default. Some parts
of the code that use pybind11 need C++11 standard, hence "-std=c++11"
is required in cflags.
If the compilers support OpenMP, we should set
If the parallel mpi version of C, C++ and fortran compilers exist, we should set the
following variables mpi_define, pcc, pcxx, pfc, as
specified above. Of course, the variables should be set to the names
of respective compilers.
Alternatively, if no mpi exists, we can set
Next we specify the blas library. If you can use intel MKL, you should
set blasname to "MKL", and blaslib to
"-mkl", or similar. The details of this last linking
command might depend on the installation.
On MacOS, for example, the intel library is contained in
Accelerate library. In this case, blasname
can be empty, and blaslib can be set to
Accelerate library, i.e.,
blasname = "" # BLAS library
blaslib = "-framework Accelerate" # BLAS library
lapacklib = "" # LAPACK library
Next, we should specify the fftw library. In the simplest case, we
should just have
fftwlib = "-lfftw3" # FFTW library
If the OpenMP version of the fftw library is available, we can add
-lfftw3_omp. Finally, if the fftw library is not in one
of the standard directories, where the compiler can find it, you should
use the -L option, to specify the exact path of the
library, as shown in the sample configuration script above.
Finally, the gsl library should be specified, if you
already have it installed (otherwise the variable should be set to
empty string). In the simplest case (on Mac OS), we should just
specify
gsl = "-lgsl" # GSL library
On many linux systems, the cblas library should also be
linked with gsl, because some routines in gsl need
cblas. To do that, specify
gsl = "-lgslcblas -lgsl" # GSL library
Finally, if one of the two libraries is not found by the linker,
because it is in non-standard place, please use -L
linking options.
In several parts of the code, we use f2py
compiler, to convert fortran code into python modules. It is a good
idea to optimize these modules, by allowing "openmp" during f2py
compilation. This is done by specifying
f2pylib = "--f90flags='-openmp ' --opt='-fast'" # adding extra libraries for f2py
Finally, we use pybind11 package and blitz++ in several python files to
speed up the execution. The corresponding include files are located in
src/includes, and the setup script should set proper paths. If
the pybind11 compilation and testing fails, one can add "pybind11"
variable to class Config to change pybind11 compilation instructions.
This was description of generic configuration script. For Mac OS, the
configuration script should take the following form
#! /usr/bin/env python
# -*- coding: utf-8 -*-
class Config:
prefix = "bin" # Installation path
compiler = "GNU" # Compiler
cxx = "g++-13" # C++ compiler
cc = "gcc-13"
cflags = "-O3" # compiling flags for C++ programs
fflags = "-O3 -fallow-argument-mismatch" # compiling flags for Fortran programs
ldflags = "" # linking flags for Fortran programs
ompflag = "-fopenmp" # linker/compiler flag for openmp
mpi_define = "-D_MPI" # should be -DMPI for mpi code and empty for serial code.
pcc = "mpicc" # C compiler
pcxx = "mpicxx" # C++ compiler
pfc = "mpif90" # Fortran compiler
blasname = "" # BLAS library
blaslib = "-framework Accelerate" # BLAS library
lapacklib = "" # LAPACK library
fftwlib = "-L/opt/homebrew/lib -lfftw3_omp -lfftw3" # FFTW library
gsl = "-I/opt/homebrew/include -L/opt/homebrew/lib -lgsl" # GSL library
f2pylib = "--f90flags='-openmp '" # adding extra libraries for f2py
f2pyflag = "--opt='-O3' " # adding extra options to f2py
pybind11 = "-undefined dynamic_lookup"
arflags = "rc" # ar flags
make = "make"
def __init__(self, version):
self.version = version
def __getattr__(self,key):
return None
After the installation is complete, the following variables should be
set in your .bashrc (or equivalent):
WIEN_DMFT_ROOT
PYTHONPATH
WIENROOT
SCRATCH
EDITOR
The last three should be specified during Wien2k installation, and in
general do not need to be changed now. It is however advisable to set
SCRATCH to current directory.
For example, typical installation will have the following variables
set to
export WIEN_DMFT_ROOT=$HOME/EDMFT/bin
export PYTHONPATH=$PYTHONPATH:$WIEN_DMFT_ROOT
export WIENROOT=$HOME/wien2k
export SCRATCH="."
export EDITOR="emacs -nw"
export PATH=$WIENROOT:$WIEN_DMFT_ROOT:$PATH