Skip to content

Commit 32a51d2

Browse files
committed
[.cleanup_gmx_analyses.sh]: Create Compound Subdirectories for densmap-z and rdf_slab-z
1 parent 404546f commit 32a51d2

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

analysis/lintf2_ether/gmx/.cleanup_gmx_analyses.sh

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,51 @@ gather() {
2424
fi
2525
}
2626

27+
gather_cmps() {
28+
# Gather output of similar analyses scripts ordered by compounds
29+
# into sub-directories.
30+
local root="${1}"
31+
local cmps="${2}"
32+
33+
# Create "root" directory.
34+
if [[ -d ${root} ]]; then
35+
echo "WARNING: Directory already exists: '${root}'"
36+
return 0
37+
else
38+
mkdir "${root}/" || exit
39+
fi
40+
41+
# Move all "compound" directories to the root directory.
42+
for cmp in ${cmps}; do
43+
if [[ -n $(find . -maxdepth 1 -type d -name "${root}_${cmp}*_slurm-[0-9]*" -print -quit) ]]; then
44+
mv "${root}_${cmp}"*_slurm-[0-9]*/ "${root}/" || exit
45+
fi
46+
done
47+
48+
# Check if the root directory is empty.
49+
if [[ -n $(find "${root}/" -prune -empty) ]]; then
50+
echo "WARNING: No directory matching pattern '${root}_<compound>*_slurm-[0-9]*'"
51+
rm -r "${root:?}/" || exit
52+
return 0
53+
fi
54+
55+
# Gather all compound analyses.
56+
cd "${root}/" || exit
57+
for cmp in ${cmps}; do
58+
gather "${root}_${cmp}"
59+
done
60+
cd ../ || exit
61+
}
62+
2763
gather "density-z"
28-
gather "densmap-z"
2964
gather "energy"
3065
gather "make_ndx"
3166
gather "msd"
3267
gather "polystat"
3368
gather "potential-z"
34-
gather "rdf_slab-z"
35-
gather "rdf"
3669
gather "trjconv"
70+
71+
gather_cmps "densmap-z" "gra Li NBT OBT OE"
72+
73+
gather_cmps "rdf_slab-z" "Li-com NTf2-com ether-com Li NBT OE"
74+
gather "rdf"

0 commit comments

Comments
 (0)