How to build gpaw


Load necessary modules

ml add PDC/22.06
ml add PrgEnv-gnu
ml add cray-python/
ml add libxc/6.0.0-cpeGNU-22.06
ml add cray-fftw/
ml add ScaLAPACK/3.2-cpeGNU-22.06-amd

Create a python virtual environment and install all needed packages

python3 -m venv gpaw-venv
source gpaw-venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install numpy scipy matplotlib ase

Set the proper configuration in

compiler = 'cc'
mpicompiler = 'cc'
mpilinker = 'cc'
# platform_id = ''

# FFTW3:
fftw = True
if fftw:
    libraries += ['fftw3']
    library_dirs += ['/opt/cray/pe/fftw/']

# ScaLAPACK (version 2.0.1+ required):
scalapack = True
if scalapack:
    libraries += ['scalapack']
    library_dirs += ['/pdc/software/22.06/eb/software/ScaLAPACK/3.2-cpeGNU-22.06-amd/lib']

# Use Elpa (requires ScaLAPACK and Elpa API 20171201):
if 0:
    elpa = True
    elpadir = '/home/user/elpa'
    libraries += ['elpa']
    library_dirs += ['{}/lib'.format(elpadir)]
    extra_link_args += ['-Wl,-rpath={}/lib'.format(elpadir)]
    include_dirs += ['{}/include/'.format(elpadir)]

# LibXC:
# In order to link libxc installed in a non-standard location
# (e.g.: configure --prefix=/home/user/libxc-2.0.1-1), use:

# - static linking:
if 0:
    xc = '/home/user/libxc-4.0.4/'
    include_dirs += [xc + 'include']
    extra_link_args += [xc + 'lib/libxc.a']
    if 'xc' in libraries:

# - dynamic linking (requires rpath or setting LD_LIBRARY_PATH at runtime):
if 1:
    xc = '/pdc/software/22.06/eb/software/libxc/6.0.0-cpeGNU-22.06/'
    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:

# libvdwxc:
if 0:
    libvdwxc = True
    path = '/home/user/libvdwxc'
    extra_link_args += ['-Wl,-rpath=%s/lib' % path]
    library_dirs += ['%s/lib' % path]
    include_dirs += ['%s/include' % path]
    libraries += ['vdwxc']


python build_ext
python install

Modify one file in the installation

From newer versions of GPAW the command used to run in parallel is gpaw instead of gpaw-python. However, mpiexec is hardcoded in one of the scripts when using the parallel version of gpaw, so it has to be changed to srun.

The file to be changed is /path/to/gpaw/22.8.0/gpaw-venv/lib/python3.9/site-packages/gpaw-22.8.0-py3.9-linux-x86_64.egg/gpaw/cli/


PDC takes no responsibility for the correctness of results produced with the binaries. Always evaluate the binaries against known results for the systems and properties you are investigating before using the binaries for production jobs.

How to use gpaw