#!/bin/bash # ndx:http://bbs.keinsci.com/thread-16290-1-1.html alias gmx = "gmx_mpi" # 参数设置 PDB_FILE="5sws_fixer.pdb" # 输入的PDB文件 INPUT_FOLDER="/path/to/input" # 输入文件夹路径 TEMP_FOLDER="/path/to/temp" # 临时文件夹路径 OUTPUT_FOLDER="/path/to/output" # 输出文件夹路径 # 确保临时和输出文件夹存在 mkdir -p "$TEMP_FOLDER" mkdir -p "$OUTPUT_FOLDER" # 文件路径 INDEX_FILE="${INPUT_FOLDER}/index.ndx" TPR_FILE="${INPUT_FOLDER}/md.tpr" # 提取索引文件 echo "q" | gmx_mpi make_ndx -f ${PDB_FILE} -o index.ndx # step 0: Remove water and output a new XTC file echo "Remove water and output a new XTC file" | gmx_mpi trjconv -s ${TPR_FILE} -f ${XTC_FILE} -o ${TEMP_FOLDER}/no_water.xtc -pbc mol # Center the protein in the trajectory echo "Protein" | gmx_mpi trjconv -s ${TPR_FILE} -f ${TEMP_FOLDER}/no_water.xtc -o ${TEMP_FOLDER}/centered.xtc -center -pbc mol # Extract frames every 1000 ps from the centered trajectory and output to a PDB file echo "Protein" | gmx_mpi trjconv -s ${TPR_FILE} -f ${TEMP_FOLDER}/centered.xtc -o ${OUTPUT_FOLDER}/${MDRUN_NAME}.pdb -dt ${EXTRACT_EVERY_PS} -pbc mol -center # 提取ndx文件 echo -e "Protein\nq\n" | gmx make_ndx -f 5sws_fixer.pdb -o index.ndx # Command 1: 提取蛋白质 echo "Protein" | gmx trjconv -dt 1000 -s "${TPR_FILE}" -f "${XTC_FILE}" -n "${TEMP_FOLDER}/tarj_show.ndx" -pbc mol -o "${TEMP_FOLDER}/temp.xtc" # Command 2: 中心对齐蛋白质 echo "Protein\nProtein\nProtein" | gmx trjconv -s "${TPR_FILE}" -f "${TEMP_FOLDER}/temp.xtc" -n "${TEMP_FOLDER}/tarj_show.ndx" -center -fit rot+trans -o "${OUTPUT_FOLDER}/traj_show.xtc" # Command 3: 抽取帧生成 .pdb 文件 echo "Protein\nProtein\nProtein" | gmx trjconv -s "${TPR_FILE}" -f "${TEMP_FOLDER}/temp.xtc" -n "${TEMP_FOLDER}/tarj_show.ndx" -center -fit rot+trans -b 0 -e 0 -o "${OUTPUT_FOLDER}/tarj_show.pdb"