#script written by JMB 2014 #This script calls Kirkland’s atompot and stemslic programs after first generating the input files. #Please refer to the book “Advanced Computing in Electron Microscopy” by Earl J. Kirkland for line by line description. #The script generates a frozen phonon using atom positions described by posgenu.rand and posgend.rand, which are an array of numbers to describe the beta to omega collapse. #The script needs to renamed as *.sh and run in a shell environment touch Readfile.temp echo $1'(abcdefghijklmnopqrstuvwxyz)' >> Readfile.temp for i in `seq 1 13`; do Num1=$(shuf -i 0-1000 -n 1) Num2=$(shuf -i 0-1000 -n 1) Num3=$(shuf -i 0-1000 -n 1) Num4=$(shuf -i 0-1000 -n 1) touch $i'A'.dat echo '7.985 2.82 2.305' >> $i'A'.dat echo '0' >> $i'A'.dat echo '22' >> $i'A'.dat echo '1.0000 0.0000 0.0000' >> $i'A'.dat echo '1.0000 0.3333 0.'$(sed -n ''$Num1'p' posgenu.rand) >> $i'A'.dat echo '1.0000 0.6667 0.'$(sed -n ''$Num2'p' posgend.rand) >> $i'A'.dat echo ''>> $i'A'.dat echo ''>> $i'A'.dat echo 'space'>> $i'A'.dat touch $i'A'.txt echo $i'A'.dat >> $i'A'.txt echo $i'A_pot.tif' >> $i'A'.txt echo $i'A_pot.tif' >> Readfile.temp echo '512 512' >> $i'A'.txt echo '4 12 1' >> $i'A'.txt echo 'n' >> $i'A'.txt touch $i'B'.dat echo '7.985 2.82 2.305' >> $i'B'.dat echo '0' >> $i'B'.dat echo '22' >> $i'B'.dat echo '1.0000 0.1667 0.'$(sed -n ''$Num3'p' posgend.rand) >> $i'B'.dat echo '1.0000 0.5000 0.0000' >> $i'B'.dat echo '1.0000 0.8333 0.'$(sed -n ''$Num4'p' posgenu.rand) >> $i'B'.dat echo ''>> $i'B'.dat echo ''>> $i'B'.dat echo 'space'>> $i'B'.dat touch $i'B'.txt echo $i'B'.dat >> $i'B'.txt echo $i'B_pot'.tif >> $i'B'.txt echo $i'B_pot.tif' >> Readfile.temp echo '512 512' >> $i'B'.txt echo '4 12 1' >> $i'B'.txt echo 'n' >> $i'B'.txt done #Read file continue echo '300 0 10 0 0 19.5' >> Readfile.temp echo '0 0' >> Readfile.temp echo '0 0' >> Readfile.temp echo '512 542' >> Readfile.temp echo '0 0' >> Readfile.temp echo 'n' >> Readfile.temp echo '1' >> Readfile.temp echo '53 318' >> Readfile.temp echo 'Out.tif' >> Readfile.temp echo '0 30 0 32 512 512' >> Readfile.temp #Run atompot for f in $(ls *.txt) do cat $f | ./../atompot while read line echo "$line" done #Run stemslic cat Readfile.temp | ./../stemslic while read line; do echo "$line"; #Finish echo 'End' eog Out.tif