14
$\begingroup$

This question is about tools like Open Babel. Are there any good command-line parsers for quantum chemistry program outputs? A good Python library could come in as a close second.

I am interested e.g. in support for the Psi4 output format.

$\endgroup$
0
10
$\begingroup$

CCLIB

Cclib is an open source python library that can parse and interpret output files of common computational chemistry programs. As of now, it supports Psi4 version 1.0 and 1.2.1.

It can be called from both command line and from python shell (or a python script).

From command line, you can use the ccget utility to parse the log file, and get a certain attribute.

C:\Users\Public> ccget atomcharges acetate.log
Attempting to read acetate.log
atomcharges
{'lowdin': array([-0.681752,  0.120888,  0.226508,  0.23122 ,  0.232586, -0.561103, -0.568346]),
 'mulliken': array([-0.912454,  0.268637,  0.250721,  0.25877 ,  0.257854, -0.568736, -0.554792])}

In this example, I used a GAMESS log file for a single point calculation on acetate, but the output format is the same regardless of the program used.

There are also three other utilites—ccwrite(which writes parsed data into json, cjson, cml and xyz formats), cda (which does chemical decomposition analysis), ccframe (which gives additional data writing capabilities, but requires the pandas library).

You can also call it from python:

>>> import cclib
>>> data = cclib.io.ccread("acetate.log")
>>> print("Number of molecular orbitals: ", data.nmo)
Number of molecular orbitals: 82

Further guide on data parsing can be found here, and here. Apart from Psi4, it can also read the outputs of GAMESS, Gaussian, Orca, NWChem, Turbomole, Molcas, ADF, Q-chem, Turbomole, Molpro etc.

The program works on Linux, Windows and Mac OS. It can be installed without Python as well (in which case only the command line utilities work).

$\endgroup$
7
$\begingroup$

IOData

iodata

Python based i/o module meant to go with HORTON, but also operates entirely on its own.

The Docs go over many of the things it can do, but it can read in, and output many file types. It also can create input files for you i.e., give it xyz or pdb or other and get a Gaussian input file. It is easy to customize the input file as well

from iodata import load_one

mol = load_one('water.xyz')  # XYZ files contain atomic coordinates in Angstrom
print(mol.atcoords)  # print coordinates in Bohr.

Currently when I use psi4, I get it to output a fchk file and then just read in the fchk with iodata. There are other options though, that is just the one I have used.

from iodata import load_one

mol = load_one('water.fchk')  
print(mol.atcoords)  # print coordinates in Bohr.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.