#!/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 2 3
for i in $(seq 2 17)
do :
sed -E -e's|@NP|'$i'|g' 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
