PLUMED support in GROMACS

Hello, is it possible to enable the PLUMED library in the current 2021 GROMACS Docker container NVIDIA NGC?

Thank you

Hi tahan,

Thanks for reaching out. You can enable the PLUMED library by:

  1. Copying the Dockerfile found in /usr/src to a mounted directory
  2. Navigating to the line above the Gromacs RUN block and adding
RUN apt-get update -y && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        xxd && \
    rm -rf /var/lib/apt/lists/*
# https://github.com/plumed/plumed2/releases/download/v2.7.1/plumed-2.7.1.tgz
RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp https://github.com/plumed/plumed2/releases/download/v2.7.1/plumed-2.7.1.tgz && \
    mkdir -p /var/tmp && tar -x -f /var/tmp/plumed-2.7.1.tgz -C /var/tmp -z && \
    cd /var/tmp/plumed-2.7.1 && \
    ./configure  && \
    make -j 4 && \
    make install && \
    rm -rf /var/tmp/plumed-2.7.1 /var/tmp/plumed-2.7.1.tgz
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib \
    PATH=$PATH:/usr/local/bin \
    PLUMED_KERNEL=/usr/local/lib/libplumedKernel.so

This downloads and compiles the PLUMED library

  1. Adding the PLUMED patch in each Gromacs RUN block just after cding into the Gromacs directory:
 plumed patch -p --runtime -e gromacs-2021

Each block should look similar to:

RUN mkdir -p /var/tmp && cd /var/tmp && git clone --depth=1 --branch v2021.1 https://github.com/gromacs/gromacs.git gromacs && cd - && \
    cd /var/tmp/gromacs && \
    plumed patch -p --runtime -e gromacs-2021 && \
    sed -i 's/ifdef __PGI/if 0/g' src/gromacs/fileio/xdrf.h && \
    mkdir -p /var/tmp/gromacs/build && cd /var/tmp/gromacs/build && CC=gcc CFLAGS='-march=haswell -mtune=generic -O3 -pipe' CXX=g++ CXXFLAGS='-march=haswell -mtune=generic -O3 -pipe' FFLAGS='-march=haswell -mtune=generic -O3 -pipe' LDFLAGS=-Wl,--as-needed cmake -DCMAKE_INSTALL_PREFIX=/usr/local/gromacs/avx2_256 -DGMX_SIMD=AVX2_256 -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_C_FLAGS_RELEASE='-march=haswell -mtune=generic -O3 -pipe -DNDEBUG' -DCMAKE_CXX_FLAGS_RELEASE='-march=haswell -mtune=generic -O3 -pipe -DNDEBUG' -DREGRESSIONTEST_DOWNLOAD=off -DBUILD_SHARED_LIBS=ON -DGMX_GPU=CUDA -DGMX_OPENMP=True -DGMX_FFT_LIBRARY=fftw3 -DFFTWF_LIBRARY=/usr/local/fftw/lib/libfftw3f.so -DFFTWF_INCLUDE_DIR=/usr/local/fftw/include -DGMX_BUILD_OWN_FFTW=OFF -DGMX_BUILD_OWN_BLAS=ON -DGMX_BUILD_OWN_LAPACK=ON -DGMX_DOUBLE=OFF -DGMX_X11=OFF -DGMX_CUDA_TARGET_SM='60;70;75;80' -DGMX_CUDA_VERSION=11.2 -DGMX_THREAD_MPI=ON /var/tmp/gromacs && \
    cmake --build /var/tmp/gromacs/build --target all -- -j$(nproc) && \
    cmake --build /var/tmp/gromacs/build --target install -- -j$(nproc) && \
    rm -rf /var/tmp/gromacs
  1. Navigating to the line above Gromacs COPY block and adding:
# https://github.com/plumed/plumed2/releases/download/v2.7.1/plumed-2.7.1.tgz
COPY --from=build /usr/local/lib/libplumedKernel.so /usr/local/lib/libplumedKernel.so
COPY --from=build /usr/local/lib /usr/local/lib
COPY --from=build /usr/local/bin /usr/local/bin
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib \
    PATH=$PATH:/usr/local/bin \
    PLUMED_KERNEL=/usr/local/lib/libplumedKernel.so

This ensures the PLUMED library is within your runtime container

  1. Exiting the container and rebuilding using the Dockerfile just edited

I hope this helps, please let me know if there are any issues that pop up as this hasn’t been rigorously tested.

Thanks,

Jillian