Skip to content

Installing a personal version of Gromacs

A very popular application on Apocrita is Gromacs, but we only provide modules for fairly simple compilation variants. Some more advanced users may want to compile additional personal versions with more granular compilation options.

Searching for available variants

So, first of all, let's see what is on offer by default. This time, along with the -x (explicitly installed) and -p (installation prefix) flags we used previously for nano above, we will also add in the -v (variant) flag:

spack find output
$ spack -C ${HOME}/spack-config-templates/1.1.1 find -x -p -v gromacs
-- linux-rocky9-x86_64_v4 / no compilers ------------------------
gromacs@2024.1~cp2k~cuda~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only~mpi+nblib~nosuffix~opencl+openmp~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release generator=make openmp_max_threads=none                                 /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2024.1-yekd62f-serial
gromacs@2024.1~cp2k~cuda~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only+mpi+nblib~nosuffix~opencl+openmp~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release generator=make openmp_max_threads=none                                 /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2024.1-openmpi-5.0.3-55bdvpa-mpi
gromacs@2024.1~cp2k+cuda~cufftmp~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only+mpi+nblib~nosuffix~opencl+openmp~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release cuda_arch:=70,80,90 generator=make openmp_max_threads=none     /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2024.1-openmpi-5.0.3-tzp3elt-mpi
gromacs@2024.3~cp2k~cuda~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only~mpi+nblib~nosuffix~opencl+openmp~relaxed_double_precision+shared build_system=cmake build_type=Release generator=make openmp_max_threads=none                                      /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/gromacs/2024.3-uhqvqaj-serial
gromacs@2024.3~cp2k~cuda~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only+mpi+nblib~nosuffix~opencl+openmp~relaxed_double_precision+shared build_system=cmake build_type=Release generator=make openmp_max_threads=none                                      /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/gromacs/2024.3-openmpi-5.0.5-q4j2vts-mpi
gromacs@2024.3~cp2k+cuda~cufftmp~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only+mpi+nblib~nosuffix~nvshmem~opencl+openmp~relaxed_double_precision+shared build_system=cmake build_type=Release cuda_arch:=70,80,90 generator=make openmp_max_threads=none  /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2024.3-openmpi-5.0.3-4tmxysw-mpi
==> 6 installed packages

As you can see, the output of the spack find command includes an incredibly long list of variants, either marked with ~ (false) or + (true). You can see a list of all possible variants for a particular Spack package in two ways.

Spack Packages website

Package information is for the develop branch

The Spack Packages website lists information such as versions available, variants etc. from the develop branch of Spack. Some versions and variants may not be available in the specific Spack release you are using.

The Spack Packages website is an online catalogue of all available packages in Spack. The page for Gromacs can be found here:

https://packages.spack.io/package.html?name=gromacs

You'll see available versions, dependencies, maintainers and various other information, but for the purposes of this tutorial, the most important section is "Variants":

Gromacs variants

There is quite a long list, and the defaults (true) or (false) are marked in brackets after each item in the list. For the versions centrally compiled, we have largely stuck to the defaults.

The spack info command

Another way to check which variants are available is to use the spack info command:

spack info output (click to expand)
$ spack -C ${HOME}/spack-config-templates/1.1.1 info gromacs
CMakePackage:   gromacs

Description:
    GROMACS is a molecular dynamics package primarily designed for
    simulations of proteins, lipids and nucleic acids. It was originally
    developed in the Biophysical Chemistry department of University of
    Groningen, and is now maintained by contributors in universities and
    research centers across the world. GROMACS is one of the fastest and
    most popular software packages available and can run on CPUs as well as
    GPUs. It is free, open source released under the GNU Lesser General
    Public License. Before the version 4.6, GROMACS was released under the
    GNU General Public License.

Homepage: https://www.gromacs.org

Preferred version:  
    2026.0    https://ftp.gromacs.org/gromacs/gromacs-2026.0.tar.gz

Safe versions:  
    main      [git] https://gitlab.com/gromacs/gromacs.git on branch main
    2026.0    https://ftp.gromacs.org/gromacs/gromacs-2026.0.tar.gz
    2025.4    https://ftp.gromacs.org/gromacs/gromacs-2025.4.tar.gz
    2025.3    https://ftp.gromacs.org/gromacs/gromacs-2025.3.tar.gz
    2025.2    https://ftp.gromacs.org/gromacs/gromacs-2025.2.tar.gz
    2025.1    https://ftp.gromacs.org/gromacs/gromacs-2025.1.tar.gz
    2025.0    https://ftp.gromacs.org/gromacs/gromacs-2025.0.tar.gz
    2024.6    https://ftp.gromacs.org/gromacs/gromacs-2024.6.tar.gz
    2024.5    https://ftp.gromacs.org/gromacs/gromacs-2024.5.tar.gz
    2024.4    https://ftp.gromacs.org/gromacs/gromacs-2024.4.tar.gz
    2024.3    https://ftp.gromacs.org/gromacs/gromacs-2024.3.tar.gz
    2024.2    https://ftp.gromacs.org/gromacs/gromacs-2024.2.tar.gz
    2024.1    https://ftp.gromacs.org/gromacs/gromacs-2024.1.tar.gz
    2024      https://ftp.gromacs.org/gromacs/gromacs-2024.tar.gz
    2019.6    https://ftp.gromacs.org/gromacs/gromacs-2019.6.tar.gz

Deprecated versions:  
    None

Variants:
    build_system [cmake]                     cmake
        Build systems supported by the package

    build_type [Release]                     Debug, MinSizeRel, Profile, Reference, RelWithAssert, RelWithDebInfo, Release
        The build type to build

    cp2k [false]                             false, true
        CP2K QM/MM interface integration

    cuda [false]                             false, true
        Build with CUDA

    cuda_arch [none]                         none, 10, 100, 100a, 100f, 101, 101a, 101f, 103, 103a, 103f, 11, 110, 110a, 110f, 12, 120, 120a, 120f, 121, 121a, 121f, 13,
                                             20, 21, 30, 32, 35, 37, 50, 52, 53, 60, 61, 62, 70, 72, 75, 80, 86, 87, 89, 90, 90a
      when +cuda
        CUDA architecture

    cufftmp [false]                          false, true
      when @2022:+cuda+mpi
        Enable multi-GPU FFT support with cuFFTMp

    cycle_subcounters [false]                false, true
        Enables cycle subcounters

    double [false]                           false, true
        Produces a double precision version of the executables

    generator [make]                         none
      when  build_system=cmake
        the build system generator to use

    gmxapi [true]                            false, true
      when @2019:
        Build and install the gmxlib python API for GROMACS

    heffte [false]                           false, true
      when @2021:+mpi
        Enable multi-GPU FFT support with HeFFTe

    hwloc [true]                             false, true
        Use the hwloc portable hardware locality library

    intel-data-center-gpu-max [false]        false, true
      when @2022:+sycl
        Enable support for Intel Data Center GPU Max

    intel_provided_gcc [false]               false, true
        Use this if Intel compiler is installed through spack. The g++ location is written to icp{c,x}.cfg

    ipo [false]                              false, true
      when  build_system=cmake %cmake@3.9:
        CMake interprocedural optimization

    itt [false]                              false, true
      when @2024:
        Enable Instrumentation and Tracing Technology (ITT) profiling API (from Intel)

    mdrun_only [false]                       false, true
        Enables the build of a cut-down version of libgromacs and/or the mdrun program

    mpi [true]                               false, true
        Activate MPI support (disable for Thread-MPI support)

    nblib [true]                             false, true
      when @2021:
        Build and install the NB-LIB C++ API for GROMACS

    nosuffix [false]                         false, true
        Disable default suffixes

    nvshmem [false]                          false, true
      when @2024:+cuda+mpi
        Enable NVSHMEM support for Nvidia GPUs

    opencl [false]                           false, true
        Enable OpenCL support

    openmp [true]                            false, true
        Enables OpenMP at configure time

    openmp_max_threads [none]                none
        Max number of OpenMP threads

    plumed [false]                           false, true
      when @2016.5:2016.6,2018.4,2018.6,2018.8,2019.2,2019.4,2019.6,2020.2,2020.4:2020.7,=2021,2021.4:2021.7,2022.3,2022.5,=2023,2023.5,2024.2:2024.3,2025.0
        Enable PLUMED support

    relaxed_double_precision [false]         false, true
        GMX_RELAXED_DOUBLE_PRECISION, use only for Fujitsu PRIMEHPC

    shared [true]                            false, true
        Enables the build of shared libraries

    sve [true]                               false, true
      when  target=neoverse_v1:,neoverse_v2:,neoverse_n2:
        Enable SVE on aarch64 if available

    sve [true]                               false, true
      when  target=a64fx
        Enable SVE on aarch64 if available

    sycl [false]                             false, true
      when @2021:
        Enable SYCL support


