Skip to content

GPAW

GPAW is a density-functional theory (DFT) and beyond code based on the projector-augmented wave (PAW) method and the atomic simulation environment (ASE). The wave functions can be described with plane waves, uniform real-space grids, and atom-centered basis functions.

Some features of the software include:

  • total energy calculations
  • structural optimizations
  • different boundary conditions (finite, wire, slab, bulk)
  • efficient parallelization
  • excited state properties within time-dependent density-functional theory

Available

Version Module Notes
25.7.0 gpaw/25.7.0 Plain installation. Same as gpaw/pilot-25.7.0.
26.7.0 gpaw/26.7.0 Containerized installation.

The installations include the following libraries: MPI, OpenMP, ScaLAPACK, ELPA, FFTW, libxc, libvdwxc, DFT-D3, DFT-D4.

Version Module Notes
26.7.0 gpaw/26.7.0 Containerized installation.

The installations include the following libraries: MPI, OpenMP, ScaLAPACK, FFTW, libxc, libvdwxc, DFT-D3, DFT-D4.

GPAW is available as a user-installable module. See the LUMI installation instructions in GPAW documentation for detailed instructions.

License

GPAW is free software available under GPL, version 3+.

Usage

Since the default version, that is available with module load gpaw, is subject to change when new versions are installed, we recommend to always load a specific GPAW version:

module load gpaw/version

Use gpaw info to check the GPAW version and the included libraries.

See GPAW documentation on parallel runs for instructions on how to enable high-performance libraries in the input script

Note

GPAW calculations are run with the gpaw python command.

Batch script examples

#!/bin/bash
#SBATCH --job-name=gpaw
#SBATCH --account=<project>
#SBATCH --partition=small
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=2 --cpus-per-task=1
#SBATCH --mem-per-cpu=1G
#SBATCH --time=00:30:00

# Load gpaw module
module load gpaw/version

# Set the number of threads based on cpus-per-task
export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK:-1}

# Place and bind threads to single cores
# Comment the following lines if binding is not desired
export OMP_PLACES=cores
export OMP_PROC_BIND=spread

# Run GPAW
srun gpaw python input.py
#!/bin/bash
#SBATCH --job-name=gpaw
#SBATCH --account=<project>
#SBATCH --partition=medium
##SBATCH --partition=large  # uncomment if using 6 or more nodes
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=192 --cpus-per-task=2  # The product should be 384
#SBATCH --time=00:30:00

# Test different values of
# --ntasks-per-node and --cpus-per-task above
# for your use case and use the values that give the best performance

# Load gpaw module
module load gpaw/version

# Set the number of threads based on cpus-per-task
export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK:-1}

# Place and bind threads to single cores
# Comment the following lines if binding is not desired
export OMP_PLACES=cores
export OMP_PROC_BIND=spread

# Run GPAW
srun gpaw python input.py
#!/bin/bash
#SBATCH --job-name=gpaw
#SBATCH --account=<project>
#SBATCH --partition=gpumedium
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1  # Use as many tasks as GPUs
#SBATCH --cpus-per-task=72   # Use 72 here always, i.e., all Grace CPU cores of the GH200 superchip
#SBATCH --gres=gpu:gh200:1   # Use 1 GPU per node
#SBATCH --time=00:30:00

# Set the number of CPU threads based on cpus-per-task
export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK:-1}

# Place and bind CPU threads to single CPU cores
# Comment the following lines if binding is not desired
export OMP_PLACES=cores
export OMP_PROC_BIND=spread

# Run GPAW
srun gpaw python input.py
#!/bin/bash
#SBATCH --job-name=gpaw
#SBATCH --account=<project>
#SBATCH --partition=gpularge
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=4  # Use 4 tasks per node, i.e., one task per GPU
#SBATCH --cpus-per-task=72   # Use 72 here always, i.e., all Grace CPU cores of the GH200 superchip
#SBATCH --gres=gpu:gh200:4   # Use all 4 GPUs per node
#SBATCH --time=00:30:00

# Set the number of CPU threads based on cpus-per-task
export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK:-1}

