care for appendices
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Wed, 26 Aug 2009 14:52:36 +0000 (16:52 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Wed, 26 Aug 2009 14:52:36 +0000 (16:52 +0200)
vasp_tools/poscar2moldyn

index b0ad584..a4f2562 100755 (executable)
@@ -2,8 +2,13 @@
 
 mkdir -p video
 
-file=$1
-[ -z $1 ] && file=POSCAR
+if [ -z $1 ]; then
+       file=POSCAR
+       app=""
+else
+       file=$1
+       app=".`echo $file | awk -F. '{ print $2 }'`"
+fi
 
 echo "parsing $file file ..."
 
@@ -25,6 +30,7 @@ z2=`sed -n 5p $file | awk '{ print $2 }'`
 z3=`sed -n 5p $file | awk '{ print $3 }'`
 
 ((total=sicnt+ccnt))
+((eoa=total+8))
 
 echo "  Si: $sicnt, C: $ccnt, total: $total"
 echo "  Lattice constant: $lc A"
@@ -40,9 +46,9 @@ cx=1.0
 cy=1.0
 cz=0.8
 
-echo "# P $total init <$cx,$cy,$cz>" > video/atomic_conf_init.xyz
+echo "# P $total init <$cx,$cy,$cz>" > video/atomic_conf_init${app}.xyz
 
-tail -${total} $file | \
+sed -n 9,${eoa}p $file | \
        while read x y z fx fy fz; do
                type="Si"
                color="Yellow"
@@ -59,7 +65,7 @@ tail -${total} $file | \
                X=`echo $lc $X | awk '{ print $1*$2 }'`
                Y=`echo $lc $Y | awk '{ print $1*$2 }'`
                Z=`echo $lc $Z | awk '{ print $1*$2 }'`
-               echo "$type $X $Y $Z $color 0.0" >> video/atomic_conf_init.xyz
+               echo "$type $X $Y $Z $color 0.0" >> video/atomic_conf_init${app}.xyz
                ((cnt+=1))
        done