Dependencies:
    blas                       build, link

    c                          build

    cmake@2.8.8:3              build

    cmake@3.4.3:3              build
      when @2018:

    cmake@3.9.6:3              build
      when @2020

    cmake@3.13.0:3             build
      when @2021

    cmake@3.16.0:3             build
      when %fj

    cmake@3.16.3:3             build
      when @2022:

    cmake@3.18.4:3             build
      when @2023:

    cmake@3.28.0:3             build
      when @2025:

    cmake@3.28.0:3             build
      when @main

    cp2k@8.1:                  build, link
      when +cp2k

    cuda                       build, link
      when +cuda

    cuda@:6.0                  build, link
      when  cuda_arch=10

    cuda@:6.5                  build, link
      when  cuda_arch=11

    cuda@2.1:6.5               build, link
      when  cuda_arch=12

    cuda@2.1:6.5               build, link
      when  cuda_arch=13

    cuda@3.0:8.0               build, link
      when  cuda_arch=20

    cuda@3.2:8.0               build, link
      when  cuda_arch=21

    cuda@5.0:10.2              build, link
      when  cuda_arch=30

    cuda@5.0:10.2              build, link
      when  cuda_arch=32

    cuda@5.0:11.8              build, link
      when  cuda_arch=35

    cuda@6.0:12.9              build, link
      when  cuda_arch=50

    cuda@6.5:11.8              build, link
      when  cuda_arch=37

    cuda@6.5:12.9              build, link
      when  cuda_arch=52

    cuda@6.5:12.9              build, link
      when  cuda_arch=53

    cuda@8.0:12.9              build, link
      when  cuda_arch=60

    cuda@8.0:12.9              build, link
      when  cuda_arch=61

    cuda@8.0:12.9              build, link
      when  cuda_arch=62

    cuda@9.0:12.9              build, link
      when  cuda_arch=70

    cuda@9.0:                  build, link
      when  cuda_arch=72

    cuda@10.0:                 build, link
      when  cuda_arch=75

    cuda@11.0:                 build, link
      when  cuda_arch=80

    cuda@11.1:                 build, link
      when  cuda_arch=86

    cuda@11.4:                 build, link
      when  cuda_arch=87

    cuda@11.8:                 build, link
      when  cuda_arch=89

    cuda@12.0:                 build, link
      when  cuda_arch=90

    cuda@12.0:                 build, link
      when  cuda_arch=90a

    cuda@12.8:12.9             build, link
      when  cuda_arch=101

    cuda@12.8:12.9             build, link
      when  cuda_arch=101a

    cuda@12.8:                 build, link
      when  cuda_arch=100

    cuda@12.8:                 build, link
      when  cuda_arch=100a

    cuda@12.8:                 build, link
      when  cuda_arch=120

    cuda@12.8:                 build, link
      when  cuda_arch=120a

    cuda@12.9                  build, link
      when  cuda_arch=101f

    cuda@12.9:                 build, link
      when  cuda_arch=100f

    cuda@12.9:                 build, link
      when  cuda_arch=103

    cuda@12.9:                 build, link
      when  cuda_arch=103a

    cuda@12.9:                 build, link
      when  cuda_arch=103f

    cuda@12.9:                 build, link
      when  cuda_arch=120f

    cuda@12.9:                 build, link
      when  cuda_arch=121

    cuda@12.9:                 build, link
      when  cuda_arch=121a

    cuda@12.9:                 build, link
      when  cuda_arch=121f

    cuda@13.0:                 build, link
      when  cuda_arch=110

    cuda@13.0:                 build, link
      when  cuda_arch=110a

    cuda@13.0:                 build, link
      when  cuda_arch=110f

    cxx                        build

    fftw-api@3                 build, link

    fortran                    build
      when @:4.5.5

    fortran                    build
      when +cp2k

    gcc                        build, link
      when ~intel_provided_gcc %intel

    gcc-runtime@5:             build, link
      when @2020~intel_provided_gcc %oneapi

    gcc-runtime@7:             build, link
      when @2021:2022~intel_provided_gcc %oneapi

    gcc-runtime@9:             build, link
      when @2023:2024~intel_provided_gcc %oneapi

    gcc-runtime@11:            build, link
      when @2025:~intel_provided_gcc %oneapi

    gmake                      build
      when  build_system=cmake generator=make

    heffte                     build, link
      when +heffte

    hwloc                      build, link
      when @2019:+hwloc

    intel-oneapi-vtune         build, link
      when +itt

    lapack                     build, link

    llvm-openmp                build, run
      when @2025:+openmp %apple-clang@15:

    mpi                        build, link
      when +mpi

    ninja                      build
      when  build_system=cmake generator=ninja

    nvhpc                      build, link
      when +cufftmp

    nvhpc                      build, link
      when +nvshmem

    pkgconfig                  build

    plumed~mpi                 build, link
      when ~mpi+plumed

    plumed+mpi                 build, link
      when +mpi+plumed

    plumed@2.5.0               build, link
      when @2018.4+plumed

    plumed@2.5.0               build, link
      when @2016.5+plumed

    plumed@2.5.1:2.5.2         build, link
      when @2018.6+plumed

    plumed@2.5.1:2.5           build, link
      when @2016.6+plumed

    plumed@2.5.2               build, link
      when @2019.2+plumed

    plumed@2.5.3:2.6.0         build, link
      when @2019.4+plumed

    plumed@2.5.3:2.6           build, link
      when @2018.8+plumed

    plumed@2.6.1               build, link
      when @2020.2+plumed

    plumed@2.6.1:2.8.3         build, link
      when @2019.6+plumed

    plumed@2.6.2:2.7.0         build, link
      when @2020.4+plumed

    plumed@2.7.1               build, link
      when @2020.5+plumed

    plumed@2.7.1:2.7.2         build, link
      when @=2021+plumed

    plumed@2.7.2:2.8.0         build, link
      when @2020.6+plumed

    plumed@2.7.3:2.8.0         build, link
      when @2021.4+plumed

    plumed@2.7.5:2.7.6         build, link
      when @2021.5+plumed

    plumed@2.8.1               build, link
      when @2022.3+plumed

    plumed@2.8.1               build, link
      when @2021.6+plumed

    plumed@2.8.1:2.9.4         build, link
      when @2020.7+plumed

    plumed@2.8.2:2.9.4         build, link
      when @2021.7+plumed

    plumed@2.8.2:2.10.0        build, link
      when @2022.5+plumed

    plumed@2.9.0:2.9.1         build, link
      when @=2023+plumed

    plumed@2.9.2               build, link
      when @2024.2+plumed

    plumed@2.9.2:2.10.0        build, link
      when @2023.5+plumed

    plumed@2.9.3:2.10.0        build, link
      when @2024.3+plumed

    plumed@2.10.0              build, link
      when @2025.0+plumed

    sycl                       build, link
      when +sycl


Licenses:
    GPL-2.0-or-later
      when @:4.5

    LGPL-2.1-or-later
      when @4.6:


==> gromacs has many complex dependencies; consider this for a simpler view:
  spack info gromacs~plumed

Crucially, unlike the Spack Packages website, the output of spack info will be specific to the version of Spack in use. However, users may find the Spack Packages website easier to read.

Installing specific variants

Enable PLUMED support

PLUMED support is only available in version 2025.0 and earlier

As you can see from the output of spack info above, PLUMED support is only supported by Gromacs 2025.0 and earlier.

Add a suffix for your private PLUMED module

By default, the fact that PLUMED support has been added won't be reflected in your private module name. We recommend adding:

gromacs:
  suffixes:
    +plumed: plumed

to the tcl: section of your personal modules.yaml configuration file to help to differentiate. It is already added to the template modules.yaml file in the spack-config-template repository.

