#!/bin/bash
#
# source functions
#
for f in `ls ${HOME}/scripts/sh-funcs/*.sh 2>/dev/null`;do . $f;done

mv  -f ./energy.dat ./energy.dat.OLD

for i in 15 25 35 45 55 65 75 85
do :
ecutrho=$(echo "$i*8"|bc -l)
sed -E -e's|@ECUT@|'$i'|' -e's|@RHO@|'$ecutrho'|' scf.in.in > scf.in
rm -rf ./tmp
mpirun pw.x < scf.in 2>&1 |tee  scf-$i.out

read d d d d nrg rest < <(egrep '! *total energy' scf-$i.out)
echo ${i} ${nrg} >> ./energy.dat

done # for i...

exit