# Place and bind CPU threads to single CPU cores
# Comment the following lines if binding is not desired
export OMP_PLACES=cores
export OMP_PROC_BIND=spread

# Run GPAW
srun gpaw python input.py

Custom GPAW environment on Roihu

It is possible to create a Python virtual environment on top of the GPAW module. This is useful for installing additional Python packages alongside GPAW and/or installing a development version of GPAW.

Roihu-CPU and Roihu-GPU

The instructions below work for both Roihu-CPU and Roihu-GPU, but it is recommended to include the target platform in the environment name (like venv-gpaw-cpu), because binaries compiled for Roihu-CPU and Roihu-GPU are not compatible.

Creating and using a Python virtual environment

Use the gpaw module to create a new virtual environment:

module load gpaw/26.7.0
python -m venv --system-site-packages venv-gpaw-cpu

To load this environment, load the module and source the environment activate script:

module load gpaw/26.7.0 && source venv-gpaw-cpu/bin/activate

Entrypoint scripts with the virtual environment

Note that so-called entrypoint scripts like gpaw and ase are short-hands for python -m gpaw and python -m ase, respectively, but the difference is that gpaw/ase run in the installation-time environment whereas python -m <module> runs in the currently active environment, which is often desired.

The entrypoint scripts get created in the virtual environment only when installing the corresponding packages in the environment. Therefore, if you install other packages than gpaw in the virtual environment, the gpaw executable will not see those packages, but you need to use python -m gpaw instead of the plain gpaw.

Installing additional Python packages

Load the environment and install extra packages with pip:

# Load GPAW venv
module load gpaw/26.7.0 && source venv-gpaw-cpu/bin/activate

# Install a python package
# Note:
# - The constraint ensures that the provided high-performance numpy and scipy
#   are not reinstalled by pip with less-optimal versions
pip install --constraint /gpaw_container/config/constraints.txt <package>

As a concrete example, installing the latest (unstable) development version of ASE:

# Load GPAW venv
module load gpaw/26.7.0 && source venv-gpaw-cpu/bin/activate

# Install a python package
# Note:
# - The constraint ensures that the provided high-performance numpy and scipy
#   are not reinstalled by pip with less-optimal versions
pip install --constraint /gpaw_container/config/constraints.txt git+https://gitlab.com/ase/ase.git@master

# Check the ASE version that GPAW sees in the environment
python -m gpaw info

# Note! The GPAW line below does NOT see the updated ASE
#       unless also GPAW is installed in the environment.
#       See the warning about entrypoint scripts above!
gpaw info

Installing a development version of GPAW

Load the environment, clone the GPAW code, and install it with pip:

# Load GPAW venv
module load gpaw/26.7.0 && source venv-gpaw-cpu/bin/activate

# Clone the GPAW development repository
git clone https://gitlab.com/gpaw/gpaw.git
cd gpaw

# Install GPAW
# Note:
# - The constraint ensures that the provided high-performance numpy and scipy
#   are not reinstalled by pip with less-optimal versions
# - The GPAW config is set to the siteconfig file tailored for Roihu
# - This installs in editable mode (leave the '-e' out if you don't want an editable install)
rm -rf build _build _gpaw.*.so gpaw.egg-info
GPAW_BUILD_JOBS=8 GPAW_CONFIG=/gpaw_container/config/siteconfig.py pip install --constraint /gpaw_container/config/constraints.txt --no-build-isolation -v --log build-cpu.log --config-settings editable_mode=compat -e .

# Check the installed GPAW
gpaw info

Files inside the container

Note that all files under the path /gpaw_container/ reside inside the Apptainer container image and this path is not directly accessible.

Instead, you can use the _debug_exec command to execute commands inside the container. For example, to print the contents of the used constraints.txt:

_debug_exec cat /gpaw_container/config/constraints.txt

As another example, copy siteconfig.py from the container image to a normal file my-siteconfig.py that you can then customize if needed:

_debug_exec cp /gpaw_container/config/siteconfig.py my-siteconfig.py

You can also use _debug_shell to open a shell inside the container to inspect its contents further.

More information

November 30, 2026