One popular compilation variant users often request for Gromacs is PLUMED support. As we saw above, the default for the plumed variant is (false) (which in the context of Spack commands and output becomes ~).

Always run a spec command before install!

You should always check what is about to be installed using the spec command as detailed below and then move onto the install command.

Let's see if we can spec a personal installation of Gromacs adding in PLUMED support. Note that we have added ^openmpi ^fftw+openmp to the commands below; this means that we should compile against Open MPI (as opposed to, say, Intel MPI) and an existing +openmp variant of fftw which avoids compiling a new version of fftw and instead uses the one in upstream:

spack spec output (click to expand)
$ spack -C ${HOME}/spack-config-templates/1.1.1 spec gromacs +plumed ^openmpi ^fftw+openmp
 -   gromacs@2025.0~cp2k~cuda~cycle_subcounters~double+gmxapi~heffte+hwloc~intel_provided_gcc~ipo~itt~mdrun_only+mpi+nblib~nosuffix~opencl+openmp+plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release generator=make openmp_max_threads=none patches:=72cff27,9372c23 platform=linux os=rocky9 target=x86_64_v4 %c,cxx=gcc@14.2.0
[^]      ^cmake@3.30.5~doc+ncurses+ownlibs~qtgui build_system=generic build_type=Release patches:=dbc3892 platform=linux os=rocky9 target=x86_64_v4
[^]          ^curl@8.7.1~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs:=shared,static tls:=openssl platform=linux os=rocky9 target=x86_64_v4
[^]              ^nghttp2@1.57.0 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^openssl@3.3.0~docs+shared build_system=generic certs=mozilla platform=linux os=rocky9 target=x86_64_v4
[^]                  ^ca-certificates-mozilla@2023-05-30 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^gcc-runtime@14.2.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[e]          ^glibc@2.34 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]          ^ncurses@6.5~symlinks+termlib abi=none build_system=autotools patches:=7a351bc platform=linux os=rocky9 target=x86_64_v4
[^]          ^zlib-ng@2.1.6+compat+new_strategies+opt+pic+shared build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]      ^compiler-wrapper@1.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]      ^fftw@3.3.10+mpi+openmp~pfft_patches+shared build_system=autotools patches:=872cff9 precision:=double,float platform=linux os=rocky9 target=x86_64_v4
[e]      ^gcc@14.2.0+binutils+bootstrap~graphite+libsanitizer~mold~nvptx~piclibs~profiled~strip build_system=autotools build_type=RelWithDebInfo languages:='c,c++,fortran' platform=linux os=rocky9 target=x86_64
[^]      ^gcc-runtime@14.2.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[e]      ^glibc@2.34 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]      ^gmake@4.4.1~guile build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^gcc-runtime@11.4.1 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[e]          ^glibc@2.34 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]      ^hwloc@2.9.1~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs:=shared,static platform=linux os=rocky9 target=x86_64_v4
[^]          ^gcc-runtime@12.2.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^libpciaccess@0.17 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^util-macros@1.19.3 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]          ^libxml2@2.10.3+pic~python+shared build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^xz@5.4.6~pic build_system=autotools libs:=shared,static platform=linux os=rocky9 target=x86_64_v4
[^]      ^openblas@0.3.26~bignuma~consistent_fpcsr+dynamic_dispatch+fortran~ilp64+locking+pic+shared build_system=makefile symbol_suffix=none threads=none platform=linux os=rocky9 target=x86_64_v4
[^]          ^perl@5.38.0+cpanm+opcode+open+shared+threads build_system=generic patches:=714e4d1 platform=linux os=rocky9 target=x86_64_v4
[^]              ^berkeley-db@18.1.40+cxx~docs+stl build_system=autotools patches:=26090f4,b231fcc platform=linux os=rocky9 target=x86_64_v4
[^]              ^bzip2@1.0.8~debug~pic+shared build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]              ^gdbm@1.23 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                  ^readline@8.2 build_system=autotools patches:=bbf97f1 platform=linux os=rocky9 target=x86_64_v4
[e]      ^openmpi@5.0.5+atomics~cuda~debug+gpfs~internal-hwloc~internal-libevent~internal-pmix~java~lustre~memchecker~openshmem~romio+rsh~static~two_level_namespace+vt+wrapper-rpath build_system=autotools fabrics:=none romio-filesystem:=none schedulers:=none platform=linux os=rocky9 target=x86_64_v4
[^]      ^pkgconf@2.2.0 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
 -       ^plumed@2.10.0+gsl~metatomic+mpi~pytorch+shared arrayfire=none build_system=autotools optional_modules:=all patches:=d4d2b6a platform=linux os=rocky9 target=x86_64_v4 %c,cxx,fortran=gcc@14.2.0
[^]          ^autoconf@2.72 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]          ^automake@1.16.5 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]          ^gsl@2.8~external-cblas+pic+shared build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]          ^libtool@2.4.7 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^findutils@4.9.0 build_system=autotools patches:=440b954 platform=linux os=rocky9 target=x86_64_v4
[^]          ^m4@1.4.19+sigsegv build_system=autotools patches:=9dc5fbd,bfdffa7 platform=linux os=rocky9 target=x86_64_v4
[^]              ^diffutils@3.10 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^libsigsegv@2.14 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]          ^py-cython@3.0.8 build_system=python_pip platform=linux os=rocky9 target=x86_64_v4
[^]              ^py-pip@23.1.2 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]              ^py-setuptools@69.2.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]              ^py-wheel@0.41.2 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]              ^python@3.11.7+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic patches:=13fa8bf,b0615b2,ebdca64,f2fd060 platform=linux os=rocky9 target=x86_64_v4
[^]                  ^expat@2.6.2+libbsd build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                      ^libbsd@0.12.1 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                          ^libmd@1.0.4 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                  ^gettext@0.22.5+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                      ^tar@1.34 build_system=autotools zip=pigz platform=linux os=rocky9 target=x86_64_v4
[^]                          ^pigz@2.8 build_system=makefile platform=linux os=rocky9 target=x86_64_v4
[^]                          ^zstd@1.5.6+programs build_system=makefile compression:=none libs:=shared,static platform=linux os=rocky9 target=x86_64_v4
[^]                  ^libffi@3.4.6 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                  ^libxcrypt@4.4.35~obsolete_api build_system=autotools patches:=4885da3 platform=linux os=rocky9 target=x86_64_v4
[^]                  ^sqlite@3.43.2+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                  ^util-linux-uuid@2.38.1 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^python-venv@1.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4

So, a lot. To recap the symbols in the above output:

  • - means that the listed application/library is not installed anywhere at all, neither in upstream or personally
  • [^] means that the listed application/library is already installed in upstream and will be used to avoid re-installation
  • [e] means that the listed application/library is marked as external. glibc is marked as external as before, as is Open MPI (as explained in the packages.yaml documentation).

As we can see, everything required to compile Gromacs is already available in our central upstream ([^]) apart from plumed. This plumed will be compiled as part of an install and used during the compilation of a new version of Gromacs itself with PLUMED support.

You should notice that the variant list for gromacs contains +plumed as well. So, as before, let's go ahead and install our personal variant:

