#!/usr/local/bin/perl # Jan Labanowski, OSC, 1994 # This program exacts the last cartesian coordinates from the # GAMESS output file and produces an XYZ file suitable for # viewing the molecule under X with xmol program from MSC. # First line shows the location of perl (usually: /usr/local/bin/perl) # On the OSC Cray it is #!/loclib/bin/perl # remember to use chmod 700 gauss2aces.perl (i.e., set x bit) # USAGE: # gamess2xyz.perl < filename.out > filename.xyz # # You must continue this table if you want atoms higher than Ar @atom_symbols = ("X", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar"); $n_atoms = 0; $run_title = "XYZ cartesian coordinates"; while ($line = ) { chop($line); if($line =~ /RUN TITLE/) { $line = ; $run_title = ; chop($run_title); $run_title =~ s/^\s+//; $run_title =~ s/\s+$//; next; } if($line =~ /CHARGE X Y Z/) { $n_atoms = 0; while($line = ) { chop($line); if($line =~ /\S/) { $n_atoms++; $line =~ s/^\s+//; @entries = split(/\s+/,$line); $at_number = int($entries[1]); $symbol[$n_atoms] = $atom_symbols[$at_number]; $x[$n_atoms] = 0.529177249*$entries[2]; $y[$n_atoms] = 0.529177249*$entries[3]; $z[$n_atoms] = 0.529177249*$entries[4]; } else { last; } } } } printf STDOUT "%d\n", $n_atoms; print STDOUT $run_title, "\n"; for($i = 1; $i <= $n_atoms; $i++) { printf STDOUT "%-5s %16.7f %16.7f %16.7f\n", $symbol[$i], $x[$i], $y[$i], $z[$i]; }