!#/bin/ksh # --------------------------------------------------------------- # batch file to run over several diplaced atoms # --------------------------------------------------------------- if test -f POSCAR.phon then echo "POSCAR.phon exist remove before starting batchfile" exit 1 fi cp POSCAR POSCAR.phon # # loop over all exited ions # j=0 for i in \ # here put the content of the DISP file " 1 0.00477204 -0.00477204 0.00477204 " \ " 9 0.00477204 -0.00477204 0.00477204 " do j=`expr $j + 1` echo "run number $j" # # use awk to displace atoms (somewhat tricky) # awk ' /SUBSIT/ { npos = $2 ; x=$3; y=$4 ; z=$5; } !/SUBSIT/ { line=line+1 if (line-7 == npos) { printf "%12.9f %12.9f %12.9f\n", $1+x, $2+y, $3+z } else if (line > 7) { printf "%12.9f %12.9f %12.9f\n", $1, $2, $3 } else print } ' >POSCAR <DYNMAT.$j awk ' /total drift:/ { start=0} !/----------/ { if ( start ==1) { printf "%14.8f %14.8f %14.8f\n",$4,$5,$6 }} /TOTAL-FORCE/ { start = 1} ' >DYNMAT.$j done # restore POSCAR file mv POSCAR.phon POSCAR echo $j > FORCES i=1 while test $i -le $j do cat DYNMAT.$i >> FORCES i=`expr $i + 1` done