Skip to content

[GROMACS] [package list]

GROMACS/2024.3-cpeGNU-24.03-QMMM-PLUMED-2.9.3-noPython-CPU (GROMACS-2024.3-cpeGNU-24.03-QMMM-PLUMED-2.9.3-noPython-CPU.eb)

Install with the EasyBuild-user module:

eb GROMACS-2024.3-cpeGNU-24.03-QMMM-PLUMED-2.9.3-noPython-CPU.eb -r
To access module help after installation and get reminded for which stacks and partitions the module is installed, use module spider GROMACS/2024.3-cpeGNU-24.03-QMMM-PLUMED-2.9.3-noPython-CPU.

EasyConfig:

# Contributed by Luca Marsella and Victor Holanda Rusu (CSCS)
#
# This file is an EasyBuild reciPY as per https://github.com/hpcugent/easybuild
#
# Copyright:: Copyright 2012-2013 University of Luxembourg / LCSB, Cyprus Institute / CaSToRC, Ghent University
# Authors::   Wiktor Jurkowski <wiktor.jurkowski@uni.lu>, Fotis Georgatos <fotis.georgatos@uni.lu>, \
# George Tsouloupas <g.tsouloupas@cyi.ac.cy>, Kenneth Hoste
# License::   MIT/GPL
# $Id$
#
# This work implements a part of the HPCBIOS project and is a component of the policy:
# http://hpcbios.readthedocs.org/en/latest/HPCBIOS_2012-93.html
#
# Adapted by Kurt Lust (kurt.lust@uantwerpen.be) for the LUMI consortium
#
#
#DOC This version of GROMACS is built with support for PLUMED and with
#DOC CP2K QM/MM support. Only MPI versions are provided due to the requirements
#DOC for CP2K. Double precision recommended, but single precision binaries are
#DOC also provided.
#
easyblock = 'CMakeMake'

local_crayfftw_version =    '3.3.10.1'

local_PLUMED2_9_version =    '2.9.3'         # https://github.com/plumed/plumed2/releases
local_CP2K_version =         '2024.2'

name =          'GROMACS'
version =       '2024.3'
versionsuffix = f'-QMMM-PLUMED-{local_PLUMED2_9_version}-noPython-CPU'

homepage = 'http://www.gromacs.org'

whatis = [
    'Description: GROMACS is a versatile package to perform molecular dynamics, i.e. simulate the Newtonian equations of motion for systems with hundreds to millions of particles.',
    'Extensions: Includes PLUMED %s and libcp2k' % local_PLUMED2_9_version,
]

description = """
GROMACS is a versatile package to perform molecular dynamics, i.e. simulate the
Newtonian equations of motion for systems with hundreds to millions of
particles. This version supports QM/MM computations via libcp2k.

Binaries included:
* gmx_mpi: Compiled with support for MPI and OpenMP.
* gmx_mpi_d: Compiled with support for MPI and OpenMP and using double precision
  arithmetic. Note that the manual recommends to use this version with QM/MM
  computations and not the single precision one.

The module sets the environment variables that would otherwise be set by running
the script $EBROOTGROMACS/bin/GMXRC. So running this script should not be
necessary in most cases.

It is compiled with support for PLUMED.

The module also defines the shell function gromacs-completion that can be used to
turn bash command completion on for GROMACS. Note that unloading the module will
not turn this off, so it may have consequences for things you do later on or
conflict with the command completion of a different version of GROMACS.

This module is compiled with support for huge pages via the cray-hugepages modules.
Using those can significantly lower the cost of memory access. However, to benefit
from this you will have to load a suitable cray-hugepages module, e.g.,
$ module load craype-hugepages2M
However, if the size is too large, you may get out-of-memory messages due to memory
fragmentation. Hence it may require some experimenting to find the optimal page
size.
"""

toolchain = {'name': 'cpeGNU', 'version': '24.03'}
toolchainopts = {'opt': True, 'usempi': True, 'verbose': False, 'pic': True, 'openmp': True}

source_urls = ['https://ftp.gromacs.org/pub/gromacs/']
sources =     [SOURCELOWER_TAR_GZ]
checksums =   ['bbda056ee59390be7d58d84c13a9ec0d4e3635617adf2eb747034922cba1f029']

builddependencies = [
    ('buildtools',         '%(toolchain_version)s', '', True), # For CMake
    ('craype-hugepages2M', EXTERNAL_MODULE),
]

dependencies = [
    (f'cray-fftw/{local_crayfftw_version}', EXTERNAL_MODULE),
    ('PLUMED',   local_PLUMED2_9_version,   '-noPython'),
    ('CP2K',     local_CP2K_version,        '-libcp2k-CPU'),
]

