#!/bin/csh set wrapfilename="abinit.wrap" while ( $#argv != 0 ) switch ("$1") case "-h": cat - <! ~/.ezabinit.rc <! str.tmp tail -n +7 str.tmp | awk '{print $4}' | sort -u |\ awk 'BEGIN {while (getline < "atomz.in") {z[$1]=$2;}} {print $1,z[$1];}' >! atoms.tmp grep -q kppra $wrapfile if ($status == 0) then echo `getvalue kppra < $wrapfile ; tail -n +7 str.tmp | wc -l` | awk '{print $1/$2}' >! nkpts.tmp set kppra=`cat nkpts.tmp` endif grep -i subatom $wrapfile | sed 's/.*[ =]//g' >! sed.tmp cat $wrapfile | grep -v -i -e kppra -e subatom | sed 's/{natom}/'`tail -n +7 str.tmp | wc -l`'/g' >! abinit.in echo rprim `head -3 str.tmp` >>! abinit.in echo ntypat `cat atoms.tmp | wc -l` >>! abinit.in echo natom `tail -n +7 str.tmp | wc -l` >>! abinit.in echo znucl `awk '{print $2}' atoms.tmp` >>! abinit.in echo typat `tail -n +7 str.tmp | awk 'BEGIN {n=1; while (getline < "atoms.tmp") {t[$1]=n; n++;}} {print t[$4];}'` >>! abinit.in echo acell "3*1" >>! abinit.in echo xred >>! abinit.in tail -n +7 str.tmp | awk '{print " ",$1,$2,$3}' >>! abinit.in if ($?kppra) then echo ngkpt `(echo $kppra ; head -3 str.tmp ) | kmesh -q -r` >>! abinit.in endif echo abinit.in >! abinit.files echo abinit.out >>! abinit.files echo abi >>! abinit.files echo abo >>! abinit.files echo tmp >>! abinit.files awk '{print "'$POTDIR'/" $2 $1}' atoms.tmp | sed -f sed.tmp >>! abinit.files rm -f str.tmp atoms.tmp nkpts.tmp atomz.in sed.tmp if (! $?notrunabinit) then $CMDPREFIX $ABINITCMD < abinit.files >& log.out endif endif if (! $?notrunabinit) then set lastout=`ls -1 abinit.out* | sort | tail -n -1` tail -n +`grep -n "BROYDEN STEP NUMBER" $lastout | tail -n -1 | sed 's/:.*//g'` $lastout | getlines -bf "== END DATASET" >! abinitoutlast.tmp cat abinitoutlast.tmp | getvalue "Etotal" | tail -n -1 | awk '{print $1*27.21138386}' >! energy cat abinitoutlast.tmp | grep acell | sed 's/.*=//g' >! acell.tmp cat abinitoutlast.tmp | getlines -af rprim | sed 's/.*=//g' | head -3 >! rprim.tmp cat abinitoutlast.tmp | getlines -jaf 'reduced coordinates .array xred.' | getlines -jbf 'rms' >! xred.tmp awk 'BEGIN {CONVFMT="%.9g"; sc=1.8897259886; getline < "acell.tmp"; s[1]=$1/sc; s[2]=$2/sc; s[3]=$3/sc; } {n++; print s[n]*$1,s[n]*$2,s[n]*$3}' rprim.tmp>! str_relax.out ( echo 1 0 0 ; echo 0 1 0 ; echo 0 0 1 ) >> str_relax.out cat $strout | cellcvrt -f | tail -n +7 | awk '{print $4}' >! typat.tmp paste xred.tmp typat.tmp >> str_relax.out cat abinitoutlast.tmp | getlines -jbt 'cartesian forces .eV.Angstrom. at end:' 'frms,max,avg' | awk '{print $2,$3,$4}' >! force.out rm -f abinitout.tmp xred.tmp rprim.tmp acell.tmp typat.tmp abinitoutlast.tmp endif