#!/usr/local/bin/bash 
#  make the  projector by hand 
./a162cgGS2 
# 
cat NewPALA a162poig.dat >> a162PointAll
#
# ########            GS  cycle      ##########
export status=0
while (test $status -ne 1) do
#   energy and gradient  
cat obena162 a162poig.dat > a162.input
#
# call gaussian03
./subg3a162
#
cat a162.output >> a162All
grep  'SCF Done:  E(RB+HF-LYP) =' a162.output > a162energy
cat  a162energy >>  a162EnergyAll
tr -s ' ' < a162energy > a162entr  
cut -d' ' -f6 a162entr > a162energy
cp  a162energy a162ener.dat
#
# gradient 
#
export num=5
grep -n 'Axes restored to original set' a162.output | head -n 1 >a162Noline
cut -d':' -f1 a162Noline > a162Noli
./numa162
export num=$?
./numa162HT
export num2=$?
export num=$[$num+$num2*100+166]
head -n $num a162.output |tail -162  >a162gradfile
cat a162gradfile >> a162GradAll
cp  a162gradfile a162grad.dat
#   new GS point and test
./a162cgGS3 
export status=$?
done
#                     end GS cycle
exit
