diff --git a/install_libxc.sh b/install_libxc.sh new file mode 100644 index 0000000..b531480 --- /dev/null +++ b/install_libxc.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -e + +if [[ -z "$CONDA_PREFIX" ]]; then + echo "You do not seem to have an active conda environment active, aborting" + exit 1 +fi + +# Get and unzip archive +LIBXC_VERSION=6.1.0 +wget "https://github.com/ElectronicStructureLibrary/libxc/archive/refs/tags/$LIBXC_VERSION.zip" +unzip "$LIBXC_VERSION.zip" +rm "$LIBXC_VERSION.zip" +cd "libxc-$LIBXC_VERSION" + +# Compile +cmake -H. -Bobjdir -DENABLE_PYTHON=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX" +cd objdir && make + +# Test +make test + +# Install +make install + +# Link the python library +PYTHON_VERSION=$(python --version | sed -e 's/.* \([0-9]\.[0-9]\{2\}\).*/\1/') +echo "Detected python v$PYTHON_VERSION" +echo "Creating symlink to pylibxc library (python bindings for libxc)" +ln -v -s "$CONDA_PREFIX/lib64/pylibxc" "$CONDA_PREFIX/lib/python$PYTHON_VERSION/site-packages" + +echo 'Install successful'