spack install output (click to expand)
$ spack -C ${HOME}/spack-config-templates/1.1.1 install -j ${SLURM_NTASKS} gromacs +plumed ^openmpi ^fftw+openmp
[+] /share/apps/rocky9/general/libs/openmpi/gcc/14.2.0/5.0.5 (external openmpi-5.0.5-ccatyv2dkfmw7f433zsigue7ffe2mrfi)
[+] /usr (external glibc-2.34-xri56vcyzs7kkvakhoku3fefc46nw25y)
[+] /usr (external glibc-2.34-vjgsh5eoloariofarhttteo73mj5rgql)
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gcc/14.2.0-4hynq53 (external gcc-14.2.0-bgwfu7hktlwbqpowsmnwitqvfhxjwqhb)
[+] /usr (external glibc-2.34-q2367nemoxqj6j3fg54cg4mjlkvc7f5n)
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/none-none/compiler-wrapper/1.0-oqjjbmb
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc-runtime/11.4.1-llid4hw
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gcc-runtime/12.2.0-w77gg5r
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/gcc-runtime/14.2.0-4w7sesu
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/none-none/gcc-runtime/14.2.0-jdymrk3
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/berkeley-db/18.1.40-cogxxtx
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/findutils/4.9.0-62lolye
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/zstd/1.5.6-my7tyw6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/bzip2/1.0.8-uj4wyhx
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/pkgconf/2.2.0-7wg26bz
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/xz/5.4.6-rwn7pno
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gmake/4.4.1-xchit5a
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/gsl/2.8-dywpxcj
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/ncurses/6.5-4n2uzha
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/nghttp2/1.57.0-4ntqcoo
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/libmd/1.0.4-y6ppafl
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/zlib-ng/2.1.6-g2yruc3
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/libxcrypt/4.4.35-4mszlpj
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/libpciaccess/0.17-tpopwgn
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/libffi/3.4.6-yc4oqfz
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/util-linux-uuid/2.38.1-nkfrifq
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/libtool/2.4.7-c43op4r
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/libsigsegv/2.14-m2gvtuy
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/openblas/0.3.26-nt553wl
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/fftw/3.3.10-openmpi-5.0.5-hdrbd72
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/readline/8.2-ea7drzj
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/libbsd/0.12.1-zb23l3j
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/pigz/2.8-somkvv4
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/libxml2/2.10.3-q6zmsq6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/openssl/3.3.0-filwsx6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/m4/1.4.19-fdljdyg
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gdbm/1.23-bx77xc6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/sqlite/3.43.2-t5xgpdh
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/expat/2.6.2-je4ggnn
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/tar/1.34-ivzmnos
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/hwloc/2.9.1-zqnfdoq
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/curl/8.7.1-v4za2y6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/perl/5.38.0-eyk53wh
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gettext/0.22.5-udcuonu
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/cmake/3.30.5-4ibbdtz
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/autoconf/2.72-h32ralr
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/python/3.11.7-rj3pox3
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/automake/1.16.5-y5sqj65
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/python-venv/1.0-s6divkp
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/py-setuptools/69.2.0-udom3th
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/py-cython/3.0.8-zcf7xi7
==> No binary for plumed-2.10.0-bjxxklvwmx6e72c3qnaabzeo5encesml found: installing from source
==> Installing plumed-2.10.0-bjxxklvwmx6e72c3qnaabzeo5encesml [52/53]
==> Fetching https://mirror.spack.io/_source-cache/archive/ca/ca6410d47e91b4e0f953e1a8933f15b05c4681167611ab3b096ab121155f6879.tar.gz
    [100%]  125.82 MB @  363.7 MB/s
==> Fetching https://mirror.spack.io/_source-cache/archive/d4/d4d2b6a178e4b38863f2acc9450ae27b4652368c369e96dd093bbdffaf811105
    [100%]    1.24 KB @    2.9 MB/s
==> Applied patch https://patch-diff.githubusercontent.com/raw/plumed/plumed2/pull/1313.patch?full_index=1
==> Ran patch() for plumed
==> plumed: Executing phase: 'autoreconf'
==> plumed: Executing phase: 'configure'
==> plumed: Executing phase: 'build'
==> plumed: Executing phase: 'install'
==> plumed: Successfully installed plumed-2.10.0-bjxxklvwmx6e72c3qnaabzeo5encesml
  Stage: 2.73s.  Autoreconf: 3.86s.  Configure: 18.59s.  Build: 2m 28.97s.  Install: 31.24s.  Post-install: 1.06s.  Total: 3m 30.56s
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/plumed/2.10.0-openmpi-5.0.5-bjxxklv
==> No binary for gromacs-2025.0-pojdef6i2g4m2lk44snu2t6cnoxr6fql found: installing from source
==> Installing gromacs-2025.0-pojdef6i2g4m2lk44snu2t6cnoxr6fql [53/53]
==> Fetching https://mirror.spack.io/_source-cache/archive/a2/a27ad35a646295bbec129abe684d9d03d1e2e0bd76b0d625e9055746aaefae82.tar.gz
    [100%]   44.42 MB @   18.6 MB/s
==> Fetching https://mirror.spack.io/_source-cache/archive/93/9372c235719ca04d6dd418fb5943f773e03f05246e3e059a8578089b14b2420c
    [100%]    2.41 KB @    8.7 MB/s
==> Applied patch https://gitlab.com/gromacs/gromacs/-/merge_requests/4966.diff
==> Applied patch /share/apps/rocky9/general/apps/spack-packages/2026.03.0/repos/spack_repo/builtin/packages/gromacs/pr4965-2025.0.patch
NOTE: shell only version, useful when plumed is cross compiled
NOTE: shell only version, useful when plumed is cross compiled
PLUMED patching tool

MD engine: gromacs-2025.0
PLUMED location: /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/plumed/2.10.0-openmpi-5.0.5-bjxxklv/lib/plumed
diff file: /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/plumed/2.10.0-openmpi-5.0.5-bjxxklv/lib/plumed/patches/gromacs-2025.0.diff
sourcing config file: /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/plumed/2.10.0-openmpi-5.0.5-bjxxklv/lib/plumed/patches/gromacs-2025.0.config
Executing plumed_before_patch function
A basic PLUMED interface is already present in GROMACS

This patch previes extra features to be implemented in the official PLUMED integration in the next GROMACS version

Patching must be done in the gromacs root directory  _before_ the cmake command is invoked.

The GROMACS integration has some improvements with the compatibility wiht the multi-threading implementation
but it is still preferable to configure gromacs as

cmake -DGMX_THREAD_MPI=OFF and add -DGMX_MPI=ON if you want to use MPI.

To enable PLUMED in a gromacs simulation one should use
mdrun with an extra -plumed flag. The flag can be used to
specify the name of the PLUMED input file, e.g.:

gmx mdrun -plumed plumed.dat

For more information on gromacs you should visit http://www.gromacs.org

Patching with on-the-fly diff from stored originals
patching file ./cmake/gmxManagePlumed.cmake
patching file ./src/gromacs/applied_forces/plumed/plumedMDModule.cpp
patching file ./src/gromacs/applied_forces/plumed/plumedOptions.cpp
patching file ./src/gromacs/applied_forces/plumed/plumedOptions.h
patching file ./src/gromacs/applied_forces/plumed/plumedforceprovider.cpp
patching file ./src/gromacs/applied_forces/plumed/plumedforceprovider.h
patching file ./src/gromacs/mdrun/runner.cpp
patching file ./src/gromacs/mdrunutility/mdmodulesnotifiers.h

PLUMED is compiled with MPI support so you can configure gromacs-2025.0 with MPI
==> Ran patch() for gromacs
==> gromacs: Executing phase: 'cmake'
==> gromacs: Executing phase: 'build'
==> gromacs: Executing phase: 'install'
==> gromacs: Successfully installed gromacs-2025.0-pojdef6i2g4m2lk44snu2t6cnoxr6fql
  Stage: 4.11s.  Cmake: 22.53s.  Build: 2m 13.86s.  Install: 2.49s.  Post-install: 0.70s.  Total: 2m 46.83s
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/gromacs/2025.0-openmpi-5.0.5-pojdef6

To break down what has happened above:

  • The existing available upstream dependencies have been used from the central location as opposed to being re-installed personally
  • Spack has noticed that plumed and gromacs-2025 are missing and has thus pulled source code tarballs to the source_cache directory defined in config.yaml and then manually compiled both and installed both to the location defined as install_tree: root: in config.yaml.
  • Spack has automatically patched in PLUMED support as requested

Let's now return to our spack find command:

spack find output
$ spack -C ${HOME}/spack-config-templates/1.1.1 find -x -p -v gromacs
-- linux-rocky9-x86_64_v4 / %c,cxx=gcc@14.2.0 -------------------
gromacs@2025.0~cp2k~cuda~cycle_subcounters~double+gmxapi~heffte+hwloc~intel_provided_gcc~ipo~itt~mdrun_only+mpi+nblib~nosuffix~opencl+openmp+plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release generator=make openmp_max_threads=none patches:=72cff27,9372c23  /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/gromacs/2025.0-openmpi-5.0.5-pojdef6