local_common_opts = ' '.join([
    '-DCMAKE_BUILD_TYPE=Release',
    '-DCMAKE_INSTALL_LIBDIR=lib',  # Install in lib instead of lib64 for consistency with autotools installations
    '-DBUILD_SHARED_LIBS=OFF',     # Static build as libcp2k is also static
    '-DGMXAPI=OFF',                # Suggested by the instructions for a QM/MM build
    '-DGMX_INSTALL_NBLIB_API=OFF', # Suggested by the instructions for a QM/MM build
    '-DGMX_OPENMP=ON',
    '-DGMX_GPU=OFF',               # CPU build
    '-DGMX_SIMD=AVX2_256',         # Force AVX2_256, as this is best for Zen3 (the manual claims that AVX2_128 is best for Zen2 and we don't want GROMACS to take that when cross-compiling).
    '-DGMX_CYCLE_SUBCOUNTERS=ON',
    '-DGMX_BUILD_OWN_FFTW=OFF',    # We already use cray-fftw for PLUMED and would have conflics otherwise
    '-DGMX_DEFAULT_SUFFIX=ON',
    '-DGMX_THREAD_MPI=OFF',        # According to the PLUMED manual, PLUMED is not compatible with Thread-MPI and it should be turned off.
    '-DGMX_CP2K=ON',               # Enable QM/MM build with libcp2k, https://manual.gromacs.org/current/install-guide/index.html#installing-with-cp2k
    f'-DCP2K_DIR=$EBROOTCP2K/lib',
    '-DCP2K_LINKER_FLAGS="$(pkg-config --libs libcp2k)"', # Should not be needed for this version of CP2K but turns out to be needed
])

preconfigopts = ' cd ../gromacs-%(version)s && plumed-patch -p -e gromacs-%(version)s -m shared && cd - && '

configopts = [
    # single precision
    #local_common_opts + ' -DGMX_MPI=OFF',   # libcp2k does not work without MPI.
    local_common_opts + ' -DGMX_MPI=ON',    # The manual encourages double precision though for QM/MM
    # double precision
    #local_common_opts + ' -DGMX_MPI=OFF -DGMX_DOUBLE=ON',  # libcp2k does not work without MPI.
    local_common_opts + ' -DGMX_MPI=ON  -DGMX_DOUBLE=ON',
]

buildopts = 'VERBOSE=1'

skipsteps = ['test']

sanity_check_paths = {
    'files': [
                'bin/gmx_mpi', 
                'bin/gmx_mpi_d', 
             ],
    'dirs':  ['share']
}

# Ensure that plumed is indeed present using sanity_check_commands
sanity_check_commands = [
#    'gmx       mdrun -h |& grep plumed',
    'gmx_mpi   mdrun -h |& grep plumed',
#    'gmx_d     mdrun -h |& grep plumed',
    'gmx_mpi_d mdrun -h |& grep plumed',
]

# This does what GMXRC.bash does except that it does not enable the command completion.
modextravars = {
    'GROMACS_DIR':     '%(installdir)s',
    'GMXBIN':          '%(installdir)s/bin',
    'GMXLDLIB':        '%(installdir)s/lib64',
    'GMXMAN':          '%(installdir)s/share/man',
    'GMXDATA':         '%(installdir)s/share/data',
    'GMXTOOLCHAINDIR': '%(installdir)s/share/cmake', # Defined in the standard script but not exported.
}

local_bash_completion = """
[==[
  if test -n "${BASH_VERSION+set}" && (complete) > /dev/null 2>&1; then
    if (shopt -s extglob) > /dev/null 2>&1; then
      shopt -s extglob ;
      if [ -f $GMXBIN/gmx-completion.bash ]; then
        source $GMXBIN/gmx-completion.bash ;
        for cfile in $GMXBIN/gmx-completion-*.bash ; do
          source $cfile ;
        done ;
      fi ;
    fi ;
  elif test -n "${ZSH_VERSION+set}" > /dev/null 2>&1 ; then
    autoload bashcompinit ;
    if (bashcompinit) > /dev/null 2>&1; then
      bashcompinit ;
      if [ -f $GMXBIN/gmx-completion.bash ]; then
        source $GMXBIN/gmx-completion.bash ;
        for cfile in $GMXBIN/gmx-completion-*.bash ; do
          source $cfile ;
        done ;
      fi ;
    fi ;
  fi
]==]
"""

local_csh_completion = '"echo \'Not implemented\'"'

modluafooter = """
set_shell_function( 'gromacs-completion', %(bash_completion)s, %(csh_completion)s )
""" % {
    'bash_completion': local_bash_completion,
    'csh_completion':  local_csh_completion,
}

moduleclass = 'bio'

[GROMACS] [package list]