Installation

Autotools

If you are installing the library directly from the sources, the recommended way to do so is by using GNU Autotools.

To install the library, just use the standard procedure:

./configure --prefix=PATH/TO/LIBXC
make
make check
make install

Do not forget to replace PATH/TO/LIBXC by the some appropriate path on your file system and make sure that you have write permissions.

If you obtained the sources directly from the git repository, you will first need to generate configure by running

autoreconf -i

CMake

Support for building the sources using CMake has also been recently contributed by Lori Burns.

The CMake file has the following caveats

Building with CMake

Use the following procedure:

cmake -H. -Bobjdir
cd objdir && make
make test
make install

The build is also responsive to

See CMakeLists.txt for options details. All these build options should be passed as cmake -DOPTION.

Detecting with CMake

CMake builds install with LibxcConfig.cmake, LibxcConfigVersion.cmake, and LibxcTargets.cmake files suitable for use with CMake find_package() in CONFIG mode.

See cmake/LibxcConfig.cmake.in for details of how to detect the Config file and what CMake variables and targets are exported to your project.

Use with CMake

After find_package(Libxc ...),

Python Library

Optional Python bindings are available through the cytpes module. To install into Python site-packages plese run:

python setup.py install

or, to install locally for development:

python setup.py develop

The Python bindings require the CMake compilation pathway and the Python Numerical Python library. A short usage example is provided below:

# Build functional
>>> func = pylibxc.LibXCFunctional("gga_c_pbe", "unpolarized")

# Create input
>>> inp = {}
>>> inp["rho"] = np.random.random((3))
>>> inp["sigma"] = np.random.random((3))

# Compute
>>> ret = func.compute(inp)
>>> for k, v in ret.items():
>>>     print(k, v)

zk [[-0.06782171 -0.05452743 -0.04663709]]
vrho [[-0.08349967 -0.0824188  -0.08054892]]
vsigma [[ 0.00381277  0.00899967  0.01460601]]

Fedora Linux

Libxc is available in Fedora Linux. To compile against Libxc, one just needs to install the development package with

 $ dnf -y install libxc-devel

If the Libxc Fortran module file is needed, one needs to add ‘-I/usr/lib64/gfortran/modules’ (on 64-bit systems) or ‘-I/usr/lib/gfortran/modules’ (on 32-bit systems) to the compiler arguments.

Homebrew

Libxc for Mac OS X is available from the Homebrew package manager. After Homebrew installation one types in:

$ brew install gfortran
$ brew install libxc