Editing
Gaussian2molden
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
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>#### This program reads a gaussian output file to create a xyz file, easy to read with molden.</nowiki> <nowiki>#### Be careful the file "temp" will be used and removed</nowiki> <nowiki>#### first argument $1 is the gaussian output file you want to convert</nowiki> <nowiki>#### second argument $2 is the xyz file you want to create</nowiki> <nowiki>#### type in the console </nowiki> <nowiki>#### "gaussian2molden.sh file1.out file2.xyz"</nowiki> <nowiki>if test -z "$1"</nowiki> <nowiki> then echo "Error: This program needs two arguments"</nowiki> <nowiki> exit 1</nowiki> <nowiki>fi</nowiki> <nowiki>if [! -f ${1} ] ;then</nowiki> <nowiki> echo "Error : File \"$1\" doesnt exist" </nowiki> <nowiki> exit 1</nowiki> <nowiki>fi </nowiki> <nowiki>if test -z $2</nowiki> <nowiki> then echo "Error : This program needs two arguments"</nowiki> <nowiki> exit 1</nowiki> <nowiki>fi</nowiki> <nowiki>if [ $1 = $2 ] ; then</nowiki> <nowiki> echo "Error: your new file cannot be same as the argument file."</nowiki> <nowiki> echo "your files wont be changed"</nowiki> <nowiki> exit 1</nowiki> <nowiki>fi</nowiki> <nowiki>if [ -f $2 ]; then</nowiki> <nowiki> echo "Error new file: $2 arleady exists! type ctrl c to quit or enter to continue"</nowiki> <nowiki> read rien</nowiki> <nowiki>fi </nowiki> <nowiki>natoms=$(fgrep NAtoms $1 | awk '{print $2}' | tail -1 )</nowiki> <nowiki>total=$(echo "$natoms+4" | bc )</nowiki> <nowiki>fgrep -A""$total"" 'orientation' $1 | awk '{print $2,$4,$5,$6}' > $2</nowiki> <nowiki>sed -i "s/orientation:/$natoms/g" $2</nowiki> <nowiki>sed -i '/Atomic/d' $2</nowiki> <nowiki>sed -i '/Number/d' $2</nowiki> <nowiki>fgrep Done $1 | cut -d" " -f 8 >temp</nowiki> <nowiki>i=0</nowiki> <nowiki>for line in $(cat temp)</nowiki> <nowiki> do </nowiki> <nowiki> n=$(echo $i*$total+2 | bc )</nowiki> <nowiki> sed -i "$n s/.*/E= $line/g" $2</nowiki> <nowiki> i=$(echo $i+1 | bc) </nowiki> <nowiki> done</nowiki> <nowiki> awk 'NF' $2 > temp</nowiki> <nowiki> cat temp > $2</nowiki> <nowiki> </nowiki> <nowiki># ADD MORE LINES HERE FOR PROCESSING DIFFERENT ATOMS </nowiki> <nowiki>#Hydrogens</nowiki> <nowiki>sed -i "1,$ s/^1\ /H\ /g" $2 </nowiki> <nowiki>#Carbons</nowiki> <nowiki>sed -i "1,$ s/^6\ /C\ /g" $2</nowiki> <nowiki></nowiki> <nowiki>#Nitrogens</nowiki> <nowiki>sed -i "1,$ s/^7\ /N\ /g" $2</nowiki> <nowiki></nowiki> <nowiki>#Oxygens</nowiki> <nowiki>sed -i "1,$ s/^8\ /O\ /g" $2</nowiki> <nowiki></nowiki> <nowiki></nowiki> <nowiki>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"</nowiki> <nowiki>echo " "</nowiki> <nowiki>echo " "</nowiki> <nowiki>rm temp</nowiki>
Summary:
Please note that all contributions to Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information