-- linux-rocky9-x86_64_v4 / no compilers ------------------------
gromacs@2024.1~cp2k~cuda~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only~mpi+nblib~nosuffix~opencl+openmp~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release generator=make openmp_max_threads=none                                 /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2024.1-yekd62f-serial
gromacs@2024.1~cp2k~cuda~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only+mpi+nblib~nosuffix~opencl+openmp~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release generator=make openmp_max_threads=none                                 /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2024.1-openmpi-5.0.3-55bdvpa-mpi
gromacs@2024.1~cp2k+cuda~cufftmp~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only+mpi+nblib~nosuffix~opencl+openmp~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release cuda_arch:=70,80,90 generator=make openmp_max_threads=none     /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2024.1-openmpi-5.0.3-tzp3elt-mpi
gromacs@2024.3~cp2k~cuda~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only~mpi+nblib~nosuffix~opencl+openmp~relaxed_double_precision+shared build_system=cmake build_type=Release generator=make openmp_max_threads=none                                      /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/gromacs/2024.3-uhqvqaj-serial
gromacs@2024.3~cp2k~cuda~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only+mpi+nblib~nosuffix~opencl+openmp~relaxed_double_precision+shared build_system=cmake build_type=Release generator=make openmp_max_threads=none                                      /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/gromacs/2024.3-openmpi-5.0.5-q4j2vts-mpi
gromacs@2024.3~cp2k+cuda~cufftmp~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only+mpi+nblib~nosuffix~nvshmem~opencl+openmp~relaxed_double_precision+shared build_system=cmake build_type=Release cuda_arch:=70,80,90 generator=make openmp_max_threads=none  /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2024.3-openmpi-5.0.3-4tmxysw-mpi
==> 7 installed packages

So now we have Gromacs 2025 with PLUMED support (+plumed) installed personally, alongside the other centrally installed versions of Gromacs.

If we now add our specified private module path using module use as specified in modules.yaml:

module use /gpfs/scratch/${USER}/spack/privatemodules/linux-rocky9-x86_64_v4

Then we should see our personal version available for use:

Output from module avail
$ module avail -l gromacs
- Package/Alias -----------------------.- Versions --------.- Last mod. -------
/gpfs/scratch/abc123/spack/privatemodules/linux-rocky9-x86_64_v4:
gromacs-mpi/2025.0-openmpi-5.0.5-gcc-14.2.0-plumed          2026/06/18 09:45:19

/share/apps/rocky9/environmentmodules/apocrita-modules/spack:
gromacs-gpu/2024.1-openmpi-5.0.3-cuda-12.4.0-gcc-12.2.0     2026/05/11 15:15:15
gromacs-gpu/2024.3-openmpi-5.0.3-cuda-12.6.2-gcc-12.2.0     2026/05/11 15:15:15
gromacs-mpi/2024.1-openmpi-5.0.3-gcc-12.2.0                 2026/05/11 15:15:15
gromacs-mpi/2024.3-openmpi-5.0.5-gcc-14.2.0                 2026/05/11 15:15:15
gromacs/2024.1-gcc-12.2.0                                   2026/05/11 15:15:15
gromacs/2024.3-gcc-14.2.0                                   2026/05/11 15:15:15

And indeed, we can load and use our personal version (remember to use the full module name):

Output from module load (click to expand)
$ module load gromacs-mpi/2025.0-openmpi-5.0.5-gcc-14.2.0-plumed
Loading gromacs-mpi/2025.0-openmpi-5.0.5-gcc-14.2.0-plumed
  Loading requirement: openmpi/5.0.5-gcc-14.2.0 gsl/2.8-gcc-14.2.0
$ gmx_mpi --version
                 :-) GROMACS - gmx_mpi, 2025.0-PLUMED_spack (-:

Executable:   /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/gromacs/2025.0-openmpi-5.0.5-pojdef6/bin/gmx_mpi
Data prefix:  /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/gromacs/2025.0-openmpi-5.0.5-pojdef6
Working dir:  /data/home/abc123
Command line:
  gmx_mpi --version

GROMACS version:     2025.0-PLUMED_spack
Precision:           mixed
Memory model:        64 bit
MPI library:         MPI
MPI library version: Open MPI v5.0.5, package: Open MPI abc123@ddy60 Distribution, ident: 5.0.5, repo rev: v5.0.5, Jul 22, 2024
OpenMP support:      enabled (GMX_OPENMP_MAX_THREADS = 128)
GPU support:         disabled
SIMD instructions:   AVX_512
CPU FFT library:     fftw-3.3.10-sse2-avx-avx2-avx2_128-avx512
GPU FFT library:     none
Multi-GPU FFT:       none
RDTSCP usage:        enabled
TNG support:         enabled
Hwloc support:       hwloc-2.9.1
Tracing support:     disabled
C compiler:          /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/none-none/compiler-wrapper/1.0-oqjjbmb/libexec/spack/gcc/gcc GNU 14.2.0
C compiler flags:    -fexcess-precision=fast -funroll-all-loops -march=skylake-avx512 -Wno-missing-field-initializers -O3 -DNDEBUG
C++ compiler:        /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/none-none/compiler-wrapper/1.0-oqjjbmb/libexec/spack/gcc/g++ GNU 14.2.0
C++ compiler flags:  -fexcess-precision=fast -funroll-all-loops -march=skylake-avx512 -Wno-missing-field-initializers -Wno-old-style-cast -Wno-cast-qual -Wno-suggest-override -Wno-suggest-destructor-override -Wno-zero-as-null-pointer-constant -Wno-cast-function-type-strict SHELL:-fopenmp -O3 -DNDEBUG
BLAS library:        External - user-supplied
LAPACK library:      External - user-supplied

Add CUDA support

How about if we wanted Gromacs with PLUMED support but also GPU support via CUDA? It's possible, but you need to specify the right variant. Remember, Spack will install the default variant unless explicitly told otherwise. If you look again at the variants for Gromacs, you will see that cuda is set to (false) by default. The centrally available gromacs-gpu module loads a version that has explicitly been compiled with CUDA support.

Let's see if we can spec a personal installation of Gromacs adding in PLUMED support and CUDA:

Specify your cuda_arch

When installing a CUDA variant of a package from Spack, you must also specify a cuda_arch (sm_70 - Volta V100, sm_80 - Ampere A100, sm_90 - Hopper H100). Some packages, like Gromacs, let you install one variant that supports all three at once, others may require a separate install per cuda_arch required - check the output of the spec command for more details.

spack spec output (click to expand)
$ spack -C ${HOME}/spack-config-templates/1.1.1 spec gromacs +cuda cuda_arch=70,80,90 +plumed ^openmpi ^fftw+openmp ^gcc
 -   gromacs@2025.0~cp2k+cuda~cufftmp~cycle_subcounters~double+gmxapi~heffte+hwloc~intel_provided_gcc~ipo~itt~mdrun_only+mpi+nblib~nosuffix~nvshmem~opencl+openmp+plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release cuda_arch:=70,80,90 generator=make openmp_max_threads=none patches:=72cff27,9372c23 platform=linux os=rocky9 target=x86_64_v4 %c,cxx=gcc@12.2.0
 -       ^cmake@3.31.11~doc+ncurses+ownlibs~qtgui build_system=generic build_type=Release platform=linux os=rocky9 target=x86_64_v4 %c,cxx=gcc@12.2.0
[^]          ^curl@8.7.1~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs:=shared,static tls:=openssl platform=linux os=rocky9 target=x86_64_v4
[^]              ^nghttp2@1.57.0 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^openssl@3.3.0~docs+shared build_system=generic certs=mozilla platform=linux os=rocky9 target=x86_64_v4
[^]                  ^ca-certificates-mozilla@2023-05-30 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^ncurses@6.5~symlinks+termlib abi=none build_system=autotools patches:=7a351bc platform=linux os=rocky9 target=x86_64_v4
[^]          ^zlib-ng@2.1.6+compat+new_strategies+opt+pic+shared build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]      ^compiler-wrapper@1.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]      ^cuda@12.6.2~allow-unsupported-compilers~dev build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^gcc-runtime@12.2.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^libxml2@2.10.3+pic~python+shared build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^xz@5.4.6~pic build_system=autotools libs:=shared,static platform=linux os=rocky9 target=x86_64_v4
 -       ^fftw@3.3.10+mpi+openmp~pfft_patches+shared build_system=autotools patches:=872cff9 precision:=double,float platform=linux os=rocky9 target=x86_64_v4 %c,fortran=gcc@12.2.0
