0. 概述

    PLUMED是一款计算自由能的免费软件。通常PLUMED作为一种插件与常用的分子动力学软件结合计算体系自由,其包含了伞状采样和元动力学等等多种常用方法。\

    本文介绍如何在Cenots 7编译带plumed插件的Gromacs20.06版本。

1. 编译环境

1、 Intel编译器
2、 Centos 7.x
3、 gsl(GNU Scientific Library)
4、 CUDA 11.2

2. 编译gsl

官网下载GSL包

tar -zxvf gsl-latest.tar.gz
cd gsl-2.7.1
./configure --prefix=/home/public/apps/gsl2.7.1
make -j
make install

3. 编译Plumed

官网下载Plumed压缩包

source /home/public/apps/intel/18/compilers_and_libraries_2018.5.274/linux/bin/iccvars.sh intel64  ##设置intel编译环境\
tar -zxvf plumed-2.8.0.tgz
cd plumed-2.8.0
./configure --prefix=/home/public/apps/plumed2.8
make -j
make

4. 编译Gromacs

切换高版本gcc编译器,使用安装了cmake的conda环境,(见编译Gromacs2020.6 GPU版本的2.1及2.2) 并加载plumed及gsl环境。

scl enable devtoolset-7 bash
conda activate gmx2020_gpu
export PLUMED_ROOT=/home/public/apps/plumed_2.8.0/lib/plumed/
export PATH=/home/public/apps/plumed_2.8.0/bin/:$PATH
export LD_LIBRARY_PATH=/home/public/apps/plumed_2.8.0/lib/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/home/public/apps/gsl2.7/lib/:$LD_LIBRARY_PATH

获取Gromacs压缩包

tar -zxvf gromacs-2020.6.tar.gz
cd gromacs-2020.6
plumed patch -p  ##打开后选择Gromacs2020.6版本即可
mkdir build 
cd build
cmake .. -DGMX_BUILD_OWN_FFTW=ON  -DCMAKE_INSTALL_PREFIX=/home/public/apps/gmx2020.6_gpu_plumed -DGMX_SIMD=AVX_256 -DGMX_GPU=on ##CPU版本则将-DGMX_GPU=on改为OFF
make -j
make install

5. slurm提交脚本范例

#!/bin/bash
#SBATCH -N 1
##SBATCH -n 8
#SBATCH --cpus-per-task=8
#SBATCH --gpus-per-task=1
#SBATCH -p WHEEL
#SBATCH --nodelist=compute-0-14

cd $SLURM_SUBMIT_DIR

source /home/public/apps/intel/18/compilers_and_libraries_2018.5.274/linux/bin/iccvars.sh intel64
export PLUMED_ROOT=/home/public/apps/plumed_2.8.0/lib/plumed/
export PATH=/home/public/apps/plumed_2.8.0/bin/:$PATH
export LD_LIBRARY_PATH=/home/public/apps/plumed_2.8.0/lib/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/home/public/apps/gsl2.7/lib/:$LD_LIBRARY_PATH
source /home/public/apps/gmx2020.6_gpu_plumed/bin/GMXRC

gmx mdrun -v -deffnm md -nt 8 -gpu_id 0 -update gpu