]> hackdaworld.org Git - physik/posic.git/commitdiff
convert POSCAr files to moldyn xyz output
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Wed, 5 Aug 2009 14:59:37 +0000 (16:59 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Wed, 5 Aug 2009 14:59:37 +0000 (16:59 +0200)
vasp_tools/poscar2moldyn [new file with mode: 0755]

diff --git a/vasp_tools/poscar2moldyn b/vasp_tools/poscar2moldyn
new file mode 100755 (executable)
index 0000000..cb9fec0
--- /dev/null
@@ -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
+