From: hackbard Date: Wed, 5 Aug 2009 14:59:37 +0000 (+0200) Subject: convert POSCAr files to moldyn xyz output X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=74338eb2c232045ba39ca945cb9662604cbbd6c5;p=physik%2Fposic.git convert POSCAr files to moldyn xyz output --- diff --git a/vasp_tools/poscar2moldyn b/vasp_tools/poscar2moldyn new file mode 100755 index 0000000..cb9fec0 --- /dev/null +++ b/vasp_tools/poscar2moldyn @@ -0,0 +1,62 @@ +#!/bin/bash + +mkdir -p video + +echo "parsing POSCAR file ..." + +sicnt=`sed -n 6p POSCAR | awk '{ print $1 }'` +ccnt=`sed -n 6p POSCAR | awk '{ print $2 }'` + +lc=`sed -n 2p POSCAR | awk '{ print $1 }'` + +x1=`sed -n 3p POSCAR | awk '{ print $1 }'` +x2=`sed -n 3p POSCAR | awk '{ print $2 }'` +x3=`sed -n 3p POSCAR | awk '{ print $3 }'` + +y1=`sed -n 4p POSCAR | awk '{ print $1 }'` +y2=`sed -n 4p POSCAR | awk '{ print $2 }'` +y3=`sed -n 4p POSCAR | awk '{ print $3 }'` + +z1=`sed -n 5p POSCAR | awk '{ print $1 }'` +z2=`sed -n 5p POSCAR | awk '{ print $2 }'` +z3=`sed -n 5p POSCAR | awk '{ print $3 }'` + +((total=sicnt+ccnt)) + +echo " Si: $sicnt, C: $ccnt, total: $total" +echo " $x1 $y1 $z1" +echo " x = $x2 y = $y2 z = $z2" +echo " $x3 $y3 $z3" + +cnt=0 +tcnt=0 + +cx=1.0 +cy=1.0 +cz=0.8 + +echo "# P $total init <$cx,$cy,$cz>" > video/atomic_conf_init.xyz + +tail -${total} POSCAR | \ + while read x y z fx fy fz; do + type="Si" + color="Yellow" + if [ $cnt -ge $sicnt ]; then + type="C" + color="Gray" + fi + ((X=0)) + ((Y=0)) + ((Z=0)) + X=`echo $X $x $y $z $x1 $y1 $z1 | \ + awk '{ print $1+($2*$5)+($3*$6)+($4*$7) }'` + Y=`echo $Y $x $y $z $x2 $y2 $z2 | \ + awk '{ print $1+($2*$5)+($3*$6)+($4*$7) }'` + Z=`echo $Z $x $y $z $x3 $y3 $z3 | \ + awk '{ print $1+($2*$5)+($3*$6)+($4*$7) }'` + echo "$type $X $Y $Z $color 0.0" >> video/atomic_conf_init.xyz + ((cnt+=1)) + done + +echo +