-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathg09.sh
98 lines (83 loc) · 2.34 KB
/
g09.sh
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
94
95
96
97
98
#!/bin/bash
# walltime
#SBATCH --time=00:30:00
# number of processor cores (i.e. tasks)
#SBATCH --ntasks=1
# number of nodes
#SBATCH --nodes=1
# memory per CPU core
#SBATCH --mem-per-cpu=12288M
export JOB_NAME=REPLACEME
export FILES_NEEDED_DIR=REPLACEME
export TEMPORARY_DIR="/tmp/$SLURM_JOB_ID"
export GAUSS_SCRDIR="$TEMPORARY_DIR/gauss_scrdir"
#set up function. this isn't called/run here. It's just used if the job is canceled via a signal
cleanup_scratch()
{
if (test -d "$TEMPORARY_DIR") then
exit 0
else
echo "Jobbed was terminated mid-run."
cd "$SLURM_SUBMIT_DIR"
rm -rf "$TEMPORARY_DIR"
fi
exit 0
}
mkdir $TEMPORARY_DIR
cp -ar $FILES_NEEDED_DIR/* $TEMPORARY_DIR
#basic diagnostic output
echo "---"
echo "Beginning-of-job Diagnostic information:"
echo "---"
echo "Temporary Directory:"
echo "$TEMPORARY_DIR"
echo "---"
echo "Scratch Directory:"
echo "$GAUSS_SCRDIR"
echo "---"
echo "Job Source Directory:"
echo "$SLURM_SUBMIT_DIR"
echo "---"
echo "Current Time:"
date
echo "---"
#create scratch directory
echo "Creating scratch directory at $GAUSS_SCRDIR"
mkdir -pv "$GAUSS_SCRDIR"
echo "---"
#changing directory to $TEMPORARY_DIR
echo "Changing directory to temporary dir at $TEMPORARY_DIR"
cd "$TEMPORARY_DIR"
ls
echo "---"
echo "Starting Gaussian Run at:"
date
#the actual gaussian run starts here
/fslapps/chem/bin/rung09 < "$JOB_NAME.com" > "$JOB_NAME.log" &
pid=$!
trap "kill $pid; cleanup_scratch; exit 1" TERM SIGTERM KILL SIGKILL EXIT
wait $pid
/fslapps/chem/bin/rmipc
export PREVIOUS_JOBID=$SLURM_JOB_ID
grep "Normal termination" $TEMPORARY_DIR/"$JOB_NAME".log > $TEMPORARY_DIR/successfulrun
if (test -s $TEMPORARY_DIR/successfulrun) then
echo "SUCCESSFUL RUN"
#rm $TEMPORARY_DIR/successfulrun
#mkdir $HOME/ProgdynSuite/RunOutputs/out"$SLURM_JOB_ID"
#cp -av $TEMPORARY_DIR/* $HOME/ProgdynSuite/RunOutputs/out"$SLURM_JOB_ID"
cp $TEMPORARY_DIR/"$JOB_NAME".log $HOME/ProgdynSuite/ProgdynScripts/freqinHP
echo Normal Termination. Submitting to ProgdynSuite
$HOME/ProgdynSuite/SubmitScripts/ProgSubmitWrapper.sh
else
echo
fi
echo "---"
echo "Job ending time:"
date
echo "---"
rm -rf "$GAUSS_SCRDIR"
mkdir $HOME/ProgdynSuite/RunOutputs/out"$PREVIOUS_JOBID"
mv "$TEMPORARY_DIR"/* $HOME/ProgdynSuite/RunOutputs/out"$PREVIOUS_JOBID"
mv $FILES_NEEDED_DIR/slurm* $HOME/ProgdynSuite/RunOutputs/out"$PREVIOUS_JOBID"
rm -rf "$FILES_NEEDED_DIR"
exit 0