[e]      ^gcc@12.2.0+binutils+bootstrap~graphite+libsanitizer~mold~nvptx~piclibs~profiled~strip build_system=autotools build_type=RelWithDebInfo languages:='c,c++,fortran' platform=linux os=rocky9 target=x86_64
 -       ^gcc-runtime@12.2.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[e]      ^glibc@2.34 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]      ^gmake@4.4.1~guile build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^gcc-runtime@11.4.1 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[e]          ^glibc@2.34 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]      ^hwloc@2.9.1~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs:=shared,static platform=linux os=rocky9 target=x86_64_v4
[^]          ^libpciaccess@0.17 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^util-macros@1.19.3 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]      ^openblas@0.3.26~bignuma~consistent_fpcsr+dynamic_dispatch+fortran~ilp64+locking+pic+shared build_system=makefile symbol_suffix=none threads=none platform=linux os=rocky9 target=x86_64_v4
[^]          ^perl@5.38.0+cpanm+opcode+open+shared+threads build_system=generic patches:=714e4d1 platform=linux os=rocky9 target=x86_64_v4
[^]              ^berkeley-db@18.1.40+cxx~docs+stl build_system=autotools patches:=26090f4,b231fcc platform=linux os=rocky9 target=x86_64_v4
[^]              ^bzip2@1.0.8~debug~pic+shared build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]              ^gdbm@1.23 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                  ^readline@8.2 build_system=autotools patches:=bbf97f1 platform=linux os=rocky9 target=x86_64_v4
[e]      ^openmpi@5.0.5+atomics~cuda~debug+gpfs~internal-hwloc~internal-libevent~internal-pmix~java~lustre~memchecker~openshmem~romio+rsh~static~two_level_namespace+vt+wrapper-rpath build_system=autotools fabrics:=none romio-filesystem:=none schedulers:=none platform=linux os=rocky9 target=x86_64_v4
[^]      ^pkgconf@2.2.0 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
 -       ^plumed@2.10.0+gsl~metatomic+mpi~pytorch+shared arrayfire=none build_system=autotools optional_modules:=all patches:=d4d2b6a platform=linux os=rocky9 target=x86_64_v4 %c,cxx,fortran=gcc@12.2.0
[^]          ^autoconf@2.72 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]          ^automake@1.16.5 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]          ^gsl@2.7.1~external-cblas+pic+shared build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]          ^libtool@2.4.7 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^findutils@4.9.0 build_system=autotools patches:=440b954 platform=linux os=rocky9 target=x86_64_v4
[^]          ^m4@1.4.19+sigsegv build_system=autotools patches:=9dc5fbd,bfdffa7 platform=linux os=rocky9 target=x86_64_v4
[^]              ^diffutils@3.10 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^libsigsegv@2.14 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]          ^py-cython@3.0.8 build_system=python_pip platform=linux os=rocky9 target=x86_64_v4
[^]              ^py-pip@23.1.2 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]              ^py-setuptools@69.2.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]              ^py-wheel@0.41.2 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]              ^python@3.11.7+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic patches:=13fa8bf,b0615b2,ebdca64,f2fd060 platform=linux os=rocky9 target=x86_64_v4
[^]                  ^expat@2.6.2+libbsd build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                      ^libbsd@0.12.1 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                          ^libmd@1.0.4 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                  ^gettext@0.22.5+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                      ^tar@1.34 build_system=autotools zip=pigz platform=linux os=rocky9 target=x86_64_v4
[^]                          ^pigz@2.8 build_system=makefile platform=linux os=rocky9 target=x86_64_v4
[^]                          ^zstd@1.5.6+programs build_system=makefile compression:=none libs:=shared,static platform=linux os=rocky9 target=x86_64_v4
[^]                  ^libffi@3.4.6 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                  ^libxcrypt@4.4.35~obsolete_api build_system=autotools patches:=4885da3 platform=linux os=rocky9 target=x86_64_v4
[^]                  ^sqlite@3.43.2+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                  ^util-linux-uuid@2.38.1 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^python-venv@1.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4

So a similar output to the PLUMED variant above, but adding in CUDA 12 (which comes from upstream). Almost everything required to compile Gromacs is already available in our central upstream ([^]), including cuda. We've added ^gcc to the spec to ensure that GCC is used as the compiler.

A couple of extra new variants need to be compiled for cmake, fftw and plumed, so they have been pulled in along the way.

Gromacs should therefore now compile with PLUMED and CUDA support. You should notice that the variant list for gromacs contains +cuda, +plumed and cuda_arch=70,80,90 as well. So, as before, let's go ahead and install our personal variant:

spack install output (click to expand)
$ spack -C ${HOME}/spack-config-templates/1.1.1 install -j ${SLURM_NTASKS} gromacs +cuda cuda_arch=70,80,90 +plumed ^openmpi ^fftw+openmp ^gcc
[+] /usr (external glibc-2.34-xri56vcyzs7kkvakhoku3fefc46nw25y)
[+] /share/apps/rocky9/general/libs/openmpi/gcc/14.2.0/5.0.5 (external openmpi-5.0.5-ccatyv2dkfmw7f433zsigue7ffe2mrfi)
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc/12.2.0-6frskzg (external gcc-12.2.0-c6glrz75exefrjwq5gurxmxiqkc34ubt)
[+] /usr (external glibc-2.34-q2367nemoxqj6j3fg54cg4mjlkvc7f5n)
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/none-none/compiler-wrapper/1.0-oqjjbmb
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc-runtime/11.4.1-llid4hw
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gcc-runtime/12.2.0-w77gg5r
==> No binary for gcc-runtime-12.2.0-izdgkrf2zc5ncd62truxpouji3o6yjge found: installing from source
==> Installing gcc-runtime-12.2.0-izdgkrf2zc5ncd62truxpouji3o6yjge [8/52]
==> No patches needed for gcc-runtime
==> gcc-runtime: Executing phase: 'install'
==> gcc-runtime: Successfully installed gcc-runtime-12.2.0-izdgkrf2zc5ncd62truxpouji3o6yjge
  Stage: 0.00s.  Install: 0.73s.  Post-install: 0.13s.  Total: 0.91s
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/none-none/gcc-runtime/12.2.0-izdgkrf
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/zlib-ng/2.1.6-g2yruc3
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/libsigsegv/2.14-m2gvtuy
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/zstd/1.5.6-my7tyw6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/bzip2/1.0.8-uj4wyhx
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/berkeley-db/18.1.40-cogxxtx
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gmake/4.4.1-xchit5a
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/openblas/0.3.26-nt553wl
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/util-linux-uuid/2.38.1-nkfrifq
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/libpciaccess/0.17-tpopwgn
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/findutils/4.9.0-62lolye
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/xz/5.4.6-rwn7pno
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gsl/2.7.1-ynxvfrc
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/pkgconf/2.2.0-7wg26bz
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/openssl/3.3.0-filwsx6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/libxcrypt/4.4.35-4mszlpj
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/libmd/1.0.4-y6ppafl
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/libffi/3.4.6-yc4oqfz
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/pigz/2.8-somkvv4
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/m4/1.4.19-fdljdyg
==> No binary for fftw-3.3.10-dn4vmy45ookj4pqcagre2jretijpftdw found: installing from source
==> Installing fftw-3.3.10-dn4vmy45ookj4pqcagre2jretijpftdw [28/52]
==> Fetching https://mirror.spack.io/_source-cache/archive/56/56c932549852cddcfafdab3820b0200c7742675be92179e59e6215b340e26467.tar.gz
    [100%]    4.14 MB @  173.0 MB/s
==> Fetching https://mirror.spack.io/_source-cache/archive/87/872cff9a7d346e91a108ffd3540bfcebeb8cf86c7f40f6b31fd07a80267cbf53
    [100%]    1.15 KB @    8.3 MB/s
