Skip to content

Commit fc093d4

Browse files
committed
[densmap-z_NBT.sh]: Create
Create a Slurm job script that runs the MDTools script `scripts/structure/densmap.py` for nitrogen atoms of PEO chains.
1 parent 4d18cdc commit fc093d4

File tree

1 file changed

+128
-0
lines changed

1 file changed

+128
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
#!/bin/bash
2+
3+
#SBATCH --time=1-00:00:00
4+
#SBATCH --job-name="mdt_densmap-z_ether"
5+
#SBATCH --output="mdt_densmap-z_ether_slurm-%j.out"
6+
#SBATCH --nodes=1
7+
#SBATCH --cpus-per-task=1
8+
#SBATCH --mem=8G
9+
# The above options are only default values that can be overwritten by
10+
# command-line arguments
11+
12+
# MIT License
13+
# Copyright (c) 2021-2023 All authors listed in the file AUTHORS.rst
14+
15+
# This script is meant to be submitted by
16+
# submit_mdt_analyses_lintf2_ether.py
17+
18+
analysis="densmap-z_ether"
19+
thisfile=$(basename "${BASH_SOURCE[0]}")
20+
echo "${thisfile}"
21+
start_time=$(date --rfc-3339=seconds || exit)
22+
echo "Start time = ${start_time}"
23+
24+
########################################################################
25+
# Argument Parsing #
26+
########################################################################
27+
28+
bash_dir=${1} # Directory containing bash scripts used by this script
29+
py_lmod=${2} # File containing the modules to load Python
30+
py_exe=${3} # Name of the Python executable
31+
mdt_path=${4} # Path to the MDTools installation
32+
system=${5} # The name of the system to analyze
33+
settings=${6} # The used simulation settings
34+
begin=${7} # First frame to read. Frame numbering starts at 0
35+
end=${8} # Last frame to read (exclusive)
36+
every=${9} # Read every n-th frame
37+
bin_width=${10} # Grid size in the investigated plane in Angstrom
38+
zmin=${11} # Only atoms in a slab in the xy-plane between zmin
39+
zmax=${12} # and zmax are considered (in Angstrom)
40+
41+
echo -e "\n"
42+
echo "Parsed arguments:"
43+
echo "bash_dir = ${bash_dir}"
44+
echo "py_lmod = ${py_lmod}"
45+
echo "py_exe = ${py_exe}"
46+
echo "mdt_path = ${mdt_path}"
47+
echo "system = ${system}"
48+
echo "settings = ${settings}"
49+
echo "begin = ${begin}"
50+
echo "end = ${end}"
51+
echo "every = ${every}"
52+
echo "bin_width = ${bin_width}"
53+
echo "zmin = ${zmin}"
54+
echo "zmax = ${zmax}"
55+
56+
if [[ ! -d ${bash_dir} ]]; then
57+
echo
58+
echo "ERROR: No such directory: '${bash_dir}'"
59+
exit 1
60+
fi
61+
62+
echo -e "\n"
63+
bash "${bash_dir}/echo_slurm_output_environment_variables.sh"
64+
65+
########################################################################
66+
# Load required executable(s) #
67+
########################################################################
68+
69+
# shellcheck source=/dev/null
70+
source "${bash_dir}/load_python.sh" "${py_lmod}" "${py_exe}" || exit
71+
72+
########################################################################
73+
# Start the Analysis #
74+
########################################################################
75+
76+
echo -e "\n"
77+
echo "================================================================="
78+
${py_exe} -u \
79+
"${mdt_path}/scripts/structure/densmap.py" \
80+
-f "${settings}_out_${system}_pbc_whole_mol.xtc" \
81+
-s "${settings}_${system}.tpr" \
82+
-o "${settings}_${system}_${analysis}_${zmin}-${zmax}A.txt.gz" \
83+
-b "${begin}" \
84+
-e "${end}" \
85+
--every "${every}" \
86+
--sel "type ether" \
87+
--cmp "residues" \
88+
--center "com" \
89+
--direction "z" \
90+
--min "${zmin}" \
91+
--max "${zmax}" \
92+
--grid-spacing "${bin_width}" ||
93+
exit
94+
echo "================================================================="
95+
96+
########################################################################
97+
# Cleanup #
98+
########################################################################
99+
100+
echo -e "\n"
101+
mv -v \
102+
"${settings}_${system}_${analysis}_slurm-${SLURM_JOB_ID}.out" \
103+
"${settings}_${system}_${analysis}_${zmin}-${zmax}A_slurm-${SLURM_JOB_ID}.out"
104+
105+
save_dir="${analysis}_${zmin}-${zmax}A_slurm-${SLURM_JOB_ID}"
106+
if [[ ! -d ${save_dir} ]]; then
107+
echo -e "\n"
108+
mkdir -v "${save_dir}" || exit
109+
mv -v \
110+
"${settings}_${system}_${analysis}_${zmin}-${zmax}A.txt.gz" \
111+
"${settings}_${system}_${analysis}_${zmin}-${zmax}A_slurm-${SLURM_JOB_ID}.out" \
112+
"${save_dir}"
113+
bash "${bash_dir}/cleanup_analysis.sh" \
114+
"${system}" \
115+
"${settings}" \
116+
"${save_dir}" \
117+
"mdt"
118+
fi
119+
120+
end_time=$(date --rfc-3339=seconds)
121+
elapsed_time=$(bash \
122+
"${bash_dir}/date_time_diff.sh" \
123+
-s "${start_time}" \
124+
-e "${end_time}")
125+
echo -e "\n"
126+
echo "End time = ${end_time}"
127+
echo "Elapsed time = ${elapsed_time}"
128+
echo "${thisfile} done"

0 commit comments

Comments
 (0)