From: hackbard Date: Mon, 26 Oct 2009 13:45:01 +0000 (+0100) Subject: interpolating poscar files for neb X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=4cbd094039b984d97d532f80a4be67e9058c505d;p=physik%2Fposic.git interpolating poscar files for neb --- diff --git a/vasp_tools/interPOS b/vasp_tools/interPOS new file mode 100755 index 0000000..0dec6a3 --- /dev/null +++ b/vasp_tools/interPOS @@ -0,0 +1,97 @@ +#!/bin/bash + +((offset=8)) + +images=4 +[ ! -z $1 ] && images=$1 + +echo "doing interpolation for $images images" + +start=0 +((fin=images+1)) + +nsi=`sed -n 6p 00/POSCAR | awk '{ print $1 }'` +nc=`sed -n 6p 00/POSCAR | awk '{ print $2 }'` +((tot=nsi+nc)) + +echo "$tot atoms found" + +x1=`sed -n 3p 00/POSCAR | awk '{ print $1 }'` +x2=`sed -n 3p 00/POSCAR | awk '{ print $2 }'` +x3=`sed -n 3p 00/POSCAR | awk '{ print $3 }'` + +y1=`sed -n 4p 00/POSCAR | awk '{ print $1 }'` +y2=`sed -n 4p 00/POSCAR | awk '{ print $2 }'` +y3=`sed -n 4p 00/POSCAR | awk '{ print $3 }'` + +z1=`sed -n 5p 00/POSCAR | awk '{ print $1 }'` +z2=`sed -n 5p 00/POSCAR | awk '{ print $2 }'` +z3=`sed -n 5p 00/POSCAR | awk '{ print $3 }'` + +# final + +dir=`printf "%02d" $fin` + +X1=`sed -n 3p $dir/POSCAR | awk '{ print $1 }'` +X2=`sed -n 3p $dir/POSCAR | awk '{ print $2 }'` +X3=`sed -n 3p $dir/POSCAR | awk '{ print $3 }'` + +Y1=`sed -n 4p $dir/POSCAR | awk '{ print $1 }'` +Y2=`sed -n 4p $dir/POSCAR | awk '{ print $2 }'` +Y3=`sed -n 4p $dir/POSCAR | awk '{ print $3 }'` + +Z1=`sed -n 5p $dir/POSCAR | awk '{ print $1 }'` +Z2=`sed -n 5p $dir/POSCAR | awk '{ print $2 }'` +Z3=`sed -n 5p $dir/POSCAR | awk '{ print $3 }'` + +fdir=$dir + +((cnt=1)) +while [ $cnt -lt $fin ]; do + dir=`printf "%02d" $cnt` + if [ ! -d $dir ]; then + echo "creating dir $dir ..." + mkdir $dir + fi + sed -n 1p 00/POSCAR > $dir/POSCAR + sed -n 2p 00/POSCAR >> $dir/POSCAR + echo $x1 $X1 $x2 $X2 $x3 $X3 $cnt $fin| awk '{ + ratio=$7/$8 + print " " $1+($2-$1)*ratio " " $3+($4-$3)*ratio " " $5+($6-$5)*ratio + }' >> $dir/POSCAR + echo $y1 $Y1 $y2 $Y2 $y3 $Y3 $cnt $fin| awk '{ + ratio=$7/$8 + print " " $1+($2-$1)*ratio " " $3+($4-$3)*ratio " " $5+($6-$5)*ratio + }' >> $dir/POSCAR + echo $z1 $Z1 $z2 $Z2 $z3 $Z3 $cnt $fin| awk '{ + ratio=$7/$8 + print " " $1+($2-$1)*ratio " " $3+($4-$3)*ratio " " $5+($6-$5)*ratio + }' >> $dir/POSCAR + sed -n 6p 00/POSCAR >> $dir/POSCAR + sed -n 7p 00/POSCAR >> $dir/POSCAR + sed -n 8p 00/POSCAR >> $dir/POSCAR + ((cnt+=1)) +done + +((acnt=1)) + +while [ $acnt -le $tot ]; do + ((cnt=1)) + ((ltg=acnt+offset)) + x=`sed -n ${ltg}p 00/POSCAR | awk '{ print $1 }'` + X=`sed -n ${ltg}p $fdir/POSCAR | awk '{ print $1 }'` + y=`sed -n ${ltg}p 00/POSCAR | awk '{ print $2 }'` + Y=`sed -n ${ltg}p $fdir/POSCAR | awk '{ print $2 }'` + z=`sed -n ${ltg}p 00/POSCAR | awk '{ print $3 }'` + Z=`sed -n ${ltg}p $fdir/POSCAR | awk '{ print $3 }'` + while [ $cnt -lt $fin ]; do + dir=`printf "%02d" $cnt` + echo $x $X $y $Y $z $Z $cnt $fin| awk '{ + ratio=$7/$8 + print " " $1+($2-$1)*ratio " " $3+($4-$3)*ratio " " $5+($6-$5)*ratio " T T T" + }' >> $dir/POSCAR + ((cnt+=1)) + done + ((acnt+=1)) +done +