GROMACS

分子动力学模拟(molecular dynamics simulation,MD)是时下最广泛为人采用的计算庞大复杂系统的方法,自1970年起,由于分子模拟的发展迅速,人们系统地建立了许多适用于生化分子体系、聚合物、金属与非金属材料的力场,使得计算复杂体系的结构与一些热力学与光谱性质的能力及精准性大为提升。分子动力学模拟是应用这些力场及根据牛顿运动力学原理所发展的计算方法。

GROMACS是一个用于分子动力学模拟和能量最小化的计算引擎,其通过牛顿平衡方程来模拟几百到数以百万的原子体系。其设计初衷主要用于生物分子,例如具有大量复杂键联系的蛋白,脂和核酸分子,但GROMACS如今同样被用来计算非生物体系的非键联系,例如聚合物。 GROMACS相比其它分子动力学模拟软件具有一些其独有的优势:

  • GROMACS免费,其遵循LGPL协议(GNU Lesser General Public License),在Github上可以找到GROMACS的开源代码;

  • GROMACS提供相比其他软件更高的性能,在代码上进行了许多的优化;

  • GROMACS对于拓扑文件与参数设置文件阅读友好,其与Python的设置格式类似;

  • GROMACS的生态环境发展良好,模拟许多分析工具对GROMACS支持都较为优秀。

关于GROMACS的更多信息请访问GROMACS官网

一、作业提交参数说明

用户可通过公共模板提交GROMACS作业,与GROMACS相关的作业参数如下:

参数 描述
gromacs file 运行实例的源文件
gromacs cmd 实例运行的命令行参数

二、GROMACS作业运行参考

1.在/path/to/OPENMPI/hosts中提前写好节点信息

#cat /path/to/OPENMPI/hosts
node1 slots=4
node2 slots=4
mpimaster slots=4

2.执行命令 , 执行nvt平衡

#此命令为分子动力学模拟中一个步骤-NVT平衡。共3个节点,每个节点4核心,共12核心
mpirun --allow-run-as-root -n 12 -hostfile /path/to/OPENMPI/hosts gmx_mpi mdrun -deffnm nvt
gmx energy -f nvt.edr

3.结果

生成.xvg文件,可使用xmgrace(linux版)打开查看

截图截图截图截图截图截图截图截图截图截图截图截图截图截图截图截图截图截图截图截图

4.modulefile 示例

#%Module1.0#####################################################################
proc ModulesHelp { } {
        puts stderr " "
        puts stderr "This module loads the gromacs utility"
        puts stderr "\nVersion 2021.02\n"  
}
module-whatis "Name: gromacs"
module-whatis "Version: 2021.02"
module-whatis "URL https://manual.gromacs.org/"
set     APPS_HOME    /opt/ohpc/pub/apps/gromacs/  
prepend-path    PATH                    ${APPS_HOME}/bin
prepend-path    LIBRARY_PATH            ${APPS_HOME}/lib64
prepend-path    LD_LIBRARY_PATH         ${APPS_HOME}/lib64
prepend-path    INCLUDE                 ${APPS_HOME}/include
prepend-path    MANPATH                 ${APPS_HOME}/share/man<

5.执行文件

topol_pme.tpr.0

6.input文件

#job_name=gromacs
#run_time=24:00:00
partition=dell_intel
node_num=3
task_per_node=32
gromacs_file=/home/wushiming/gromacs/topol_pme.tpr
#work_dir=/home/wushiming/gromacs
gromacs_cmd='mdrun -ntomp 1 -nsteps 100000 -pin on'

7.执行脚本

#!/bin/sh
source /home/wushiming/gromacs/gromacs_input
##check input var
time=`date +%m%d_%H%M%S`
if [ "x$job_name" == "x" ];then
sbatch_job_name="YHPC_$time "
else
sbatch_job_name=$job_name
fi
if [ "x$partition" == "x" ];then
sbatch_partition=""
else
sbatch_partition=$partition
fi
if [ "x$work_dir" == "x" ];then
mkdir -p /home/yhpc/YHPC_$time
sbatch_work_dir=/home/yhpc/YHPC_$time
else
sbatch_work_dir=$work_dir
fi


if [ "x$run_time" == "x" ];then
sbatch_run_time=03:00:00
else
sbatch_run_time=$run_time
fi
if [ "x$gromacs_file" == "x" ];then
echo "The analysis_file cannot be empty."
exit 1
else
sbatch_gromacs_file=$gromacs_file
fi
if [ "x$gromacs_cmd" == "x" ];then
echo "The gromacs_cmd cannot be empty."
exit 1
else
sbatch_gromacs_cmd=$gromacs_cmd
fi
sbatch_node_num=$node_num
sbatch_task_per_node=$task_per_node
sbatch_err_log=$sbatch_work_dir/%j.err
sbatch_out_log=$sbatch_work_dir/%j.out
### Write basic job infomations
#echo -e "The start time is: `date +"%Y-%m-%d %H:%M:%S"` \n"
#echo -e "My job ID is: $SLURM_JOB_ID \n"
#echo -e "The total cores is: $total_cores \n"
#echo -e "The hosts is: \n"
#srun -np $node_num -nnp 1 hostname
cat > $sbatch_work_dir/gromacs.slurm <<EOF
#!/bin/bash
#SBATCH --ntasks-per-node=$sbatch_task_per_node
#SBATCH --job-name $sbatch_job_name
#SBATCH --nodes=$sbatch_node_num
#SBATCH --mail-type=ALL
#SBATCH --partition $sbatch_partition
#SBATCH --chdir=$sbatch_work_dir
#SBATCH -e $sbatch_err_log
#SBATCH -o $sbatch_out_log
ulimit -s unlimited
ulimit -l unlimited
# 导入运行环境
module purge
source /opt/ohpc/pub/apps/intel/setvars.sh
module load intel/mpi-2021.1.1
module load gnu8/8.3.0
module load gromacs/2021.2
export I_MPI_OFI_PROVIDER=Verbs
export FI_VERBS_IFACE=team1.282
mpirun -genv I_MPI_FABRICS ofi gmx_mpi $sbatch_gromacs_cmd -s $sbatch_gromacs_file
echo -e "The end time is: `date +"%Y-%m-%d %H:%M:%S"` \n"
EOF
sed -i 's/SLURM*/\$SLURM/g' $sbatch_work_dir/gromacs.slurm
/usr/bin/sbatch $sbatch_work_dir/gromacs.slurm

results matching ""

    No results matching ""