==> Applied patch https://github.com/FFTW/fftw3/commit/f69fef7aa546d4477a2a3fd7f13fa8b2f6c54af7.patch?full_index=1
==> Ran patch() for fftw
==> fftw: Executing phase: 'autoreconf'
==> fftw: Executing phase: 'configure'
==> fftw: Executing phase: 'build'
==> fftw: Executing phase: 'install'
==> fftw: Successfully installed fftw-3.3.10-dn4vmy45ookj4pqcagre2jretijpftdw
  Stage: 0.28s.  Autoreconf: 0.00s.  Configure: 54.27s.  Build: 2m 5.28s.  Install: 4.74s.  Post-install: 0.11s.  Total: 3m 5.08s
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/fftw/3.3.10-openmpi-5.0.5-dn4vmy4
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/ncurses/6.5-4n2uzha
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/nghttp2/1.57.0-4ntqcoo
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/libxml2/2.10.3-q6zmsq6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/libbsd/0.12.1-zb23l3j
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/tar/1.34-ivzmnos
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/libtool/2.4.7-c43op4r
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/readline/8.2-ea7drzj
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/curl/8.7.1-v4za2y6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/hwloc/2.9.1-zqnfdoq
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/cuda/12.6.2-7ahvfr4
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/expat/2.6.2-je4ggnn
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gettext/0.22.5-udcuonu
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/sqlite/3.43.2-t5xgpdh
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gdbm/1.23-bx77xc6
==> No binary for cmake-3.31.11-6b4ejcdtoghalj675oh5zaubmoow3sci found: installing from source
==> Installing cmake-3.31.11-6b4ejcdtoghalj675oh5zaubmoow3sci [43/52]
==> Fetching https://mirror.spack.io/_source-cache/archive/c0/c0a3b3f2912b2166f522d5010ffb6029d8454ee635f5ad7a3247e0be7f9a15c9.tar.gz
    [100%]   11.72 MB @   64.3 MB/s
==> Ran patch() for cmake
==> cmake: Executing phase: 'bootstrap'
==> cmake: Executing phase: 'build'
==> cmake: Executing phase: 'install'
==> cmake: Successfully installed cmake-3.31.11-6b4ejcdtoghalj675oh5zaubmoow3sci
  Stage: 0.88s.  Bootstrap: 1m 8.55s.  Build: 1m 29.52s.  Install: 6.67s.  Post-install: 2.33s.  Total: 2m 49.29s
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/cmake/3.31.11-6b4ejcd
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/python/3.11.7-rj3pox3
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/perl/5.38.0-eyk53wh
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/python-venv/1.0-s6divkp
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/automake/1.16.5-y5sqj65
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/autoconf/2.72-h32ralr
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/py-setuptools/69.2.0-udom3th
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/py-cython/3.0.8-zcf7xi7
==> No binary for plumed-2.10.0-22xeqtyg7j6fadkeihxpxccitaz36d4n found: installing from source
==> Installing plumed-2.10.0-22xeqtyg7j6fadkeihxpxccitaz36d4n [51/52]
==> Using cached archive: /gpfs/scratch/abc123/spack/cache/_source-cache/archive/ca/ca6410d47e91b4e0f953e1a8933f15b05c4681167611ab3b096ab121155f6879.tar.gz
==> Using cached archive: /gpfs/scratch/abc123/spack/cache/_source-cache/archive/d4/d4d2b6a178e4b38863f2acc9450ae27b4652368c369e96dd093bbdffaf811105
==> Applied patch https://patch-diff.githubusercontent.com/raw/plumed/plumed2/pull/1313.patch?full_index=1
==> Ran patch() for plumed
==> plumed: Executing phase: 'autoreconf'
==> plumed: Executing phase: 'configure'
==> plumed: Executing phase: 'build'
==> plumed: Executing phase: 'install'
==> plumed: Successfully installed plumed-2.10.0-22xeqtyg7j6fadkeihxpxccitaz36d4n
  Stage: 3.13s.  Autoreconf: 3.73s.  Configure: 15.33s.  Build: 2m 21.62s.  Install: 27.08s.  Post-install: 0.76s.  Total: 3m 14.76s
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/plumed/2.10.0-openmpi-5.0.5-22xeqty
==> No binary for gromacs-2025.0-4yyomyzkgq2yzuttxxtlzvb6g5qlesli found: installing from source
==> Installing gromacs-2025.0-4yyomyzkgq2yzuttxxtlzvb6g5qlesli [52/52]
==> Using cached archive: /gpfs/scratch/abc123/spack/cache/_source-cache/archive/a2/a27ad35a646295bbec129abe684d9d03d1e2e0bd76b0d625e9055746aaefae82.tar.gz
==> Using cached archive: /gpfs/scratch/abc123/spack/cache/_source-cache/archive/93/9372c235719ca04d6dd418fb5943f773e03f05246e3e059a8578089b14b2420c
==> Applied patch https://gitlab.com/gromacs/gromacs/-/merge_requests/4966.diff
==> Applied patch /share/apps/rocky9/general/apps/spack-packages/2026.03.0/repos/spack_repo/builtin/packages/gromacs/pr4965-2025.0.patch
NOTE: shell only version, useful when plumed is cross compiled
NOTE: shell only version, useful when plumed is cross compiled
PLUMED patching tool

MD engine: gromacs-2025.0
PLUMED location: /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/plumed/2.10.0-openmpi-5.0.5-22xeqty/lib/plumed
diff file: /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/plumed/2.10.0-openmpi-5.0.5-22xeqty/lib/plumed/patches/gromacs-2025.0.diff
sourcing config file: /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/plumed/2.10.0-openmpi-5.0.5-22xeqty/lib/plumed/patches/gromacs-2025.0.config
Executing plumed_before_patch function
A basic PLUMED interface is already present in GROMACS

This patch previes extra features to be implemented in the official PLUMED integration in the next GROMACS version

Patching must be done in the gromacs root directory  _before_ the cmake command is invoked.

The GROMACS integration has some improvements with the compatibility wiht the multi-threading implementation
but it is still preferable to configure gromacs as

cmake -DGMX_THREAD_MPI=OFF and add -DGMX_MPI=ON if you want to use MPI.

To enable PLUMED in a gromacs simulation one should use
mdrun with an extra -plumed flag. The flag can be used to
specify the name of the PLUMED input file, e.g.:

gmx mdrun -plumed plumed.dat

For more information on gromacs you should visit http://www.gromacs.org

Patching with on-the-fly diff from stored originals
patching file ./cmake/gmxManagePlumed.cmake
patching file ./src/gromacs/applied_forces/plumed/plumedMDModule.cpp
patching file ./src/gromacs/applied_forces/plumed/plumedOptions.cpp
patching file ./src/gromacs/applied_forces/plumed/plumedOptions.h
patching file ./src/gromacs/applied_forces/plumed/plumedforceprovider.cpp
patching file ./src/gromacs/applied_forces/plumed/plumedforceprovider.h
patching file ./src/gromacs/mdrun/runner.cpp
patching file ./src/gromacs/mdrunutility/mdmodulesnotifiers.h

PLUMED is compiled with MPI support so you can configure gromacs-2025.0 with MPI
==> Ran patch() for gromacs
==> gromacs: Executing phase: 'cmake'
==> gromacs: Executing phase: 'build'
==> gromacs: Executing phase: 'install'
==> gromacs: Successfully installed gromacs-2025.0-4yyomyzkgq2yzuttxxtlzvb6g5qlesli
  Stage: 1.22s.  Cmake: 32.03s.  Build: 2m 20.46s.  Install: 2.71s.  Post-install: 0.52s.  Total: 2m 59.12s
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2025.0-openmpi-5.0.5-4yyomyz

To break down what has happened above:

  • The existing available upstream dependencies have been used from the central location as opposed to being re-installed personally
  • Spack has re-used the cached tarballs that were already pulled for the first PLUMED and Gromacs variants that have already been installed
  • Spack has compiled the few additional variants of dependencies that are missing
  • Spack has automatically patched in PLUMED and CUDA support as requested

Let's now return to our spack find command:

spack find output
$ spack -C ${HOME}/spack-config-templates/1.1.1 find -x -p -v gromacs
-- linux-rocky9-x86_64_v4 / %c,cxx=gcc@12.2.0 -------------------
gromacs@2025.0~cp2k+cuda~cufftmp~cycle_subcounters~double+gmxapi~heffte+hwloc~intel_provided_gcc~ipo~itt~mdrun_only+mpi+nblib~nosuffix~nvshmem~opencl+openmp+plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release cuda_arch:=70,80,90 generator=make openmp_max_threads=none patches:=72cff27,9372c23  /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2025.0-openmpi-5.0.5-4yyomyz

