SLURM script file for Gaussian 16

test
 1#!/bin/bash -l
 2# Section for defining queueing system variables:
 3# SLURM-section
 4#SBATCH --job-name=watdim01
 5#SBATCH --output=watdim01.slurmout
 6#SBATCH --partition=cluster8
 7#SBATCH --nodes=1
 8#SBATCH --cpus-per-task=8
 9#SBATCH --threads-per-core=1
10#SBATCH --mem-per-cpu=2000
11######################################
12# Section for defining job variables and settings:
13g16root="/scr1/g16_a.03_sse4"
14g16dir="/scr1/g16_a.03_sse4/g16"
15LaunchDir=$PWD;
16LocalRunDir=/scr1/$USER/$SLURM_JOB_ID
17export GAUSS_SCRDIR=$LocalRunDir;
18mkdir -p $GAUSS_SCRDIR
19export GAUSS_EXEDIR=$g16dir
20export GAUSS_ARCHDIR=$g16dir
21cat >/$LocalRunDir/$SLURM_JOB_NAME.gjf <<EOF
22%chk=$GAUSS_SCRDIR/$SLURM_JOB_NAME.chk
23%CPU=0-7
24%mem=16000MB
25#p b3lyp/6-31+G(d,p) opt=(Z-Matrix) iop(1/7=30) int=ultrafine  EmpiricalDispersion=GD3
26
27watdim01 water dimer b3lyp-D3/6-31+G(d,p) opt tight Cs, int=ultrafine
28
290 1
30O1
31H2  1  r2
32H3  1  r3  2  a3
33X4  2  1.0  1  90.0  3  180.0
34O5  2  r5  4  a5  1  180.0
35H6  5  r6  2  a6  4  d6
36H7  5  r6  2  a6  4  -d6
37
38r2=0.9732
39r3=0.9641
40r5=1.9128
41r6=0.9659
42a3=105.9
43a5=83.1
44a6=112.1
45d6=59.6
46
47
48EOF
49$g16dir/g16 < $GAUSS_SCRDIR/$SLURM_JOB_NAME.gjf > $LaunchDir/$SLURM_JOB_NAME.log
50cp $GAUSS_SCRDIR/$SLURM_JOB_NAME.chk $LaunchDir/
51# The following line will clean up /scr1 after finishing the job
52rm -rf $LocalRunDir
53# If your job finishes normally, delete the empty .slurmout file
54slurmout_check=`cat $SLURM_JOB_NAME.slurmout`
55if [$slurmout_check = ""]; then
56rm -f $SLURM_JOB_NAME.slurmout
57fi
58
59exit 0
test
 1#!/bin/bash
 2#SBATCH -J opt-CdSe33ZnS69LHis12
 3#SBATCH -o %J.out
 4#SBATCH -e %J.err
 5#SBATCH -N 1
 6#SBATCH -w node01
 7#SBATCH -n 96
 8#SBATCH -t 30-12:00:00
 9#SBATCH -p hpc
10###SBATCH --dependency=afterok:0
11#=======================
12export OMP_THREAD_LIMIT=256 # max cpu to 256 for gaussian version <=16 b01
13echo =======================
14echo Submit Time is [`date`].
15echo Working dir is [$SLURM_SUBMIT_DIR].
16cd $SLURM_SUBMIT_DIR
17NPROCS=$((SLURM_NTASKS))
18N_NODE=$((SLURM_JOB_NUM_NODES))
19echo This job has allocated [${N_NODE}] nodes with [${NPROCS}] processors.
20# echo Running on host [`hostname`].
21echo Running on host [$SLURM_JOB_NODELIST].
22echo This jobs runs on the following processors:
23echo =======================
24echo "**Start!!!"
25echo Job start Time is [`date`].
26echo This job name is [$SLURM_JOB_NAME] and job id is [$SLURM_JOB_ID]. >> $SLURM_JOB_ID.out
27#=======================
28unset PATH && \
29export PATH=/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/root/bin:$PATH && \
30unset LD_LIBRARY_PATH
31
32JOBNAME=opt-CdSe33ZnS69LHis12
33
34GAUSS_SCRDIR=/tmp/$SLURM_JOB_USER/$SLURM_JOB_ID
35
36if [ ! -a $GAUSS_SCRDIR ]; then
37echo "Scratch directory $GAUSS_SCRDIR created."
38mkdir -p $GAUSS_SCRDIR
39fi
40export GAUSS_SCRDIR
41echo "Using $GAUSS_SCRDIR for temporary Gaussian 16 files."
42ls -l $GAUSS_SCRDIR
43# for gaussian16 b01
44export g16root=/data1/apps/gaussian
45export PATH=$PATH:$g16root/g16
46export GAUSS_EXEDIR=$g16root/g16
47source $g16root/g16/bsd/g16.profile
48# for gaussian16 c01
49# export g16root=/data1/apps/gaussian-c
50# export PATH=$PATH:$g16root/g16
51# export GAUSS_EXEDIR=$g16root/g16
52# source $g16root/g16/bsd/g16.profile
53# cat $SLURM_JOB_NODELIST |uniq > $GAUSS_SCRDIR/working.nodes
54echo $SLURM_JOB_NODELIST > $GAUSS_SCRDIR/working.nodes # >> means append and > means replace
55echo "Gaussian16 nodes:"
56cat $GAUSS_SCRDIR/working.nodes
57export GAUSS_LFLAGS=" -mp 96 -vv -nodefile $GAUSS_SCRDIR/working.nodes"
58#=======================
59start_time=$(date +%s)
60#1
61task_start_time=$(date +%s)
62#Run a Gaussian command file
63echo "Starting Gaussian run at" `date`
64time g16 < $JOBNAME.gjf > $JOBNAME.out
65echo "Finished Gaussian run at" `date`
66echo "Removing GASUU_SCRDIR:"
67echo "$GAUSS_SCRDIR"
68rm -Rf $GAUSS_SCRDIR
69task_duration=$(( $(date +%s) - $task_start_time ))
70echo "Task 1 duration: $task_duration seconds." >> $SLURM_JOB_ID.out
71
72#2
73task_start_time=$(date +%s)
74#convert .chk to .fch
75# formchk ${JOBNAME}.chk
76formchk ${JOBNAME}.chk
77task_duration=$(( $(date +%s) - $task_start_time ))
78echo "Task 2 duration: $task_duration seconds." >> $SLURM_JOB_ID.out
79
80end_time=$(date +%s)
81duration=$(( $end_time - $start_time ))
82echo "Total duration: $duration seconds." >> $SLURM_JOB_ID.out
83
84echo Job finish Time is [`date`].
85echo "**Finished!!!"
86echo =======================
87echo "                       "