Image size: 242.3 MB

For more on pulling from the registry, see the ilifu documentation.

First, once: add the registry and make it your default

singularity remote add --no-login idia-registry https://sregistry.idia.ac.za
singularity remote use idia-registry

If you added it before, as the ilifu docs describe, remote add says it already exists: just run remote use.

Log in, for a private collection

singularity remote login idia-registry

Paste a token from your token page when asked. Public collections need no login.

Pull the container

singularity pull library://bioinformatics/gromacs:2026.4

Shell into the container

singularity shell library://bioinformatics/gromacs:2026.4

Run the container

singularity run library://bioinformatics/gromacs:2026.4

First, once: add the registry and make it your default

apptainer remote add --no-login idia-registry https://sregistry.idia.ac.za
apptainer remote use idia-registry

If you added it before, as the ilifu docs describe, remote add says it already exists: just run remote use.

Log in, for a private collection

apptainer remote login idia-registry

Paste a token from your token page when asked. Public collections need no login.

Pull the container

apptainer pull library://bioinformatics/gromacs:2026.4

Shell into the container

apptainer shell library://bioinformatics/gromacs:2026.4

Run the container

apptainer run library://bioinformatics/gromacs:2026.4
GROMACS 2026.4 by the GROMACS development team (https://www.gromacs.org/).

This image packages the unmodified upstream GROMACS 2026.4 release, built from the
official source tarball. IDIA builds and maintains the image only; report GROMACS bugs
upstream (https://gitlab.com/gromacs/gromacs/-/issues, or ask at
https://gromacs.bioexcel.eu/). Report image problems to support@ilifu.ac.za.

Build: single precision, CUDA 12.9.1 for P100 (sm_60), V100 (sm_70), A100 (sm_80) and
A40 (sm_86) GPUs, thread-MPI and OpenMP (no MPI), hwloc, and GROMACS's own FFTW
3.3.10 with cuFFT on the GPU. The CPU kernels use AVX2_256 SIMD, so the image needs an
x86-64 CPU with AVX2 and FMA (Intel Haswell or AMD Zen or later). It runs on AVX-512
nodes too, a little slower than a build for them. There is no PTX, so the GPU code
runs on compute capability 6.x, 7.x and 8.x GPUs only. On others (for example H100,
sm_90) GROMACS can't use the GPU: drop -nb/-pme/-update gpu to run on the CPU. The
host's NVIDIA driver must support CUDA 12.9 (driver 575 or later).

Usage (--nv makes the host's GPUs and driver visible):
  singularity exec --nv gromacs_2026.4.sif gmx grompp -f md.mdp -c conf.gro -p topol.top -o md.tpr
  singularity exec --nv gromacs_2026.4.sif gmx mdrun -deffnm md \
    -nb gpu -pme gpu -update gpu -ntmpi 1 -ntomp "${SLURM_CPUS_PER_TASK:-1}"
  singularity run gromacs_2026.4.sif --version      # runs gmx

The standard force fields and data are in /opt/gromacs/share/gromacs/top
(GMXDATA=/opt/gromacs/share/gromacs). Bind your own structures, topologies and
force fields with --bind; your current directory is usually mounted already.

Licence: GROMACS is LGPL-2.1-or-later (/opt/gromacs/LICENSE). The gmx binary is
statically linked with FFTW 3.3.10, which is GPL-2.0-or-later
(/opt/gromacs/licenses/fftw-COPYING), so the combined binary is distributed under the
GPL. NVIDIA's cuFFT library (/opt/gromacs/lib/libcufft.so.11) is redistributed under
the CUDA Toolkit EULA (/opt/gromacs/licenses/cuda-EULA-cufft.txt). The licences of the
libraries built into libgromacs are in /opt/gromacs/licenses/external/. The Colvars
module (https://github.com/Colvars/colvars, LGPL-3.0) is also built into libgromacs;
upstream ships no separate licence file for it, so its licence is in its source headers.

Citation: GROMACS asks that you cite the release you used (doi:10.5281/zenodo.23102386
for 2026.4; see /opt/gromacs/licenses/CITATION.cff) and the GROMACS papers listed in
/opt/gromacs/licenses/README, e.g. M. J. Abraham et al., SoftwareX 1-2, 19-25 (2015),
doi:10.1016/j.softx.2015.06.001.
Bootstrap: docker
From: nvidia/cuda:12.9.1-base-ubuntu24.04
Stage: build

%post
  export GROMACS_VERSION=2026.4
  export GROMACS_SHA256=58eda60979b124fcf9dff8b1b63cedfbc72fdb36d99e921dc1bdc310571098b6
  # The FFTW release GROMACS 2026.4's own-FFTW build expects; its MD5 is the one GROMACS
  # pins in src/external/build-fftw/CMakeLists.txt.
  export FFTW_VERSION=3.3.10
  export FFTW_SHA256=56c932549852cddcfafdab3820b0200c7742675be92179e59e6215b340e26467
  export FFTW_MD5=8ccbf6a5ea78a16dbc3e1306e234cc5c
  export CUDA_HOME=/usr/local/cuda-12.9
  export GMX_PREFIX=/opt/gromacs
  export DEBIAN_FRONTEND=noninteractive
  # FFTW's configure adds -mtune=native when CFLAGS is unset. Set it, so nothing is tuned
  # to the runner's CPU: the image runs on the cluster's.
  export CFLAGS='-O3 -fomit-frame-pointer -fstrict-aliasing'

  # The CUDA base image already has NVIDIA's apt repository. Only the parts of the CUDA
  # 12.9.1 toolkit GROMACS needs (nvcc, the runtime, CUB and cuFFT) are installed, pinned
  # to the 12.9.1 versions. CUDA 12.9 is the newest that still compiles for sm_60 and
  # sm_70, and driver 580 runs it.
  apt-get update -y
  apt-get install -y --no-install-recommends \
    binutils \
    build-essential \
    ca-certificates \
    cmake \
    curl \
    libhwloc-dev \
    zlib1g-dev \
    cuda-nvcc-12-9=12.9.86-1 \
    cuda-crt-12-9=12.9.86-1 \
    cuda-nvvm-12-9=12.9.86-1 \
    cuda-cudart-12-9=12.9.79-1 \
    cuda-cudart-dev-12-9=12.9.79-1 \
    cuda-driver-dev-12-9=12.9.79-1 \
    cuda-profiler-api-12-9=12.9.79-1 \
    cuda-cccl-12-9=12.9.27-1 \
    libcufft-12-9=11.4.1.4-1 \
    libcufft-dev-12-9=11.4.1.4-1 || exit 1

  mkdir -p /tmp/build
  cd /tmp/build || exit 1
  curl -fsSL -o "gromacs-${GROMACS_VERSION}.tar.gz" \
    "https://ftp.gromacs.org/gromacs/gromacs-${GROMACS_VERSION}.tar.gz" || exit 1
  curl -fsSL -o "fftw-${FFTW_VERSION}.tar.gz" \
    "https://www.fftw.org/fftw-${FFTW_VERSION}.tar.gz" || exit 1
  printf '%s  %s\n%s  %s\n' \
    "${GROMACS_SHA256}" "gromacs-${GROMACS_VERSION}.tar.gz" \
    "${FFTW_SHA256}" "fftw-${FFTW_VERSION}.tar.gz" | sha256sum -c - || exit 1
  tar xzf "gromacs-${GROMACS_VERSION}.tar.gz" || exit 1
  tar xzf "fftw-${FFTW_VERSION}.tar.gz" "fftw-${FFTW_VERSION}/COPYING" "fftw-${FFTW_VERSION}/COPYRIGHT" || exit 1

  # Portable choices only, nothing detected from the runner:
  # - SIMD AVX2_256 runs on every x86-64 CPU with AVX2 and FMA (Intel Haswell or later,
  #   AMD Zen or later).
  # - SASS for exactly the fleet's GPUs: P100 (sm_60), V100 (sm_70), A100 (sm_80) and A40
  #   (sm_86). No PTX, which would add compile time for no GPU we have.
  # - FFTW is GROMACS's own static build, from the tarball checked above.
  # - thread-MPI and OpenMP, no MPI. Tests, docs, the API headers, NNPot and HDF5 are off.
  mkdir -p build
  cd build || exit 1
  cmake "../gromacs-${GROMACS_VERSION}" \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX="${GMX_PREFIX}" \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DGMX_GPU=CUDA \
    -DCUDAToolkit_ROOT="${CUDA_HOME}" \
    -DCMAKE_CUDA_COMPILER="${CUDA_HOME}/bin/nvcc" \
    -DCMAKE_CUDA_ARCHITECTURES='60-real;70-real;80-real;86-real' \
    -DGMX_SIMD=AVX2_256 \
    -DGMX_FFT_LIBRARY=fftw3 \
    -DGMX_BUILD_OWN_FFTW=ON \
    -DGMX_BUILD_OWN_FFTW_URL="/tmp/build/fftw-${FFTW_VERSION}.tar.gz" \
    -DGMX_BUILD_OWN_FFTW_MD5="${FFTW_MD5}" \
    -DGMX_HWLOC=ON \
    -DGMX_MPI=OFF \
    -DGMX_THREAD_MPI=ON \
    -DGMX_OPENMP=ON \
    -DGMX_DOUBLE=OFF \
    -DGMXAPI=OFF \
    -DGMX_INSTALL_NBLIB_API=OFF \
    -DGMX_NNPOT=OFF \
    -DGMX_USE_HDF5=OFF \
    -DGMX_PYTHON_PACKAGE=OFF \
    -DGMX_BUILD_HELP=OFF \
    -DGMX_BUILD_MANUAL=OFF \
    -DBUILD_TESTING=OFF \
    -DGMX_BUILD_UNITTESTS=OFF \
    -DREGRESSIONTEST_DOWNLOAD=OFF || exit 1
  # One job per CPU: 2 on the runner, which keeps nvcc inside its 7 GB.
  make -j"$(nproc)" || exit 1
  make install || exit 1

  # cuFFT is the only shared CUDA library gmx needs (the CUDA runtime is linked
  # statically, and libcuda comes from the host's driver through --nv). It goes next to
  # libgromacs, where gmx's $ORIGIN/../lib RUNPATH finds it.
  cp -P "${CUDA_HOME}"/targets/x86_64-linux/lib/libcufft.so.11* "${GMX_PREFIX}/lib/" || exit 1

  # Licences: GROMACS, the libraries built into libgromacs, FFTW and the CUDA EULA that
  # covers cuFFT's redistribution.
  src="/tmp/build/gromacs-${GROMACS_VERSION}"
  mkdir -p "${GMX_PREFIX}/licenses/external"
  cp "${src}/COPYING" "${GMX_PREFIX}/LICENSE" || exit 1
  cp "${src}/AUTHORS" "${src}/CITATION.cff" "${src}/README" "${GMX_PREFIX}/licenses/" || exit 1
  cp "/tmp/build/fftw-${FFTW_VERSION}/COPYING" "${GMX_PREFIX}/licenses/fftw-COPYING" || exit 1
  cp "/tmp/build/fftw-${FFTW_VERSION}/COPYRIGHT" "${GMX_PREFIX}/licenses/fftw-COPYRIGHT" || exit 1
  cp /usr/share/doc/libcufft-12-9/copyright "${GMX_PREFIX}/licenses/cuda-EULA-cufft.txt" || exit 1
  for licence_file in "${src}"/src/external/*/LICENSE* "${src}"/src/external/*/COPYING*; do
    [ -f "${licence_file}" ] || continue
    library_name=$(basename "$(dirname "${licence_file}")")
    case "${library_name}" in
      googletest|clFFT) continue ;;
    esac
    mkdir -p "${GMX_PREFIX}/licenses/external/${library_name}"
    cp "${licence_file}" "${GMX_PREFIX}/licenses/external/${library_name}/" || exit 1
  done

  # Runtime only: no headers, CMake or pkg-config files, or the template for building
  # against libgromacs.
  rm -rf "${GMX_PREFIX}/include" "${GMX_PREFIX}/lib/cmake" "${GMX_PREFIX}/lib/pkgconfig" \
    "${GMX_PREFIX}/share/cmake" "${GMX_PREFIX}/share/gromacs/template" "${GMX_PREFIX}/share/man"
  find "${GMX_PREFIX}" -name '*.a' -type f -delete
  strip --strip-unneeded "${GMX_PREFIX}/bin/gmx" || exit 1
  find "${GMX_PREFIX}/lib" -maxdepth 1 -type f -name 'libgromacs*.so*' -exec strip --strip-unneeded {} + || exit 1

  # Show what gmx links, so a missing runtime library is visible in the build log.
  ldd "${GMX_PREFIX}/bin/gmx"
  du -sh "${GMX_PREFIX}"

  cd / || exit 1
  rm -rf /tmp/build /var/lib/apt/lists/* /var/cache/apt/*

Bootstrap: docker
From: ubuntu:24.04
Stage: final

%files from build
  /opt/gromacs /opt/gromacs

%post
  export DEBIAN_FRONTEND=noninteractive
  # Everything else gmx links is in /opt/gromacs/lib or the base image.
  apt-get update -y
  apt-get install -y --no-install-recommends \
    libgomp1 \
    libhwloc15 || exit 1
  apt-get clean
  rm -rf /var/lib/apt/lists/* /var/cache/apt/*

%environment
  # What GROMACS's GMXRC would set.
  export GROMACS_DIR=/opt/gromacs
  export GMXBIN=/opt/gromacs/bin
  export GMXLDLIB=/opt/gromacs/lib
  export GMXDATA=/opt/gromacs/share/gromacs
  export PATH=/opt/gromacs/bin:$PATH
  export LC_ALL=C.UTF-8

%labels
  Maintainer IDIA <support@ilifu.ac.za>
  Version 2026.4
  Source https://www.gromacs.org/
  License LGPL-2.1-or-later (GROMACS); built with FFTW 3.3.10 (GPL-2.0-or-later) and NVIDIA cuFFT 11.4 (CUDA EULA); bundles Colvars (LGPL-3.0)
  Authors The GROMACS development team (https://gitlab.com/gromacs/gromacs/-/blob/main/AUTHORS)
  CUDA_Version 12.9.1
  CUDA_Architectures sm_60 sm_70 sm_80 sm_86
  SIMD AVX2_256

%help
  GROMACS 2026.4 by the GROMACS development team (https://www.gromacs.org/).

  This image packages the unmodified upstream GROMACS 2026.4 release, built from the
  official source tarball. IDIA builds and maintains the image only; report GROMACS bugs
  upstream (https://gitlab.com/gromacs/gromacs/-/issues, or ask at
  https://gromacs.bioexcel.eu/). Report image problems to support@ilifu.ac.za.

  Build: single precision, CUDA 12.9.1 for P100 (sm_60), V100 (sm_70), A100 (sm_80) and
  A40 (sm_86) GPUs, thread-MPI and OpenMP (no MPI), hwloc, and GROMACS's own FFTW
  3.3.10 with cuFFT on the GPU. The CPU kernels use AVX2_256 SIMD, so the image needs an
  x86-64 CPU with AVX2 and FMA (Intel Haswell or AMD Zen or later). It runs on AVX-512
  nodes too, a little slower than a build for them. There is no PTX, so the GPU code
  runs on compute capability 6.x, 7.x and 8.x GPUs only. On others (for example H100,
  sm_90) GROMACS can't use the GPU: drop -nb/-pme/-update gpu to run on the CPU. The
  host's NVIDIA driver must support CUDA 12.9 (driver 575 or later).

  Usage (--nv makes the host's GPUs and driver visible):
    singularity exec --nv gromacs_2026.4.sif gmx grompp -f md.mdp -c conf.gro -p topol.top -o md.tpr
    singularity exec --nv gromacs_2026.4.sif gmx mdrun -deffnm md \
      -nb gpu -pme gpu -update gpu -ntmpi 1 -ntomp "${SLURM_CPUS_PER_TASK:-1}"
    singularity run gromacs_2026.4.sif --version      # runs gmx

  The standard force fields and data are in /opt/gromacs/share/gromacs/top
  (GMXDATA=/opt/gromacs/share/gromacs). Bind your own structures, topologies and
  force fields with --bind; your current directory is usually mounted already.

  Licence: GROMACS is LGPL-2.1-or-later (/opt/gromacs/LICENSE). The gmx binary is
  statically linked with FFTW 3.3.10, which is GPL-2.0-or-later
  (/opt/gromacs/licenses/fftw-COPYING), so the combined binary is distributed under the
  GPL. NVIDIA's cuFFT library (/opt/gromacs/lib/libcufft.so.11) is redistributed under
  the CUDA Toolkit EULA (/opt/gromacs/licenses/cuda-EULA-cufft.txt). The licences of the
  libraries built into libgromacs are in /opt/gromacs/licenses/external/. The Colvars
  module (https://github.com/Colvars/colvars, LGPL-3.0) is also built into libgromacs;
  upstream ships no separate licence file for it, so its licence is in its source headers.

  Citation: GROMACS asks that you cite the release you used (doi:10.5281/zenodo.23102386
  for 2026.4; see /opt/gromacs/licenses/CITATION.cff) and the GROMACS papers listed in
  /opt/gromacs/licenses/README, e.g. M. J. Abraham et al., SoftwareX 1-2, 19-25 (2015),
  doi:10.1016/j.softx.2015.06.001.

%runscript
  exec gmx "$@"

%test
  export PATH=/opt/gromacs/bin:$PATH
  export GMXDATA=/opt/gromacs/share/gromacs
  # The build host has no GPU or driver.
  export GMX_DISABLE_GPU_DETECTION=1
  export GMX_MAXBACKUP=-1

  if ldd /opt/gromacs/bin/gmx | grep 'not found'; then
    exit 1
  fi

  version_info=$(gmx --version 2>&1) || { echo "${version_info}"; exit 1; }
  echo "${version_info}"
  echo "${version_info}" | grep -Eq '^GROMACS version: +2026\.4$' || exit 1
  echo "${version_info}" | grep -Eq '^GPU support: +CUDA$' || exit 1
  echo "${version_info}" | grep -Eq '^SIMD instructions: +AVX2_256$' || exit 1
  echo "${version_info}" | grep -Eq '^CPU FFT library: +fftw-3\.3\.10' || exit 1

  # A short CPU-only MD run of a box of SPC/E water, to check that grompp, PME (FFTW)
  # and mdrun all work.
  workdir=$(mktemp -d) || exit 1
  cd "${workdir}" || exit 1
  gmx solvate -cs spc216.gro -box 2.5 2.5 2.5 -o water.gro > solvate.out 2>&1 \
    || { cat solvate.out; exit 1; }
  water_count=$(grep -c ' OW' water.gro)
  cat > topol.top <<EOF
#include "oplsaa.ff/forcefield.itp"
#include "oplsaa.ff/spce.itp"

[ system ]
water

[ molecules ]
SOL ${water_count}
EOF
  cat > md.mdp <<'EOF'
integrator    = md
nsteps        = 20
dt            = 0.002
cutoff-scheme = Verlet
nstlist       = 10
coulombtype   = PME
rcoulomb      = 1.0
rvdw          = 1.0
tcoupl        = V-rescale
tc-grps       = System
tau-t         = 0.1
ref-t         = 300
gen-vel       = yes
gen-temp      = 300
nstenergy     = 10
EOF
  gmx grompp -f md.mdp -c water.gro -p topol.top -o md.tpr -maxwarn 2 > grompp.out 2>&1 \
    || { cat grompp.out; exit 1; }
  gmx mdrun -deffnm md -nb cpu -pme cpu -bonded cpu -update cpu \
    -ntmpi 1 -ntomp 2 -pin off > mdrun.out 2>&1 || { cat mdrun.out; exit 1; }
  grep -q 'Finished mdrun' md.log || { cat mdrun.out; exit 1; }
  [ -s md.gro ] || exit 1

  cd / || exit 1
  rm -rf "${workdir}"
Download bioinformatics-gromacs_2026.4.def
#!/bin/sh

  exec gmx "$@"
#!/bin/sh

  export PATH=/opt/gromacs/bin:$PATH
  export GMXDATA=/opt/gromacs/share/gromacs
  # The build host has no GPU or driver.
  export GMX_DISABLE_GPU_DETECTION=1
  export GMX_MAXBACKUP=-1

  if ldd /opt/gromacs/bin/gmx | grep 'not found'; then
    exit 1
  fi

  version_info=$(gmx --version 2>&1) || { echo "${version_info}"; exit 1; }
  echo "${version_info}"
  echo "${version_info}" | grep -Eq '^GROMACS version: +2026\.4$' || exit 1
  echo "${version_info}" | grep -Eq '^GPU support: +CUDA$' || exit 1
  echo "${version_info}" | grep -Eq '^SIMD instructions: +AVX2_256$' || exit 1
  echo "${version_info}" | grep -Eq '^CPU FFT library: +fftw-3\.3\.10' || exit 1

  # A short CPU-only MD run of a box of SPC/E water, to check that grompp, PME (FFTW)
  # and mdrun all work.
  workdir=$(mktemp -d) || exit 1
  cd "${workdir}" || exit 1
  gmx solvate -cs spc216.gro -box 2.5 2.5 2.5 -o water.gro > solvate.out 2>&1 \
    || { cat solvate.out; exit 1; }
  water_count=$(grep -c ' OW' water.gro)
  cat > topol.top <<EOF
#include "oplsaa.ff/forcefield.itp"
#include "oplsaa.ff/spce.itp"

[ system ]
water

[ molecules ]
SOL ${water_count}
EOF
  cat > md.mdp <<'EOF'
integrator    = md
nsteps        = 20
dt            = 0.002
cutoff-scheme = Verlet
nstlist       = 10
coulombtype   = PME
rcoulomb      = 1.0
rvdw          = 1.0
tcoupl        = V-rescale
tc-grps       = System
tau-t         = 0.1
ref-t         = 300
gen-vel       = yes
gen-temp      = 300
nstenergy     = 10
EOF
  gmx grompp -f md.mdp -c water.gro -p topol.top -o md.tpr -maxwarn 2 > grompp.out 2>&1 \
    || { cat grompp.out; exit 1; }
  gmx mdrun -deffnm md -nb cpu -pme cpu -bonded cpu -update cpu \
    -ntmpi 1 -ntomp 2 -pin off > mdrun.out 2>&1 || { cat mdrun.out; exit 1; }
  grep -q 'Finished mdrun' md.log || { cat mdrun.out; exit 1; }
  [ -s md.gro ] || exit 1

  cd / || exit 1
  rm -rf "${workdir}"
# /.singularity.d/env/10-docker2singularity.sh
#!/bin/sh
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# /.singularity.d/env/90-environment.sh
#!/bin/sh
# Custom environment shell code should follow


  # What GROMACS's GMXRC would set.
  export GROMACS_DIR=/opt/gromacs
  export GMXBIN=/opt/gromacs/bin
  export GMXLDLIB=/opt/gromacs/lib
  export GMXDATA=/opt/gromacs/share/gromacs
  export PATH=/opt/gromacs/bin:$PATH
  export LC_ALL=C.UTF-8