-- linux-rocky9-x86_64_v4 / %c,cxx=gcc@14.2.0 -------------------
gromacs@2025.0~cp2k~cuda~cycle_subcounters~double+gmxapi~heffte+hwloc~intel_provided_gcc~ipo~itt~mdrun_only+mpi+nblib~nosuffix~opencl+openmp+plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release generator=make openmp_max_threads=none patches:=72cff27,9372c23  /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/gromacs/2025.0-openmpi-5.0.5-pojdef6

-- linux-rocky9-x86_64_v4 / no compilers ------------------------
gromacs@2024.1~cp2k~cuda~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only~mpi+nblib~nosuffix~opencl+openmp~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release generator=make openmp_max_threads=none                                 /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2024.1-yekd62f-serial
gromacs@2024.1~cp2k~cuda~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only+mpi+nblib~nosuffix~opencl+openmp~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release generator=make openmp_max_threads=none                                 /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2024.1-openmpi-5.0.3-55bdvpa-mpi
gromacs@2024.1~cp2k+cuda~cufftmp~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only+mpi+nblib~nosuffix~opencl+openmp~relaxed_double_precision+shared~sycl build_system=cmake build_type=Release cuda_arch:=70,80,90 generator=make openmp_max_threads=none     /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2024.1-openmpi-5.0.3-tzp3elt-mpi
gromacs@2024.3~cp2k~cuda~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only~mpi+nblib~nosuffix~opencl+openmp~relaxed_double_precision+shared build_system=cmake build_type=Release generator=make openmp_max_threads=none                                      /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/gromacs/2024.3-uhqvqaj-serial
gromacs@2024.3~cp2k~cuda~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only+mpi+nblib~nosuffix~opencl+openmp~relaxed_double_precision+shared build_system=cmake build_type=Release generator=make openmp_max_threads=none                                      /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-14.2.0/gromacs/2024.3-openmpi-5.0.5-q4j2vts-mpi
gromacs@2024.3~cp2k+cuda~cufftmp~cycle_subcounters~double+gmxapi+hwloc~intel_provided_gcc~ipo~mdrun_only+mpi+nblib~nosuffix~nvshmem~opencl+openmp~relaxed_double_precision+shared build_system=cmake build_type=Release cuda_arch:=70,80,90 generator=make openmp_max_threads=none  /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2024.3-openmpi-5.0.3-4tmxysw-mpi
==> 8 installed packages

So now we have Gromacs 2025 with PLUMED support (+plumed) and Gromacs 2025 with PLUMED (+plumed) and CUDA (+cuda cuda_arch=70,80,90) support installed personally alongside the other centrally installed versions of Gromacs.

As long as we still have our specified private module path loaded using module use:

module use /gpfs/scratch/${USER}/spack/privatemodules/linux-rocky9-x86_64_v4

Then we should see our personal versions available for use:

Output from module avail
$ module avail -l gromacs
- Package/Alias -----------------------.- Versions --------.- Last mod. -------
/gpfs/scratch/abc123/spack/privatemodules/linux-rocky9-x86_64_v4:
gromacs-gpu/2025.0-openmpi-5.0.5-cuda-12.6.2-gcc-12.2.0-plumed2026/06/18 16:03:44
gromacs-mpi/2025.0-openmpi-5.0.5-gcc-14.2.0-plumed          2026/06/18 09:45:19

/share/apps/rocky9/environmentmodules/apocrita-modules/spack:
gromacs-gpu/2024.1-openmpi-5.0.3-cuda-12.4.0-gcc-12.2.0     2026/06/18 10:02:12
gromacs-gpu/2024.3-openmpi-5.0.3-cuda-12.6.2-gcc-12.2.0     2026/06/18 10:02:12
gromacs-mpi/2024.1-openmpi-5.0.3-gcc-12.2.0                 2026/06/18 10:02:12
gromacs-mpi/2024.3-openmpi-5.0.5-gcc-14.2.0                 2026/06/18 10:02:12
gromacs/2024.1-gcc-12.2.0                                   2026/06/18 10:02:13
gromacs/2024.3-gcc-14.2.0                                   2026/06/18 10:02:13

And indeed, we can load and use our personal version:

Output from module load (click to expand)
$ gromacs-gpu/2025.0-openmpi-5.0.5-cuda-12.6.2-gcc-12.2.0-plumed
Loading gromacs-gpu/2025.0-openmpi-5.0.5-cuda-12.6.2-gcc-12.2.0-plumed
  Loading requirement: openmpi/5.0.5-gcc-14.2.0 gsl/2.7.1-gcc-12.2.0 cuda/12.6.2-gcc-12.2.0
$ gmx_mpi --version
                 :-) GROMACS - gmx_mpi, 2025.0-PLUMED_spack (-:

Executable:   /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2025.0-openmpi-5.0.5-4yyomyz/bin/gmx_mpi
Data prefix:  /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gromacs/2025.0-openmpi-5.0.5-4yyomyz
Working dir:  /data/home/abc123
Command line:
  gmx_mpi --version

GROMACS version:     2025.0-PLUMED_spack
Precision:           mixed
Memory model:        64 bit
MPI library:         MPI
MPI library version: Open MPI v5.0.5, package: Open MPI abc123@ddy60 Distribution, ident: 5.0.5, repo rev: v5.0.5, Jul 22, 2024
OpenMP support:      enabled (GMX_OPENMP_MAX_THREADS = 128)
GPU support:         CUDA
NBNxM GPU setup:     super-cluster 2x2x2 / cluster 8 (cluster-pair splitting on)
SIMD instructions:   AVX_512
CPU FFT library:     fftw-3.3.10-sse2-avx-avx2-avx2_128-avx512
GPU FFT library:     cuFFT
Multi-GPU FFT:       none
RDTSCP usage:        enabled
TNG support:         enabled
Hwloc support:       hwloc-2.9.1
Tracing support:     disabled
C compiler:          /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/none-none/compiler-wrapper/1.0-oqjjbmb/libexec/spack/gcc/gcc GNU 12.2.0
C compiler flags:    -fexcess-precision=fast -funroll-all-loops -march=skylake-avx512 -Wno-missing-field-initializers -O3 -DNDEBUG
C++ compiler:        /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/none-none/compiler-wrapper/1.0-oqjjbmb/libexec/spack/gcc/g++ GNU 12.2.0
C++ compiler flags:  -fexcess-precision=fast -funroll-all-loops -march=skylake-avx512 -Wno-missing-field-initializers -Wno-old-style-cast -Wno-cast-qual -Wno-suggest-override -Wno-suggest-destructor-override -Wno-zero-as-null-pointer-constant -Wno-cast-function-type-strict SHELL:-fopenmp -O3 -DNDEBUG
BLAS library:        External - user-supplied
LAPACK library:      External - user-supplied
CUDA compiler:       /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/cuda/12.6.2-7ahvfr4/bin/nvcc nvcc: NVIDIA (R) Cuda compiler driver;Copyright (c) 2005-2024 NVIDIA Corporation;Built on Thu_Sep_12_02:18:05_PDT_2024;Cuda compilation tools, release 12.6, V12.6.77;Build cuda_12.6.r12.6/compiler.34841621_0
CUDA compiler flags: -O3 -DNDEBUG
CUDA driver:         0.0
CUDA runtime:        12.60

So, as you can see, we have both plumed and CUDA details listed.

Summary

The above examples show just two of the many possible variants of Gromacs that you can compile yourself. To compile additional variants, change the required parameters to (true) with + or (false) with ~ in spec and install commands, and remember Spack will always follow the defaults unless explicitly told otherwise.

You could, for example, spec and install a much more complex variant such as:

gromacs +cuda cuda_arch=70,80,90 +cufftmp +double +plumed ^openmpi ^fftw+openmp ^gcc

which would compile with CUDA, multi-GPU FFT support with cuFFTMp, produce a double precision version of the executables and also add PLUMED support.

Or you could use:

gromacs ~mpi +plumed ^fftw~mpi ^gcc

Which would compile a serial version of Gromacs with the gmx (as opposed to gmx_mpi) binary (much like our central gromacs/2024.3-gcc-14.2.0 module for example) but with PLUMED support added.

The more complex the variant, the less is likely to be already in upstream, so bear this in mind, as compilation and installation time may increase as well.