Download libxc:
Either from the website
http://www.tddft.org/programs/libxc/download/
or from the Gitlab:
https://gitlab.com/libxc/libxc
Get a 3rd-party installation of Python. I personally like Miniconda, which is Anaconda without the multiple gigabytes of packages you'll never use. Get the Python 3.6 install for Linux. We will not be discussing the python 3.6. Use Py3. This is non-negotiable.
https://conda.io/miniconda.html
Once you download the .sh installer, go to the directory containing it, chmod +x
it, and ./InstallerNameHere.sh
. It'll install to $HOME/miniconda3
by default. Which is typically /home/username/miniconda3
.
Once that's done, go to your libxc sources. If you downloaded them from the website, you'll need to extract using something like tar -xvf libxc-versionnumber.tar.gz
. if you've got the Gitlab repo, we can just go to the directory.
If you get the repo from Gitlab, you'll need to run autoreconf -i
to make the configure
script.
We're doing this with shared libs for libxc because static libs break things in the GPAW install, I think.
Run:
make --prefix=$HOME/.local/libxc-gpaw --enable-shared
make -j NumberOfThreadsYouWant
make check
// You really want to make sure this passes.
make install
Really important part:
which python
should give you /home/username/miniconda3/bin/python
before you type this in. If it doesn't, restart your terminal. Make sure you have the miniconda install prepended to your path. We need which python
to give you the above Python.
Now, once you're back in that libxc source directory, and assuming it installed all fine, run:
python setup.py install
THIS IS VERY IMPORTANT. GPAW LOOKS FOR THIS INSTALL WHEN INSTALLING THE PYTHON BINDINGS.
Now, let's go to the gpaw
source directory, which I will assume you got from Gitlab, or from their site, and did the above-like unzipping etc, and are now ready to go.
In the customize.py
file: change the following:
compiler = 'clang'
If you don't have clang, get clang. Clang is important here. As of the time of me writing this guide, GCC 7.2.0 has a bug, and will fail at an LTO step in the install. We need clang.
Further down, around line 59:
# - dynamic linking (requires rpath or setting LD_LIBRARY_PATH at runtime):
if 1:
xc = '/home/username/.local/libxc-gitlab-main/'
include_dirs += [xc + 'include']
library_dirs += [xc + 'lib']
# You can use rpath to avoid changing LD_LIBRARY_PATH:
extra_link_args += ['-Wl,-rpath={xc}/lib'.format(xc=xc)]
if 'xc' not in libraries:
libraries.append('xc')
Now, in your terminal: THIS IS AGAIN, CRITICAL. IF YOU DO NOT DO THIS, THE INSTALL WILL FAIL DUE TO THE GCC LTO BUG. This changes the compiler that mpicc
wraps.
export OMPI_CC=clang
Once this is done, run:
python setup.py install
in the gpaw source folder.
In the above, I've assumed that you've got linear algebra libraries in your path, and all other funky things are in place. This was primarily to make the libxc installation and linking clear. It's annoyingly unclear, as well as there being an obscure gcc bug in gcc 7.2.0.