Getting Cartesian coordinates from output w/out parsing .out file

Hi,

Is there a way to retrieve the optimized coordinates without parsing the output file? Is there a function that I can call from Python to get an the coordinates and atoms as a data structure?

Thanks,

JW

If you name your molecule, say ‘mymol’ in molecule mymol {...} in input, then any of the Molecule class operations here (http://psicode.org/psi4manual/master/autodoc_psimod.html#molecule) are available. Call them after the optimize(mtd) line, of course. In particular, test cases mints8, pywrap-molecule, pywrap-db3 may be useful models. mymol.geometry() is what you want for getting at the coordinates themselves. mymol.print_out() prints to the output file.

If you’re playing with the Molecule class w/o running a calc, you’ll want to issue mymol.update_geometry(). This is what must be done when you try to print the mol, and it complains that it has no atoms.

What’s going on in pywrap-molecule is that there’s a python class defined in lib/python/qcdb/molecule.py that closely mirrors the C++ class. You can toss individual instances between the languages easily. If you end up wanting to work in the Python class, there’s examples of iterating through molecule atoms in that file.

Thanks for pointing me to the molecule class. I decided to use save_xyz_file() to save a xyz file and convert it to a SD formatted file using Openbabel program. I like working with SD formatted files because it is easy to associate data, like energy values, to a molecule.

Ok, good. You’ve found the print_variables() and pyvar = psi4.get_variable('mp2 total energy') and the like, I hope.