#!/bin/bash
NAME='ricc2'
echo 'Skripta pokrenuta: '$(date)
START_DIR=$(pwd)
export PROGRAM_OUT_DIR=$START_DIR
echo 'START_DIR= '$START_DIR
export TURBODIR=/cvmfs/cvmfs.cro-ngi.hr/turbomole/turbomole7.0
export PATH=$TURBODIR/scripts:$PATH
export PATH=$TURBODIR/bin/`sysname`:$PATH
in_tar_file=$(ls *.tar)
out_gz_file=`echo $in_tar_file | sed 's/tar/gz/g'`
PROGRAM_TEMP_DIR=$TMPDIR/temp$$
echo 'PROGRAM_TEMP_DIR= '$PROGRAM_TEMP_DIR
mkdir $PROGRAM_TEMP_DIR
mv $in_tar_file $PROGRAM_TEMP_DIR
cd $PROGRAM_TEMP_DIR
tar xvf $in_tar_file
rm -f $in_tar_file
export TURBOTMPDIR=$PROGRAM_TEMP_DIR
export PARA_ARCH=SMP
export PARNODES=$PARNODES
echo 'Nproc='$PARNODES

$TURBODIR/scripts/jobex -c 500 -np $PARNODES -relax > jobex.out
#$TURBODIR/smprun_scripts/dscf > dscf.out
#$TURBODIR/smprun_scripts/escf > escf.out
#$TURBODIR/smprun_scripts/ricc2 > ricc2_s0.out

mv ./* $START_DIR
cd $START_DIR
rm -r $PROGRAM_TEMP_DIR
tar czvf $out_gz_file *
unset PROGRAM_OUT_DIR TURBODIR TURBOTMPDIR PARA_ARCH OMP_NUM_THREADS PARNODES
echo 'Posao je zavrsio.'
echo 'Skripta zavrsena: '$(date)
exit 0



