echo "==========================================================="
echo "========================ORCA==============================="
echo "==========================================================="
echo ""
echo "This is a ORCA submission script"
echo ""
echo "The following files must exist in current working directory"
echo "1).inp 2).xyz"
read -p "Enter input filename (without .inp): " input
read -p "Enter xyz coordinates file(without .xyz): " input3
echo ""
echo "The initial guess orbital file(gbw) is not required for this run"
echo ""
echo "For nodes=x; enter the x value"
read -p "For ex. (nodes=node5; enter node5) or (nodes=1; enter 1): " node
echo ""
echo "For ppn=y; enter the y value "
read -p "For ex. ppn=64; enter 64  : " ppn
echo "The generated submission script is $input.sh"
echo ""
echo "#PBS -N $input" > $input.sh
echo "#PBS -l nodes=$node:ppn=$ppn,walltime=9999:00:00" >> $input.sh
echo "#PBS -j oe" >> $input.sh
echo "" >> ${input}.sh
echo 'cd $PBS_O_WORKDIR' >> $input.sh


echo "export MPIROOT=/apps/compilers/openmpi/4.1.1" >> $input.sh

echo 'export PATH=$MPIROOT/bin:$PATH' >> $input.sh
echo 'export LD_LIBRARY_PATH=$MPIROOT/lib:$LD_LIBRARY_PATH' >> $input.sh

echo 'export ORCA=/apps/scratch/compile/orca_6_1_1_linux_x86-64_shared_openmpi418' >> $input.sh


echo "" >> ${input}.sh
echo 'export tdir="/lscratch/$PBS_JOBID"' >> $input.sh
echo 'mkdir $tdir' >> $input.sh
echo cp "$input".inp '$tdir/' >> $input.sh
echo cp "$input3".xyz '$tdir/' >> $input.sh
echo 'cd $tdir' >> $input.sh
echo '$ORCA/orca'" $input.inp >> $input.out" >> $input.sh
echo 'cp * $PBS_O_WORKDIR/' >> $input.sh
echo 'rm -f *.tmp* $PBS_O_WORKDIR/' >> $input.sh
echo 'rm -f *.tmp* $tdir/' >> $input.sh

qsub $input.sh


