Libxc is a library of exchange-correlation functionals for density-functional theory. The aim is to provide a portable, well tested and reliable set of exchange and correlation functionals that can be used by all the ETSF codes and also other codes.

In libxc you can find different types of functionals: LDA, GGA, hybrids, mGGA (experimental) and LCA (not working). This functionals depend on local information, in the sense that the value of the potential at a given point depends only on the values of the density - and the gradient of the density and the kinetic energy density, for the GGA and mGGA cases, or the vorticity for LCA - at a given point.

Libxc is used in a variety of modern DFT codes and is the best way to add additional functionals to existing programs.

User instructions

Libxc is available for use with both the GNU and Intel compiler families. Bindings for both C/C++ and Fortran are provided. To use, load the appropriate module:

$ module load libxc/3.0.0

Add -lxc (-lxcf90 for fortran) to your link line to link the library to your program. In addition, it is not possible to control the search paths used by gfortran to find F90 module files by environment variables; it is necessary to add the appropriate include directory by adding -J${LIBXC_ROOT}/include to the compile command.

Static and shared versions of libxc are available.

Libxc needs to be initialised before it is used. See for detailed instructions on how to use the library.


GNU Lesser General Public License v3.

Admin notes

Libxc comes with a configure script, so compilation is very straightforward. I compiled versions for the GNU and Intel compiler families:

module purge
mkdir -p build-3.0.0-gcc63; cd build-3.0.0-gcc63;
module load gcc/6.3.0
../libxc-3.0.0/configure --prefix=/common/debian/9.1/Compiler/gcc/6.3/libxc/libxc-3.0.0 --enable-shared && make && make install

cd ..; mkdir -p build-3.0.0-gcc71; cd build-3.0.0-gcc71;
module load gcc/7.1.0
../libxc-3.0.0/configure --prefix=/common/debian/9.1/Compiler/gcc/7.1/libxc/libxc-3.0.0 --enable-shared && make && make install

cd ..; mkdir -p build-3.0.0-intel2017; cd build-3.0.0-intel2017
module load intel/2017.4.196
CC=icc FC=ifort ../libxc-3.0.0/configure --enable-shared --prefix=/common/debian/9.1/Compiler/intel/2017.4/libxc/libxc-3.0.0 && make && make install