-
Notifications
You must be signed in to change notification settings - Fork 6
/
gmx
executable file
·73 lines (61 loc) · 1.08 KB
/
gmx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
WORKDIR="$PWD"
if [ -z "$GMX_DOUBLE" ]; then
GMX_DOUBLE=OFF
b=$(basename $0)
[ $b = gmx_d -o $b = mdrun_d ] && GMX_DOUBLE=ON
export GMX_DOUBLE
fi
source /gromacs/gmx-chooser.sh
# copy necessary files from PVC to scratchdir
function copy () {
# copy HILLS and COLVAR files if present
cp HILLS COLVAR $SCRATCHDIR 2>/dev/null
# copy everything else
while test $# -gt 0; do
case "$1" in
-deffnm*)
shift
cp $1* $SCRATCHDIR
shift
;;
*)
if [ -f "$1" ]; then
cp "$1" $SCRATCHDIR
fi
shift
;;
esac
done
}
# synchronise scratch to pvc
function sync () {
rsync -aq $SCRATCHDIR/* $WORKDIR 2>/dev/null
}
function stop_sync() {
if [ -n "$sync_pid" ]; then
kill $sync_pid
wait
sync
fi
}
# sync one last time after completion
trap stop_sync EXIT
if [ ! -z "$SCRATCHDIR" ];
then
touch "$SCRATCHDIR"/x || exit 1
rm -f "$SCRATCHDIR"/x
copy "$@"
cd $SCRATCHDIR || exit 1
while true
do
sleep 60
sync
done &
sync_pid=$!
fi
if [ $(basename $0 _d) = mdrun ]; then
gmx mdrun "$@"
else
gmx "$@"
fi