From 561deeb23cf8007983686a285b66d1c9dd85d1c7 Mon Sep 17 00:00:00 2001 From: riesben Date: Wed, 3 Apr 2024 17:30:17 +0200 Subject: [PATCH] centering the traj after equilibration.. --- .../ligand_fep_workflow/ligand_fep_setup.smk | 25 ++++++++++++++++--- src/abfe/utils/check_dag_completion.sh | 16 ++++++------ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/abfe/rules/ligand_fep_workflow/ligand_fep_setup.smk b/src/abfe/rules/ligand_fep_workflow/ligand_fep_setup.smk index 810f441..9eed030 100644 --- a/src/abfe/rules/ligand_fep_workflow/ligand_fep_setup.smk +++ b/src/abfe/rules/ligand_fep_workflow/ligand_fep_setup.smk @@ -13,6 +13,8 @@ rule fep_setup_ligand: equil_gro=run_path+"/ligand/equil-mdsim/npt_equil2/npt_equil2.gro", params: sim_dir=run_path+"/ligand/fep", + feptop_dir=run_path+"/ligand/fep/fep-topology", + vdw_windows=n_vdw_windows, vdw_range=" ".join(map(str, lam_vdw_range)), coul_windows=n_coul_windows, @@ -28,20 +30,35 @@ rule fep_setup_ligand: fep_gro=run_path+"/ligand/fep/fep-topology/equil.gro" shell: ''' + set -e + + echo "build initial dirs" mkdir -p {params.sim_dir}/template + mkdir -p {params.sim_dir}/fep-topology cp -r {params.template_dir}/template/* {params.sim_dir}/template - cp -r {input.ligand_top}/* {params.sim_dir}/fep-topology - cp {input.equil_gro} {params.sim_dir}/fep-topology/equil.gro + + echo "center equil sim" + echo "0" | gmx trjconv -s {params.feptop_dir}/ligand.gro -f {input.equil_gro} -o {params.feptop_dir}/whole.gro -pbc whole + echo "0" | gmx trjconv -s {params.feptop_dir}/ligand.gro -f {params.feptop_dir}/whole.gro -o {params.feptop_dir}/nojump.gro -pbc nojump + echo "1 0" | gmx trjconv -s {params.feptop_dir}/ligand.gro -f {params.feptop_dir}/nojump.gro -o {output.fep_gro} -pbc mol -center -ur compact + rm {params.feptop_dir}/whole.gro {params.feptop_dir}/nojump.gro + # create simulation directory + echo "build simulation dirs:" mkdir -p {params.sim_dir}/simulation let max_window={params.vdw_windows} for i in $(seq 0 $((max_window-1))) do + echo "build simulation dirs: mk" mkdir -p {params.sim_dir}/simulation/vdw.${{i}} - cp -r {params.sim_dir}/template/vdw/* {params.sim_dir}/simulation/vdw.${{i}} + + echo "build simulation dirs: cp" + cp -rf {params.sim_dir}/template/vdw/* {params.sim_dir}/simulation/vdw.${{i}} + + echo "build simulation dirs: sed" sed -i "s//${{i}}/g" {params.sim_dir}/simulation/vdw.${{i}}/*/*.mdp sed -i "s//{params.vdw_range}/g" {params.sim_dir}/simulation/vdw.${{i}}/*/*.mdp done @@ -50,7 +67,7 @@ rule fep_setup_ligand: for i in $(seq 0 $((max_window-1))) do mkdir -p {params.sim_dir}/simulation/coul.${{i}} - cp -r {params.sim_dir}/template/coul/* {params.sim_dir}/simulation/coul.${{i}} + cp -rf {params.sim_dir}/template/coul/* {params.sim_dir}/simulation/coul.${{i}} sed -i "s//${{i}}/g" {params.sim_dir}/simulation/coul.${{i}}/*/*.mdp sed -i "s//{params.coul_range}/g" {params.sim_dir}/simulation/coul.${{i}}/*/*.mdp done diff --git a/src/abfe/utils/check_dag_completion.sh b/src/abfe/utils/check_dag_completion.sh index c389e17..55f33f6 100644 --- a/src/abfe/utils/check_dag_completion.sh +++ b/src/abfe/utils/check_dag_completion.sh @@ -1,29 +1,29 @@ #!/usr/bin/env bash ori=${PWD} -snakemake --unlock -c1 -snakemake -R $(snakemake --list-code-changes) --touch -c4 +snakemake --unlock -c1 -s Snakefile.smk +snakemake -R $(snakemake --list-code-changes -s Snakefile.smk) --touch -c4 -s Snakefile.smk for dir in */? do cd ${dir} - snakemake --unlock -c1 - snakemake -R $(snakemake --list-code-changes) --touch -c4 + snakemake --unlock -c1 -s Snakefile.smk + snakemake -R $(snakemake --list-code-changes -s Snakefile.smk) --touch -c4 -s Snakefile.smk cd ${ori} done for dir in */?/ligand do cd ${dir} - snakemake --unlock -c1 - snakemake -R $(snakemake --list-code-changes) --touch -c4 + snakemake --unlock -c1 -s Snakefile.smk + snakemake -R $(snakemake --list-code-changes -s Snakefile.smk) --touch -c4 -s Snakefile.smk cd ${ori} done for dir in */?/complex do cd ${dir} - snakemake --unlock -c1 - snakemake -R $(snakemake --list-code-changes) --touch -c4 + snakemake --unlock -c1 -s Snakefile.smk + snakemake -R $(snakemake --list-code-changes -s Snakefile.smk) --touch -c4 -s Snakefile.smk cd ${ori} done