From: hackbard Date: Sun, 11 Oct 2009 14:45:06 +0000 (+0200) Subject: tool to create POSCAR files for 2nd db configurations X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16e9b596e93c754b718dbc277ff1912b7078cde9;p=physik%2Fposic.git tool to create POSCAR files for 2nd db configurations --- diff --git a/vasp_tools/create_dbc b/vasp_tools/create_dbc new file mode 100755 index 0000000..4b40c44 --- /dev/null +++ b/vasp_tools/create_dbc @@ -0,0 +1,141 @@ +#!/bin/bash + +# create POSCAR files for db combinations + +deltaC=0.1969 +deltaSi=0.1211 + +clen=3 + +file=$1/CONTCAR +if [ ! -f $file ]; then + echo "no CONTCAR file in $1 ..." + exit +fi + +lnumber=$2 +if [ -z $lnumber ]; then + echo "no line number specified ..." + exit +fi + +gline="`sed -n 6p $file`" +sic=`echo $gline | awk '{ print $1 }'` +cc=`echo $gline | awk '{ print $2 }'` +((tot=sic+cc)) +((addline=tot+8)) + +ltm=`sed -n ${lnumber}p $file` + +echo "line to modify:" +echo $ltm + +x=`echo $ltm | awk '{ print $1 }'` +y=`echo $ltm | awk '{ print $2 }'` +z=`echo $ltm | awk '{ print $3 }'` +s1=`echo $ltm | awk '{ print $4 }'` +s2=`echo $ltm | awk '{ print $5 }'` +s3=`echo $ltm | awk '{ print $6 }'` + +echo "00-1:" +nz=`echo $z $deltaSi $clen | awk '{ + res=$1+($2/$3) + if(res>1.0) print res-1.0 + else if(res<0.0) print res+1.0 + else print res +}'` +sed "s%$ltm%$x $y $nz $s1 $s2 $s3%" $file > POSCAR.00-1 +nz=`echo $z $deltaC $clen | awk '{ + res=$1-($2/$3) + if(res>1.0) print res-1.0 + else if(res<0.0) print res+1.0 + else print res +}'` +sed -i "$addline a\ +$x $y $nz T T T" POSCAR.00-1 + +echo "001:" +nz=`echo $z $deltaSi $clen | awk '{ + res=$1-($2/$3) + if(res>1.0) print res-1.0 + else if(res<0.0) print res+1.0 + else print res +}'` +sed "s%$ltm%$x $y $nz $s1 $s2 $s3%" $file > POSCAR.001 +nz=`echo $z $deltaC $clen | awk '{ + res=$1+($2/$3) + if(res>1.0) print res-1.0 + else if(res<0.0) print res+1.0 + else print res +}'` +sed -i "$addline a\ +$x $y $nz T T T" POSCAR.001 + +echo "0-10:" +ny=`echo $y $deltaSi $clen | awk '{ + res=$1+($2/$3) + if(res>1.0) print res-1.0 + else if(res<0.0) print res+1.0 + else print res +}'` +sed "s%$ltm%$x $ny $z $s1 $s2 $s3%" $file > POSCAR.0-10 +ny=`echo $y $deltaC $clen | awk '{ + res=$1-($2/$3) + if(res>1.0) print res-1.0 + else if(res<0.0) print res+1.0 + else print res +}'` +sed -i "$addline a\ +$x $ny $z T T T" POSCAR.0-10 + +echo "010:" +ny=`echo $y $deltaSi $clen | awk '{ + res=$1-($2/$3) + if(res>1.0) print res-1.0 + else if(res<0.0) print res+1.0 + else print res +}'` +sed "s%$ltm%$x $ny $z $s1 $s2 $s3%" $file > POSCAR.010 +ny=`echo $y $deltaC $clen | awk '{ + res=$1+($2/$3) + if(res>1.0) print res-1.0 + else if(res<0.0) print res+1.0 + else print res +}'` +sed -i "$addline a\ +$x $ny $z T T T" POSCAR.010 + +echo "-100:" +nx=`echo $x $deltaSi $clen | awk '{ + res=$1+($2/$3) + if(res>1.0) print res-1.0 + else if(res<0.0) print res+1.0 + else print res +}'` +sed "s%$ltm%$nx $y $z $s1 $s2 $s3%" $file > POSCAR.-100 +nx=`echo $x $deltaC $clen | awk '{ + res=$1-($2/$3) + if(res>1.0) print res-1.0 + else if(res<0.0) print res+1.0 + else print res +}'` +sed -i "$addline a\ +$nx $y $z T T T" POSCAR.-100 + +echo "100:" +nx=`echo $x $deltaSi $clen | awk '{ + res=$1-($2/$3) + if(res>1.0) print res-1.0 + else if(res<0.0) print res+1.0 + else print res +}'` +sed "s%$ltm%$nx $y $z $s1 $s2 $s3%" $file > POSCAR.100 +nx=`echo $x $deltaC $clen | awk '{ + res=$1+($2/$3) + if(res>1.0) print res-1.0 + else if(res<0.0) print res+1.0 + else print res +}'` +sed -i "$addline a\ +$nx $y $z T T T" POSCAR.100 +