#!/bin/bash --login
# you.lu@stfc.ac.uk

## load module(s)
module load anaconda/3         # Python 3 and NumPy

echo
echo =========================
echo $PBS_JOBID
echo $PBS_JOBNAME
echo $PFSDIR
echo =========================
echo 

export OMP_NUM_THREADS=16
export MALLOC_MMAP_MAX_=0
export MALLOC_TRIM_THRESHOLD_=-1
export FORT_BUFFERED=true
export decfort_dump_flag=true
export OMP_STACKSIZE=2G

# make sure any symbolic links are resolved to absolute path
export PBS_O_WORKDIR=$(readlink -f $PBS_O_WORKDIR)

# replace "home" with "work"
#export PYTHONHOME=`echo $ANACONDADIR | sed 's/home/work/1'`
export PYTHONPATH=$CHEMSH_PYTHONPATH
export CHEMSH_ARCH=intel

# Change to the directory that the job was submitted from
cd $PBS_O_WORKDIR

# run
mpirun -n $CHEMSH_NPROCS $CHEMSH_EXEC -nwg $CHEMSH_NWORKGROUPS -npmm $CHEMSH_NPROCS_MM $CHEMSH_INPUT > $CHEMSH_OUTPUT

