Gaussian2molden: Difference between revisions

From Wiki
Jump to navigation Jump to search
Cgoehry (talk | contribs)
New page: <nowiki>#### copy this text and put it in ~/bin/gaussian2molden.sh, then type "chmod 777 *" , restart your terminal and you can use it</nowiki> <nowiki>#### This program reads a gaussian ...
 
No edit summary
 
Line 1: Line 1:
go back to [[Main Page]], [[Computational Resources]], [[Scripts]], [[Scripts for Gaussian]]
<nowiki>#### copy this text and put it in ~/bin/gaussian2molden.sh, then type "chmod 777 *" , restart your terminal and you can use it</nowiki>
<nowiki>#### copy this text and put it in ~/bin/gaussian2molden.sh, then type "chmod 777 *" , restart your terminal and you can use it</nowiki>



Latest revision as of 13:25, 13 September 2011

go back to Main Page, Computational Resources, Scripts, Scripts for Gaussian


#### copy this text and put it in ~/bin/gaussian2molden.sh, then type "chmod 777 *" , restart your terminal and you can use it

#### This program reads a gaussian output file to create a xyz file, easy to read with molden.

#### Be careful the file "temp" will be used and removed

#### first argument $1 is the gaussian output file you want to convert

#### second argument $2 is the xyz file you want to create

#### type in the console

#### "gaussian2molden.sh file1.out file2.xyz"

if test -z "$1"

then echo "Error: This program needs two arguments"

exit 1

fi

if [! -f ${1} ] ;then

echo "Error : File \"$1\" doesnt exist"

exit 1

fi

if test -z $2

then echo "Error : This program needs two arguments"

exit 1

fi

if [ $1 = $2 ] ; then

echo "Error: your new file cannot be same as the argument file."

echo "your files wont be changed"

exit 1

fi

if [ -f $2 ]; then

echo "Error new file: $2 arleady exists! type ctrl c to quit or enter to continue"

read rien

fi

natoms=$(fgrep NAtoms $1 | awk '{print $2}' | tail -1 )

total=$(echo "$natoms+4" | bc )

fgrep -A""$total"" 'orientation' $1 | awk '{print $2,$4,$5,$6}' > $2

sed -i "s/orientation:/$natoms/g" $2

sed -i '/Atomic/d' $2

sed -i '/Number/d' $2

fgrep Done $1 | cut -d" " -f 8 >temp

i=0

for line in $(cat temp)

do

n=$(echo $i*$total+2 | bc )

sed -i "$n s/.*/E= $line/g" $2

i=$(echo $i+1 | bc)

done

awk 'NF' $2 > temp

cat temp > $2

# ADD MORE LINES HERE FOR PROCESSING DIFFERENT ATOMS

#Hydrogens

sed -i "1,$ s/^1\ /H\ /g" $2

#Carbons

sed -i "1,$ s/^6\ /C\ /g" $2

#Nitrogens

sed -i "1,$ s/^7\ /N\ /g" $2

#Oxygens

sed -i "1,$ s/^8\ /O\ /g" $2

echo -en '\E[0;31m'"\033[1mK\033[0m"'\E[0;32m'"\033[1mA\033[0m"'\E[0;34m'"\033[1mR\033[0m"'\E[0;35m'"\033[1mL\033[0m"

echo " "

echo " "

rm temp