From: hackbard Date: Wed, 26 Aug 2009 14:52:36 +0000 (+0200) Subject: care for appendices X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=31a82cd2a10be5c6c7095c784588bb43c48a4c3d;p=physik%2Fposic.git care for appendices --- diff --git a/vasp_tools/poscar2moldyn b/vasp_tools/poscar2moldyn index b0ad584..a4f2562 100755 --- a/vasp_tools/poscar2moldyn +++ b/vasp_tools/poscar2moldyn @@ -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