update gromacs script
This commit is contained in:
@@ -20,14 +20,17 @@ DT=${DT:-0.002} # 2 fs
|
|||||||
#BOXCENTER="2.5"
|
#BOXCENTER="2.5"
|
||||||
# Define simulation name variable
|
# Define simulation name variable
|
||||||
MDRUN_NAME=${MDRUN_NAME:-"md"}
|
MDRUN_NAME=${MDRUN_NAME:-"md"}
|
||||||
|
NDX_NAME=${NDX_NAME:-"index"}
|
||||||
# Define analysis parameters
|
# Define analysis parameters
|
||||||
# Define other filenames based on MDRUN_NAME
|
# Define other filenames based on MDRUN_NAME
|
||||||
TPR_FILE="${MDRUN_NAME}.tpr"
|
TPR_FILE="${MDRUN_NAME}.tpr"
|
||||||
XTC_FILE="${MDRUN_NAME}.xtc"
|
XTC_FILE="${MDRUN_NAME}.xtc"
|
||||||
|
NDX_FILE="${NDX_NAME}.ndx"
|
||||||
NO_PBC_XTC_FILE="${MDRUN_NAME}_noPBC.xtc"
|
NO_PBC_XTC_FILE="${MDRUN_NAME}_noPBC.xtc"
|
||||||
OUTPUT_FOLDER=${OUTPUT_FOLDER:-"analysis_results"}
|
OUTPUT_FOLDER=${OUTPUT_FOLDER:-"frame_extraction_output"}
|
||||||
|
TEMP_FOLDER=${TEMP_FOLDER:-"temp"}
|
||||||
# Define variables for frame extraction
|
# Define variables for frame extraction
|
||||||
EXTRACT_EVERY_PS=${EXTRACT_EVERY_PS:-1000} # Default to 1000 ps if not set
|
EXTRACT_EVERY_PS=${EXTRACT_EVERY_PS:-100} # Default to 100 ps if not set
|
||||||
|
|
||||||
# Print the current settings
|
# Print the current settings
|
||||||
echo "Current settings:"
|
echo "Current settings:"
|
||||||
@@ -204,7 +207,7 @@ gmx_mpi mdrun -v -deffnm npt
|
|||||||
# gmx energy -f npt.edr -o density.xvg
|
# gmx energy -f npt.edr -o density.xvg
|
||||||
# md
|
# md
|
||||||
# --- md.mdp file content --- #
|
# --- md.mdp file content --- #
|
||||||
cat << EOF > md.mdp
|
cat << EOF > ${MDRUN_NAME}.mdp
|
||||||
title = OPLS Lysozyme NPT equilibration
|
title = OPLS Lysozyme NPT equilibration
|
||||||
; Run parameters
|
; Run parameters
|
||||||
integrator = md ; leap-frog integrator
|
integrator = md ; leap-frog integrator
|
||||||
@@ -258,10 +261,57 @@ gmx_mpi grompp -f ${MDRUN_NAME}.mdp -c npt.gro -t npt.cpt -p topol.top -o ${TPR_
|
|||||||
|
|
||||||
# Run the simulation
|
# Run the simulation
|
||||||
gmx_mpi mdrun -deffnm ${MDRUN_NAME}
|
gmx_mpi mdrun -deffnm ${MDRUN_NAME}
|
||||||
# analysis
|
|
||||||
# Create analysis output directory
|
# extra ndx file , select protein
|
||||||
|
echo -e "1\nq" | gmx_mpi make_ndx -f ${MDRUN_NAME}.gro -o ${NDX_FILE}
|
||||||
|
# echo -e "1\nq" | gmx_mpi make_ndx -f md.gro -o index.ndx
|
||||||
|
|
||||||
|
# Create extraction output directory
|
||||||
mkdir -p ${OUTPUT_FOLDER}
|
mkdir -p ${OUTPUT_FOLDER}
|
||||||
|
|
||||||
|
# Create temp output directory
|
||||||
|
mkdir -p ${TEMP_FOLDER}
|
||||||
|
|
||||||
|
echo -e "1\nq" | gmx_mpi trjconv -dt ${EXTRACT_EVERY_PS} -s ${TPR_FILE} -f ${XTC_FILE} -n ${NDX_FILE} -pbc mol -o ${TEMP_FOLDER}/temp.xtc
|
||||||
|
|
||||||
|
# echo -e "1\nq" | gmx_mpi trjconv -dt 100 -s md.tpr -f md.xtc -n index.ndx -pbc mol -o temp/temp.xtc
|
||||||
|
|
||||||
|
echo -e "1\n1\n1" | gmx_mpi trjconv -s ${TPR_FILE} -f ${TEMP_FOLDER}/temp.xtc -n ${NDX_FILE} -center -fit rot+trans -o ${TEMP_FOLDER}/traj_show.xtc
|
||||||
|
|
||||||
|
# echo -e "1\n1\n1" | gmx_mpi trjconv -s md.tpr -f temp/temp.xtc -n index.ndx -center -fit rot+trans -o temp/traj_show.xtc
|
||||||
|
|
||||||
|
echo -e "1\n1\n1" | gmx_mpi trjconv -s ${TPR_FILE} -f ${TEMP_FOLDER}/temp.xtc -n ${NDX_FILE} -center -fit rot+trans -b 0 -e 0 -o ${TEMP_FOLDER}/tarj_show.pdb
|
||||||
|
|
||||||
|
# echo -e "1\n1\n1" | gmx_mpi trjconv -s md.tpr -f temp/temp.xtc -n index.ndx -center -fit rot+trans -b 0 -e 0 -o temp/tarj_show.pdb
|
||||||
|
|
||||||
|
# Group 1 ( Protein)
|
||||||
|
|
||||||
|
# ---
|
||||||
|
# Step 1: Extract frames every 1000 ps
|
||||||
|
gmx_mpi trjconv -s ${TPR_FILE} -f ${XTC_FILE} -o ${OUTPUT_FOLDER}/${NO_PBC_XTC_FILE} -dt ${EXTRACT_EVERY_PS} -pbc mol <<EOF
|
||||||
|
0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Step 2: Center and fit the trajectory
|
||||||
|
# Centering the protein and fitting to the initial frame
|
||||||
|
gmx_mpi trjconv -s ${TPR_FILE} -f ${OUTPUT_FOLDER}/${NO_PBC_XTC_FILE} -o ${OUTPUT_FOLDER}/${NO_PBC_XTC_FILE} -pbc mol -center <<EOF
|
||||||
|
1
|
||||||
|
1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Step 3: Output PDB format file
|
||||||
|
gmx_mpi trjconv -s ${TPR_FILE} -f ${OUTPUT_FOLDER}/${NO_PBC_XTC_FILE} -o ${OUTPUT_FOLDER}/${MDRUN_NAME}.pdb -pbc mol -center <<EOF
|
||||||
|
1
|
||||||
|
0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Continue with further analysis like RMSD calculation...
|
||||||
|
# ... [other analysis commands] ...
|
||||||
|
|
||||||
|
# End of script
|
||||||
|
|
||||||
|
# command reference
|
||||||
|
|
||||||
# Command 1: 提取蛋白质
|
# Command 1: 提取蛋白质
|
||||||
command_1 = f'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_1 = f'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'
|
||||||
# echo "Protein": 选择蛋白质组,用于告诉 gmx trjconv 要处理哪个部分。
|
# echo "Protein": 选择蛋白质组,用于告诉 gmx trjconv 要处理哪个部分。
|
||||||
@@ -280,27 +330,4 @@ command_2 = f'echo "Protein\nProtein\nProtein" | gmx trjconv -s {tpr_file} -f {t
|
|||||||
# Command 3: 抽取帧生成 .pdb 文件
|
# Command 3: 抽取帧生成 .pdb 文件
|
||||||
command_3 = f'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'
|
command_3 = f'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'
|
||||||
# -b 0 -e 0: 指定开始和结束时间,这里设置为0表示只取第一帧。
|
# -b 0 -e 0: 指定开始和结束时间,这里设置为0表示只取第一帧。
|
||||||
# -o {output_folder}/tarj_show.pdb: 输出为 .pdb 格式,存储在指定的位置。
|
# -o {output_folder}/tarj_show.pdb: 输出为 .pdb 格式,存储在指定的位置。
|
||||||
|
|
||||||
# Step 1: Extract frames every 1000 ps
|
|
||||||
gmx_mpi trjconv -s ${TPR_FILE} -f ${XTC_FILE} -o ${OUTPUT_FOLDER}/${NO_PBC_XTC_FILE} -dt ${EXTRACT_EVERY_PS} -pbc mol <<EOF
|
|
||||||
0
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Step 2: Center and fit the trajectory
|
|
||||||
# Centering the protein and fitting to the initial frame
|
|
||||||
gmx_mpi trjconv -s ${TPR_FILE} -f ${OUTPUT_FOLDER}/${NO_PBC_XTC_FILE} -o ${OUTPUT_FOLDER}/${NO_PBC_XTC_FILE} -pbc mol -center <<EOF
|
|
||||||
1
|
|
||||||
0
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Step 3: Output PDB format file
|
|
||||||
gmx_mpi trjconv -s ${TPR_FILE} -f ${OUTPUT_FOLDER}/${NO_PBC_XTC_FILE} -o ${OUTPUT_FOLDER}/${MDRUN_NAME}.pdb -pbc mol -center <<EOF
|
|
||||||
1
|
|
||||||
0
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Continue with further analysis like RMSD calculation...
|
|
||||||
# ... [other analysis commands] ...
|
|
||||||
|
|
||||||
# End of script
|
|
||||||
Reference in New Issue
Block a user