For a long time we wanted to try SCAN functional implemented in LibXC using GPAW. However, at first, fresh LibXC 3.0.0 did not work. Then we could not compile GPAW. Unit today. Here is a recipe that works for Fedora 25.
First, let’s prepare clean Fedora 25:
sudo dnf groupinstall "Development Tools"
sudo dnf groupinstall 'C Development Tools and Libraries'
sudo dnf install gcc-gfortran python-devel zlib-devel
sudo dnf install python-pip blas-devel lapack-devel atlas-devel openblas-devel rpm-build
sudo dnf install openmpi-devel scalapack-openmpi-devel blacs-openmpi-devel
sudo pip install --upgrade pip
pip install --upgrade --user numpy scipy matplotlib
sudo dnf install nano
Nano is installed in case you don’t like vi or emacs. Some packages might not be needed, but we installed them anyway.
LibXC compilation:
svn co http://www.tddft.org/svn/libxc/trunk/ libxc
cd libxc
autoreconf -i
./configure --enable-shared --prefix=/home/USER/xc
make -j N
make install
After compiling LibXC add these lines to your .bashrc
:
export C_INCLUDE_PATH=/home/USER/xc/include
export LIBRARY_PATH=/home/USER/xc/lib
export LD_LIBRARY_PATH=/home/USER/xc/lib
Let’s install ASE using pip, because it is easy.
pip install --upgrade --user ase
Get the GPAW source code and remove in libxc.c
in c/xc/
line “xc_mgga_x_tb09_set_params(self->functional[0], c);”. Them compile GPAW with python setup.py install --user
. YOu might want to add the .local/bin
to the path.
Don’t forget to get setups. E.g. execute gpaw install-data DIR
. After that try this example:
from ase import Atom, Atoms
from gpaw import GPAW
xc = 'MGGA_X_SCAN+MGGA_C_SCAN'
bulk = Atoms([Atom('Li')], pbc=True)
k = 4
g = 8
calc = GPAW(gpts=(g, g, g), kpts=(k, k, k),
xc=xc)#, txt=None)
bulk.set_calculator(calc)
bulk.get_potential_energy()