Interface to Libxc by M. A. L. Marques

Code author: M. A. L. Marques and Micael Oliveira

Section author: Lori A. Burns

PSI4, relies upon the Libxc library for density functionals. Libxc requires no additional licence, downloads, or configuration. Conversely, PSI4 cannot build without Libxc.



  • Libxc is available as a conda package for Linux and macOS (and Windows, through the Ubuntu shell).

  • If using the PSI4 binary, Libxc has already been installed alongside.

  • If using PSI4 built from source, and anaconda or miniconda has already been installed (instructions at Quick Installation), Libxc can be obtained through conda install libxc -c psi4. Then, hint its location with CMAKE_PREFIX_PATH, and rebuild PSI4 to detect Libxc and activate dependent code.

  • To remove a conda installation, conda remove libxc.



    Note that PSI4 has forked and slightly modified upstream Libxc from to regain functionality.

  • If using PSI4 built from source and you want Libxc built from from source also, let the build system fetch and build it and activate dependent code.

How to configure Libxc for building Psi4

Role and Dependencies

  • Role — In PSI4, Libxc is a library that provides essential density functional definitions and compositions.

  • Downstream Dependencies — PSI4 \(\Leftarrow\) Libxc

  • Upstream Dependencies — Libxc \(\Leftarrow\) None

CMake Variables

  • CMAKE_PREFIX_PATH — CMake list variable to specify where pre-built dependencies can be found. For Libxc, set to an installation directory containing include/libxc/xc.h

  • Libxc_DIR — CMake variable to specify where pre-built Libxc can be found. Set to installation directory containing share/cmake/Libxc/LibxcConfig.cmake

  • CMAKE_DISABLE_FIND_PACKAGE_Libxc — CMake variable to force internal build of Libxc instead of detecting pre-built

  • CMAKE_INSIST_FIND_PACKAGE_Libxc — CMake variable to force detecting pre-built Libxc and not falling back on internal build


  1. Build bundled

>>> cmake
  1. Link against pre-built

>>> cmake -DCMAKE_PREFIX_PATH=/path/to/libxc/root
>>> cmake -DLibxc_DIR=/path/to/libxc/configdir
  1. Build bundled despite pre-built being detectable

>>> cmake -DCMAKE_PREFIX_PATH=/path/to/unwanted/libxc/root/and/wanted/other/dependencies/root -DCMAKE_DISABLE_FIND_PACKAGE_Libxc=ON