From: hackbard Date: Thu, 24 Sep 2009 16:44:35 +0000 (+0200) Subject: just to have this stored somewhere ... X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=a180e025860c0a385fd37142e4f0866ed4006218;p=physik%2Fposic.git just to have this stored somewhere ... --- diff --git a/vasp_tools/constraint_mig_script b/vasp_tools/constraint_mig_script new file mode 100755 index 0000000..ca74b78 --- /dev/null +++ b/vasp_tools/constraint_mig_script @@ -0,0 +1,74 @@ +#!/bin/bash + +# migration + +fx=0.1667178996794456 +fy=0.1667178996794456 +fz=0.0655951877086257 + +((steps=20)) +((count=0)) + +while [ $count -lt $steps ]; do + + cnt=`printf "%02d" $count` + + echo + echo + echo "run simulation $cnt ..." + [ $count != 0 ] && + echo " c atom at: `sed -n 226p CONTCAR`" + echo + echo + ../vasp.4.6-gamma-ct/vasp + + cp POSCAR POSCAR.${cnt} + cp CONTCAR CONTCAR.${cnt} + cp OUTCAR OUTCAR.${cnt} + + ltm="`sed -n 226p CONTCAR`" + val1=`echo $ltm | awk '{ print $1 }'` + val2=`echo $ltm | awk '{ print $2 }'` + val3=`echo $ltm | awk '{ print $3 }'` + val4=`echo $ltm | awk '{ print $4 }'` + val5=`echo $ltm | awk '{ print $5 }'` + val6=`echo $ltm | awk '{ print $6 }'` + + ((rest=steps-count)) + + nx=`echo $val1 $fx $rest | awk '{ print $1+($2-$1)/$3 }'` + ny=`echo $val2 $fy $rest | awk '{ print $1+($2-$1)/$3 }'` + nz=`echo $val3 $fz $rest | awk '{ print $1+($2-$1)/$3 }'` + + sed "s%$ltm% $nx $ny $nz $val4 $val5 $val6%" CONTCAR > POSCAR + + echo + echo "simulation $cnt end" + echo " c atom now at: `sed -n 226p CONTCAR`" + echo " dis x: `echo $val1 $fx $rest | awk '{ print ($2-$1)/$3 }'`" + echo " dis y: `echo $val2 $fy $rest | awk '{ print ($2-$1)/$3 }'`" + echo " dis z: `echo $val3 $fz $rest | awk '{ print ($2-$1)/$3 }'`" + echo + + newline="`echo $val1 $fx $val2 $fy $val3 $fz | awk '\ + BEGIN { + zrot=0; xrot=0; xyd=0; x=0; y=0; z=0; + } + { + x=$2-$1; y=$4-$3; z=$6-$5; + zrot=180.0*atan2(x,y)/3.14159265; + xyd=sqrt(x^2+y^2); + xrot=-180.0*atan2(z,xyd)/3.14159265; + print zrot " " xrot + }'`" + + ltm="`sed -n 8p POSCAR`" + echo "info:" + echo "$ltm" + echo "->" + echo "$newline" + sed -i "s%$ltm%$newline%" POSCAR + + ((count+=1)) +done +