Gaussian

Launch this script shown below by typing:

qsub jobscript_gaussian16.sh [name_of_your_job]


OR substitute

 NAME=$1 

by

NAME=[name_of_your_job]

and launch as:

qsub jobscript_gaussian16.sh


Remark: <html> Please ensure the value for NProcShared within the Gaussian input equals the number of threads you demand by -pe mp [no_threads] </html>

jobscript_gaussian16.sh
#!/bin/bash --login
 
##### example for an OpenMP Gaussian run with 4 CPU
#$ -cwd
##### please define your own job resources
# time in hh:mm:ss
#$ -l h_rt=00:30:00
 
#$ -l mem_free=4G
# IMPORTANT: ensure that %NProcShared within
# gaussian input is set to same value
#$ -pe mp 4
 
#$ -N jobname
#$ -e jobname_err.out
#$ -o jobname_stdout.out
#$ -j n
#$ -m n
##########
 
 
# saves current directory; where output goes
STOREDIR=$PWD
NAME=$1
# strip off file extension
COMNAME=${1/.*/}
 
if [ ! -s $STOREDIR/$NAME ]; then
 echo "Error: Job input file $STOREDIR/$NAME does not exist!"
 exit 1
fi
 
 
# create temporary directory for .rwf and .chk files
 
# create unique tmpdir with random name
#SCRATCHDIR=$(mktemp -d /scratch/$USER/gaussian.XXXXXXX)
 
# tmpdir per job ID
if [ -n "$TASK_ID" ]
then
SCRATCHDIR=/scratch/$USER/gaussian_${JOB_ID}_$TASK_ID
else
SCRATCHDIR=/scratch/$USER/gaussian_$JOB_ID
fi
 
# don't forget to create recursively
mkdir -p $SCRATCHDIR
 
# export location for Gaussian scratch directory
export GAUSS_SCRDIR=$SCRATCHDIR
 
 
# copy job files to tmpdir
 
# in case of one .chk file with same name, uncomment this
#if [ -e $STOREDIR/$COMNAME.chk ] ; then
#cp $STOREDIR/$COMNAME.chk $SCRATCHDIR
#fi
 
# if several .chk files need to be copied
cp $STOREDIR/*.chk $SCRATCHDIR
# copy the job input file
cp $STOREDIR/$NAME $SCRATCHDIR
 
 
# job starts
 
# change to tmpdir
cd $SCRATCHDIR
# and start of job run
module load g16
g16 < $NAME > $STOREDIR/$COMNAME.out
 
# job ends
 
 
# gives some info about the space left on scratch
if [ -n "$TASK_ID" ]
then
df -B GB /scratch > scratch_info_${JOB_ID}_$TASK_ID.out
else
df -B GB /scratch > scratch_info_$JOB_ID.out
fi
 
 
# copy files and chdir to job directory
mv -f $SCRATCHDIR/*.chk $STOREDIR ; cd $STOREDIR
 
# creation of formatted chk (if needed), use with caution for big chk files
# formchk $COMNAME.chk
 
#clean up
rm -fr $SCRATCHDIR


date of revision: 02-14-2020 © kraus