#!/bin/bash dohelp=0 cutoff="0" cmdsuffix="" volrelaxcommand="runstruct_vasp -w vaspvol.wrap" relaxcommand="runstruct_vasp -w vasp.wrap" chaincommand="runstruct_vasp -w vaspneb.wrap" staticcommand="runstruct_vasp -w vaspstatic.wrap" infdetcommand="runstruct_vasp -p -w vaspid.wrap" doid=0 idopt="-d" idf="0.5" idja="0.0" idjc="0.0" doneb=0 doextract=0 nimage=6 dovib=0 makevaspfiles=0 contif=0 if [[ $1 == "" || $1 == "-h" ]] then cat - < str_hint.out . Sometimes a supercell is needed (a phonon analysis will tell you that - or symbrklib for bcc,fcc,hcp). EOF exit fi if [[ $makevaspfiles == 1 ]] then if [[ ! -e vasp.wrap ]] then echo Please provide a vasp.wrap file. exit fi grep -v -i -e ISIF -e DOSTATIC vasp.wrap > vaspvol.wrap echo ISIF = 7 >> vaspvol.wrap grep -v -i -e ISMEAR -e SIGMA -e NSW -e IBRION -e ISIF -e DOSTATIC vasp.wrap > vaspstatic.wrap cat - >> vaspstatic.wrap < vaspneb.wrap echo IMAGES = $(( nimage -2 )) >> vaspneb.wrap cat - >>vaspneb.wrap < vaspf.wrap cat - >> vaspf.wrap < vaspid.wrap cat - >> vaspid.wrap < /dev/null if [[ $? == 0 ]] then staticcommand=""; echo Skipping static run step... fi fi fi fi fi if [[ $dovib == 1 ]] then for subdir in vol_0 smsqs/vol_0 do if [[ -e ${subdir}/svib_ht ]] then if [[ ! -e confmult.in ]] then echo using scaled ${subdir}/svib_ht echo `cat ${subdir}/svib_ht` `cellcvrt -pn < str.out` `cellcvrt -pn < ${subdir}/str_relax.out` | awk '{print $1*$2/$3}' > svib_ht else echo using scaled ${subdir}/svib_ht and confmult.in echo `cat ${subdir}/svib_ht` `cellcvrt -pn < str.out` `cellcvrt -pn < ${subdir}/str_relax.out` `cat confmult.in` | awk '{print $1*$2/$3+$2*log($4)}' > svib_ht fi exit fi done echo No svib_ht file in `pwd`/vol_0 or `pwd`/smsqs/vol_0 exit fi if [[ $doextract == 0 ]] then if [[ $relaxcommand != "" ]] then echo $relaxcommand $cmdsuffix $relaxcommand $cmdsuffix fi if [[ -e error ]] then echo Error during relaxation run. exit 1 fi relmag=`checkrelax -1` # if [[ ! (( $relmag > $cutoff || -e str_sup.out )) ]] if [[ ! (( $relmag > $cutoff )) ]] then if [[ $relaxcommand != "" ]] then mv energy energy_sup echo `cat energy_sup` `cellcvrt -pn < str.out` `cellcvrt -pn < str_relax.out` | awk '{print $1*$2/$3}' > energy fi else if [[ $relaxcommand != "" ]] then mv energy energy_end if [[ ! -e str_end.out ]] then cp str_relax.out str_end.out fi fi mkdir 00 if [[ $volrelaxcommand != "" ]] then if [[ -e str_sup.out ]] then cp str_sup.out 00/str.out else cp str.out 00/ fi cd 00 echo "Now working in" `pwd` echo $volrelaxcommand $cmdsuffix $volrelaxcommand $cmdsuffix if [[ -e error ]] then echo Error during static run in 00/ touch ../error exit 1 fi cd .. fi if [[ ! -e str_beg.out ]] then cp 00/str_relax.out str_beg.out fi if [[ $doid == 1 ]] then if [[ ! -e KPOINTS ]] then cp KPOINTS.static KPOINTS fi mkdir 01 if [[ -e 01/str_hint.in ]] then cp 01/str_hint.in 01/str.in else strpath -s1=str_beg.out -s2=str_end.out -f=${idf} | cellcvrt -ja=$idja -jc=$idjc > 01/str.in fi if [[ $infdetcommand != "" ]] then pushd 01 > /dev/null echo "Now working in" `pwd` if [[ -e str_hint.in ]] then cp str_hint.in str.in fi if [[ -e busy ]] then rm busy fi echo Running infdet $idopt rm -f error stop busy if [[ -e infdet.log ]] then for (( baknum=1 ; ; baknum++ )) do if [[ ! -e infdet.save${baknum} ]] then cp infdet.log infdet.save${baknum} break; fi done fi ( infdet $idopt > infdet.log ; if [[ $? == 1 ]] ; then touch error ; fi ; touch stop ) & while [[ 1 ]] do while [[ ! -e busy && ! -e stop && ! -e error ]] do sleep 2 done if [[ -e stop || -e error ]] then break fi echo vasp rm stress.out force.out > /dev/null $infdetcommand $cmdsuffix cat stress.out force.out rm busy echo waiting done rm -f stop busy if [[ -e error ]] then echo Error during inflection detection run in 01/ touch ../error exit 1 fi if [[ ! -e cstr_relax.out ]] then cp str_current.out cstr_relax.out fi popd fi if [[ $staticcommand != "" ]] then pushd 01 cp cstr_relax.out str.out echo "$staticcommand $cmdsuffix" $staticcommand $cmdsuffix popd fi if [[ -e error ]] then echo Error during static run in 01/ exit 1 fi echo `cat 01/energy` `cellcvrt -pn < str.out` `cellcvrt -pn < 01/str_relax.out` | awk '{print $1*$2/$3}' > energy ( echo `cellcvrt -pn < str.out` `cellcvrt -pn < 01/str_relax.out` ; cat 01/dos.out )| awk 'BEGIN {getline; sc=$1/$2; getline; print $1*sc,$2,$3} {print $1*sc;}' > dos.out cp 01/cstr_relax.out str_relax.out exit 0 elif [[ $doneb == 1 ]] then strpath -s1=str_beg.out -s2=str_end.out -ni=$nimage if [[ $chaincommand != "" ]] then lastdir=`ls -d -1 ?? | sort -n | tail -n -1` cp ${lastdir}/str.out ${lastdir}/str_relax.out echo "$chaincommand -nr" foreachfile str.out "$chaincommand -nr" for file in POTCAR KPOINTS INCAR vasp.in do rm ??/${file} done echo $chaincommand "$cmdsuffix" $chaincommand "$cmdsuffix" foreachfile str.out "$chaincommand -ex" foreachfile str_relax.out cp str_relax.out str_hint.out foreachfile str_relax.out cp OSZICAR OSZICAR.neb cp OUTCAR OUTCAR.neb \; gzip OUTCAR.neb if [[ $staticcommand != "" ]] then echo "$staticcommand $cmdsuffix" foreachfile str_relax.out "$staticcommand $cmdsuffix" fi fi else strpath -s1=str_beg.out -s2=str_end.out -ni=$nimage if [[ $volrelaxcommand != "" ]] then echo "$volrelaxcommand $cmdsuffix" foreachfile str.out "$volrelaxcommand $cmdsuffix" fi if [[ $staticcommand != "" ]] then echo "$staticcommand $cmdsuffix" foreachfile str_relax.out "$staticcommand $cmdsuffix" fi fi fi fi if [[ $doextract == 1 || (( $relmag > $cutoff || -e str_sup.out )) ]] then if [[ ! -e 00 ]] then runstruct_vasp -ex cp energy energy_end echo `cat energy_end` `cellcvrt -pn < str.out` `cellcvrt -pn < str_relax.out` | awk '{print $1*$2/$3}' > energy else if [[ ! -e energy_end ]] then cp energy energy_end fi lastenergy=`ls -d -1 ?? | sort -n | tail -n -1` #echo $lastenergy if [[ ! -e ${lastenergy}/energy ]] then cp energy_end ${lastenergy}/energy fi ((curnimage=lastenergy+0)) #echo $curnimage cat `ls -1 ??/energy | sort -n` > epath.out # cat epath.out | strpath -ci > energy echo `cat epath.out | strpath -ci` `cellcvrt -pn < str.out` `cellcvrt -pn < str_beg.out` | awk '{print $1*$2/$3}' > energy iploc=$(cat epath.out | strpath -cil | awk '{print $1*('$curnimage')}') #echo $iploc dirb=$(echo $iploc | awk '{n=int($1); printf("%02i",n)}') #echo $dirb if [[ $iploc == $curnimage ]] then #echo cp only cp ${dirb}/str_relax.out . else dire=$(echo $iploc | awk '{n=int($1)+1; printf("%02i",n)}') #echo $dire frac=$(echo $iploc | awk '{print $1-int($1);}') #echo $frac strpath -f=${frac} -s1=${dirb}/str_relax.out -s2=${dire}/str_relax.out > str_relax.out echo strpath -f=${frac} -s1=${dirb}/str_relax.out -s2=${dire}/str_relax.out fi fi fi