# # This awk script will take the optimization information from a ADF output file and make a molden file # # This script was created by Lisa M. Perez at the Laboratory for Molecular Simulation and is provided as is. This script # has not been fully tested. Use at your own risk. # # Please e-mail Lisa M. Perez at mouse@mail.chem.tamu.edu with problems. # # To use this script you should make an alias in your .cshrc or .login file: # # alias adftomolden 'awk -f /home/mouse/adf_to_molden.awk \!*.adfout > \!*.molden' # # This alias implies that you put adf_to_molden.awk in your home directory and that your ADF output files end in .adfout # You will type adftomolden filename to execute. The script will create a file named filename.molden # # last updated 03/30/04 # BEGIN{i=0;points=0;k1=0;k2=1;k3=1;k4=1;k5=1} # get the energies except for the last energy / new :/ { k1=k1+1 energy[k1]=$3 } #get the max gradient. Start storing in index 2 since the first geometry doesn't have a max gradient / gradient max / { k2=k2+1 maxgrad[k2]=$3 } #get the max step . Start storing in index 2 / step max / { k3=k3+1 maxstep[k3]=$4 } #get the max step (bond) if opt is in zmat instead of cart coor. Start storing in index 2 / bond step max / { k3=k3+1 maxstep[k3]=$4 } #get the rms gradient . Start storing in index 2 / gradient rms / { k4=k4+1 rmsgrad[k4]=$3 } #get the rms step . Start storing in index 2 / step rms / { k5=k5+1 rmsstep[k5]=$4 } #get the rms step (bond) if opt is zmat instead of cart coor. Start storing in index 2 / bond step rms / { k5=k5+1 rmsstep[k5]=$4 } # get the starting structure / ===== X Y Z CHARGE/,/^$/ { i=i+1 if (i>3) { as[i-3]=$2 x[i-3]=x[i-3] " " $3 y[i-3]=y[i-3] " " $4 z[i-3]=z[i-3] " " $5 # store the number of atoms in the molecule and reset the index if (/^$/) {atoms=i-4;i=0} } } # get the other structures / X Y Z X Y Z/,/^$/ { i=i+1 if (i>2) { #print "as="as[i-2]" i-2="i-2 x[i-2]=x[i-2] " " $6 y[i-2]=y[i-2] " " $7 z[i-2]=z[i-2] " " $8 # count the number of optimization points and reset the index if (/^$/) { i=0 ; points=points+1} } } # get the final energy / Total Bonding Energy:/ { energy[points]=$4 } END { # print the energy section print "[Molden Format]" print "[GEOCONV]" print "energy" for (i=1;i<=points;i++) { printf "%14.6f\n",energy[i] } print "max-force" for (i=1;i<=points;i++) { printf "%14.6f\n",maxgrad[i] } print "rms-force" for (i=1;i<=points;i++) { printf "%14.6f\n",rmsgrad[i] } print "max-step" for (i=1;i<=points;i++) { printf "%14.6f\n",maxstep[i] } print "rms-step" for (i=1;i<=points;i++) { printf "%14.6f\n",rmsstep[i] } #print geometries print "[GEOMETRIES] XYZ" for (i=1;i<=points;i++) { print atoms print "energy="energy[i]" a.u." for (k=1;k<=atoms;k++) { split(x[k],finalx," ") split(y[k],finaly," ") split(z[k],finalz," ") printf "%2.2s%13.6f%13.6f%13.6f\n",as[k],finalx[i],finaly[i],finalz[i] } } } # This section is not used #split(a[k],temp," ") #split(temp[1],an,".") #as[k]=an[2] #if (as[k]=="H") {an[k]="1"} #if (as[k]=="He") {an[k]="2"} #if (as[k]=="Li") {an[k]="3"} #if (as[k]=="Be") {an[k]="4"} #if (as[k]=="B") {an[k]="5"} #if (as[k]=="C") {an[k]="6"} #if (as[k]=="N") {an[k]="7"} #if (as[k]=="O") {an[k]="8"} #if (as[k]=="F") {an[k]="9"} #if (as[k]=="Ne") {an[k]="10"} #if (as[k]=="Na") {an[k]="11"} #if (as[k]=="Mg") {an[k]="12"} #if (as[k]=="Al") {an[k]="13"} #if (as[k]=="Si") {an[k]="14"} #if (as[k]=="P") {an[k]="15"} #if (as[k]=="S") {an[k]="16"} #if (as[k]=="Cl") {an[k]="17"} #if (as[k]=="Ar") {an[k]="18"} #if (as[k]=="K") {an[k]="19"} #if (as[k]=="Ca") {an[k]="20"} #if (as[k]=="Sc") {an[k]="21"} #if (as[k]=="Ti") {an[k]="22"} #if (as[k]=="V") {an[k]="23"} #if (as[k]=="Cr") {an[k]="24"} #if (as[k]=="Mn") {an[k]="25"} #if (as[k]=="Fe") {an[k]="26"} #if (as[k]=="Co") {an[k]="27"} #if (as[k]=="Ni") {an[k]="28"} #if (as[k]=="Cu") {an[k]="29"} #if (as[k]=="Zn") {an[k]="30"} #if (as[k]=="Ga") {an[k]="31"} #if (as[k]=="Ge") {an[k]="32"} #if (as[k]=="As") {an[k]="33"} #if (as[k]=="Se") {an[k]="34"} #if (as[k]=="Br") {an[k]="35"} #if (as[k]=="Kr") {an[k]="36"} #if (as[k]=="Rb") {an[k]="37"} #if (as[k]=="Sr") {an[k]="38"} #if (as[k]=="Y") {an[k]="39"} #if (as[k]=="Zr") {an[k]="40"} #if (as[k]=="Nb") {an[k]="41"} #if (as[k]=="Mo") {an[k]="42"} #if (as[k]=="Tc") {an[k]="43"} #if (as[k]=="Ru") {an[k]="44"} #if (as[k]=="Rh") {an[k]="45"} #if (as[k]=="Pd") {an[k]="46"} #if (as[k]=="Ag") {an[k]="47"} #if (as[k]=="Cd") {an[k]="48"} #if (as[k]=="In") {an[k]="49"} #if (as[k]=="Sn") {an[k]="50"} #if (as[k]=="Sb") {an[k]="51"} #if (as[k]=="Te") {an[k]="52"} #if (as[k]=="I") {an[k]="53"} #if (as[k]=="Xe") {an[k]="54"} #if (as[k]=="Cs") {an[k]="55"} #if (as[k]=="Ba") {an[k]="56"} #if (as[k]=="La") {an[k]="57"} #if (as[k]=="Ce") {an[k]="58"} #if (as[k]=="Pr") {an[k]="59"} #if (as[k]=="Nd") {an[k]="60"} #if (as[k]=="Pm") {an[k]="61"} #if (as[k]=="Sm") {an[k]="62"} #if (as[k]=="Eu") {an[k]="63"} #if (as[k]=="Gd") {an[k]="64"} #if (as[k]=="Tb") {an[k]="65"} #if (as[k]=="Dy") {an[k]="66"} #if (as[k]=="Ho") {an[k]="67"} #if (as[k]=="Er") {an[k]="68"} #if (as[k]=="Tm") {an[k]="69"} #if (as[k]=="Yb") {an[k]="70"} #if (as[k]=="Lu") {an[k]="71"} #if (as[k]=="Hf") {an[k]="72"} #if (as[k]=="Ta") {an[k]="73"} #if (as[k]=="W") {an[k]="74"} #if (as[k]=="Re") {an[k]="75"} #if (as[k]=="Os") {an[k]="76"} #if (as[k]=="Ir") {an[k]="77"} #if (as[k]=="Pt") {an[k]="78"} #if (as[k]=="Au") {an[k]="79"} #if (as[k]=="Hg") {an[k]="80"} #if (as[k]=="Tl") {an[k]="81"} #if (as[k]=="Pb") {an[k]="82"} #if (as[k]=="Bi") {an[k]="83"} #if (as[k]=="Po") {an[k]="84"} #if (as[k]=="At") {an[k]="85"} #if (as[k]=="Rn") {an[k]="86"} #if (as[k]=="Fr") {an[k]="87"} #if (as[k]=="Ra") {an[k]="88"} #if (as[k]=="Ac") {an[k]="89"} #if (as[k]=="Th") {an[k]="90"} #if (as[k]=="Pa") {an[k]="91"} #if (as[k]=="U") {an[k]="92"} #if (as[k]=="Np") {an[k]="93"} #if (as[k]=="Pu") {an[k]="94"} #if (as[k]=="Am") {an[k]="95"} #if (as[k]=="Cm") {an[k]="96"} #if (as[k]=="Bk") {an[k]="97"} #if (as[k]=="Cf") {an[k]="98"} #if (as[k]=="Es") {an[k]="99"} #if (as[k]=="Fm") {an[k]="100"} #if (as[k]=="Md") {an[k]="101"} #if (as[k]=="No") {an[k]="102"} #if (as[k]=="Lr") {an[k]="103"}