cclib is an open-source Python library designed for parsing and interpreting output files from various computational chemistry packages. It provides a consistent interface to extract data like geometries, energies, orbitals, and vibrational modes, facilitating the implementation of package-independent algorithms. The current stable version is 1.8.1, with a major version 2.0 actively in alpha development, which is expected to introduce significant architectural and API changes.
pip install cclibVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `cclib.io.ccread` to parse a computational chemistry output file. It creates a simple dummy logfile, parses it, and then accesses common attributes like the number of atoms, SCF energy, and atom coordinates from the returned `ccData` object.
Upgrade your Python environment to 3.7 or newer. For projects dependent on cclib, ensure your `requirements.txt` specifies `python_version >= '3.7'`.
Ensure SciPy is installed in your environment: `pip install scipy`.
Refer to the official cclib 2.0 documentation and changelog (once released) for migration guides. Expect changes in how data is accessed and structured.
Always remember that array indices in cclib are 0-based. Adjust calculations and data access accordingly.
Instead of passing a list of files to `ccread`, iterate over the list and call `ccread` for each file individually: `for log_file in log_files: data = cclib.io.ccread(log_file)`.
Check the logfile to confirm the data is actually present. Consult the cclib documentation's 'Parsed data' section to see which attributes are supported for your specific computational chemistry program and its version. Use `hasattr(data, 'attribute_name')` or a `try-except AttributeError` block for robust code.
Ensure `cclib` is installed (`pip install cclib`). If attempting a direct parser import, verify the exact module path. The recommended way to parse is using `from cclib.io import ccread` which handles parser selection automatically.