-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathq-batch
executable file
·93 lines (71 loc) · 2.03 KB
/
q-batch
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
set -- $(getopt m: "$@")
while [ $1 != -- ]; do case $1 in
-m) MEMGB=$2; shift;;
esac
shift
done
echo QCEIMS=${QCEIMS:=/storage/brno3-cerit/home/ljocha/work/QCEIMS_v.4.2}
echo HOURS=${HOURS:=24}
echo MEMGB=${MEMGB:=12}
echo SCRATCH=${SCRATCH:=20gb}
echo ORCA=${ORCA:=orca-4.2.1}
ORCA_WRAPPER=https://raw.githubusercontent.com/RECETOX/qceims/main/orca_wrapper
MEMMB=$(($MEMGB * 1024))
d=$(pwd)
bname=`basename $d`
DIR=$d/TMPQCEIMS
echo $DIR
if [ ! -d "$DIR" ]; then
echo "run mpspred first!"
exit
fi
#########################################
echo 'starting parallel qceims run on'
cd $DIR
#########################################
# outer loop (runs until all is done)
#########################################
for vz in TMP.*
do
cd $vz
VZ_NUM=`echo $vz | awk -F . '{print $2}'`
VZ_DIR=`pwd`
rm -f ready jobid
cat > ${bname}_${VZ_NUM} <<EOF
#!/bin/bash
set -x
echo hostname: \`hostname\`
export OMP_NUM_THREADS=1
# module add $ORCA
# Label for the run
#PBS -N qceims_${bname}_$VZ_NUM
#PBS -j oe
cd $VZ_DIR || { echo $VZ_DIR: \$!; exit 1 ; }
tdir=\$SCRATCHDIR
cp $VZ_DIR/* \$tdir
cd \$tdir
if [ ! -d "~/.XTBPARAM" ]; then
cp -r $QCEIMS/.XTBPARAM ~
fi
curl -X GET $ORCA_WRAPPER | sed "s/%MEMMB%/$MEMMB/;s/%ORCA%/$ORCA/" >orca
chmod +x orca
PATH=.:\$PATH
$QCEIMS/qceims -prod > qceims.out 2>&1
echo \$? >ready.tmp
cp * $VZ_DIR
cd $VZ_DIR
rm -rf \$tdir/*
mv ready.tmp ready
EOF
# this is the job (qceims calls dscf/grad, mopac or dftb+)
# VERY VERY IMPORTANT: termination of this job should produce
# a file <ready> in the subdir (e.g. by 'touch ready')
# qsub -l select=1:ncpus=1:mem=4gb:scratch_local=8gb -q [email protected] ${bname}_${VZ_NUM}
qsub -l walltime=$HOURS:0:0 -l select=1:ncpus=1:mem=${MEMGB}gb:scratch_local=$SCRATCH ./${bname}_${VZ_NUM} >$VZ_DIR/jobid
echo qsub -l walltime=$HOURS:0:0 -l select=1:ncpus=1:mem=${MEMGB}gb:scratch_local=$SCRATCH ./${bname}_${VZ_NUM} \>$VZ_DIR/jobid
#
# echo "JOB "${bname}_${VZ_NUM}" STARTED"
cd ..
done
exit