#!/bin/bash
#PBS -l walltime=XX:YY:ZZ
#PBS -l select=20:ncpus=1:mpiprocs=1:mem=4G
#PBS -l place=group=arch
#PBS -r n
#PBS -N Job Name
#PBS -A Project Name
# input files
INFILE=MMPBSA.infile
EOFILE=Output.dat
PRMTOP=Topology.prmtop
TRAJ=Trajectory.nc
# load Amber
module load Amber/18
# go to work dir
cd $PBS_O_WORKDIR
# def executable
MPI_EXE=`which MMPBSA.py.MPI`
# generate log file
LOGFILE=$PBS_O_WORKDIR/$PBS_JOBNAME"."$PBS_JOBID".log"
echo "$PBS_JOBID ($PBS_JOBNAME) @ `hostname` at `date` in "$PBS_O_WORKDIR" START" > $LOGFILE
echo "`date +"%d.%m.%Y-%T"`" >> $LOGFILE
echo >> $LOGFILE
echo "GLOBAL PARAMETERS">> $LOGFILE
echo "---------------------------" >> $LOGFILE
echo "Node : "$HOSTNAME >> $LOGFILE
echo "Arch : "$ARCH >> $LOGFILE
echo "---------------------------" >> $LOGFILE
echo "RunDir : "$PBS_O_WORKDIR >> $LOGFILE
#
MPICPUS=$(cat $PBS_NODEFILE | wc -l)
echo "# MPI CPUs: ${MPICPUS}" >> $LOGFILE
mpirun $MPI_EXE -i $INFILE -eo $EOFILE -cp $PRMTOP -y $TRAJ >>$LOGFILE
qstat -f $PBS_JOBID >> $LOGFILE
echo "$PBS_JOBID ($PBS_JOBNAME) @ `hostname` at `date` in "$RUNDIR" END" >> $LOGFILE
echo "`date +"%d.%m.%Y-%T"`" >> $LOGFILE