In [1]:
import IPython
url = "https://github.com/cclib/cclib/raw/master/logo.png"
IPython.display.Image(url=url)
Out[1]:
To quote the GitHub page,
cclib is a Python library that provides parsers for output files of computational chemistry packages. It also provides a platform for computational chemists to implement algorithms in a platform-independent way.
What this means is that for many common properties that can be calculated using quantum chemistry packages, cclib can turn them into Python objects for manipulation. This is especially valuable for analysis.
It also means that much of the work we did in the "Reading QM outputs" exercises is no longer necessary. Given a path to an output file, cclib will open it, search for all possible properties it "knows" about, and will extract them into appropriate Python datatypes.
The most common way to use cclib is as follows:
In [2]:
from cclib.parser import ccread
In [3]:
ccdata = ccread("../qm_files/drop_0375_0qm_0mm.out")
In older code, you might see this as well; it should be equivalent to using ccread
.
In [4]:
from cclib.parser import ccopen
job = ccopen("../qm_files/drop_0375_0qm_0mm.out")
ccdata2 = job.parse()
Let's see what's available when we open or parse an output file:
In [5]:
print('\n'.join(dir(ccdata)))
Aside from the standard double underscore ("dunder") private methods, there are a number of attributes that sound like chemical properties.