#!/bin/bash

LD1=../../../bin/ld1.x
workd=./results/

mkdir -p $workd

for atom in ne ar kr; do
for xc in sla-noc sla-pz sla-gl; do

$LD1 < $atom.$xc.in > $atom.$xc.out
mv $atom.$xc.out $workd
mv freq-pol.dat $workd/$atom.$xc.freq-pol.dat
mv freq-pol-dft.dat $workd/$atom.$xc.freq-pol-dft.dat
rm -f ld1.*
done 
done


cd  $workd

neref=6.98
arref=66.1
krref=130.7

(
echo "    reference       sla-gl                 sla-noc                slc-pz"
echo "                 tfvw   full            tfvw   full            tfvw   full"

echo -n "ne    $neref "
grep -e 'coeff' ne.* | awk '{gl=$7; getline; gl_full=$7; getline ;\
                             noc=$7;getline; noc_full=$7; getline ; \
                             pz=$7; getline; pz_full=$7; \
            print " ", gl," ",gl_full"   ",noc," ",noc_full"   ",pz," ",pz_full}'

echo -n "ar   $arref "
grep -e 'coeff' ar.* | awk '{gl=$7; getline; gl_full=$7; getline ;\
                             noc=$7;getline; noc_full=$7; getline ; \
                             pz=$7; getline; pz_full=$7; \
            print " ", gl,"",gl_full"  ",noc,"",noc_full "  ",pz,"",pz_full}'

echo -n "kr  $krref "
grep -e 'coeff' kr.* | awk '{gl=$7; getline; gl_full=$7; getline ;\
                             noc=$7;getline; noc_full=$7; getline ; \
                             pz=$7; getline; pz_full=$7; \
            print "", gl,gl_full" ",noc,noc_full " ",pz,pz_full}'
) > compare.dat

