#!/bin/bash
#TTM: 2013-03-21 created so that CONTCARs for frozenphonon.py
#will have the correct element names in them.
# run this in the top directory
# make a new folder, phposcars
edirlist=`find  ./ -name '*ep*static'`
for i in $edirlist
do
    echo $i
    titel=`grep "TITEL" $i"/POTCAR"`
    myt=""
    titels=`echo "$titel"`
    els=`echo -E "$titels"|awk '{print $4}'`
    echo $els
    prefix=`basename $i`
    echo $prefix
    newname=$prefix"_CONTCAR"
    sed "6s/.*/`echo $els`/" < $i"/CONTCAR" > phposcars/$newname
done

