Metadata-Version: 2.5
Name: qccodec
Version: 0.14.0
Summary: Encode qcdata inputs into native quantum chemistry files and decode (parse) program outputs into structured qcdata objects.
Project-URL: Homepage, https://github.com/atomsforhumanity/qccodec
Project-URL: Documentation, https://github.com/atomsforhumanity/qccodec#readme
Project-URL: Source, https://github.com/atomsforhumanity/qccodec
Project-URL: Changelog, https://github.com/atomsforhumanity/qccodec/blob/master/CHANGELOG.md
Project-URL: Bug Tracker, https://github.com/atomsforhumanity/qccodec/issues
Author-email: Colton Hicks <github@coltonhicks.com>
License: The MIT License (MIT)
        
        Copyright (c) 2023 Colton Hicks
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in
        all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
        THE SOFTWARE.
License-File: LICENSE
Keywords: computational chemistry,file parser,parsing,qcdata,quantum chemistry,scientific computing
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Chemistry
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.10
Requires-Dist: packaging>=23.0
Requires-Dist: qcdata>=0.20.1
Requires-Dist: qcref>=0.3.0
Requires-Dist: tomli-w>=1.0.0
Provides-Extra: geometric
Requires-Dist: geometric<2,>=1.0.1; extra == 'geometric'
Provides-Extra: tcpb
Requires-Dist: tcpb>=0.16.0; extra == 'tcpb'
Description-Content-Type: text/markdown

# qccodec

[![image](https://img.shields.io/pypi/v/qccodec.svg)](https://pypi.python.org/pypi/qccodec)
[![image](https://img.shields.io/pypi/l/qccodec.svg)](https://pypi.python.org/pypi/qccodec)
[![image](https://img.shields.io/pypi/pyversions/qccodec.svg)](https://pypi.python.org/pypi/qccodec)
[![CI](https://github.com/atomsforhumanity/qccodec/actions/workflows/ci.yaml/badge.svg)](https://github.com/atomsforhumanity/qccodec/actions/workflows/ci.yaml)

Translates [qcdata](https://github.com/atomsforhumanity/qcdata) inputs into native program inputs and parses program outputs back into qcdata objects, one codec per program.

**Documentation, including a copy-and-paste example script for every program and calculation type: [qccodec.docs.atomsforhumanity.org](https://qccodec.docs.atomsforhumanity.org)**

## The QC Suite

These packages work together to make quantum chemistry fast, structured, and interoperable.

- [qcref](https://github.com/atomsforhumanity/qcref) - Reference data for computational chemistry: CODATA physical constants, conversion factors, a periodic table, and solvent properties, each value with its source.
- [qcdata](https://github.com/atomsforhumanity/qcdata) - Data structures for quantum chemistry inputs and results, with Jupyter visualizations. [Documentation](https://qcdata.docs.atomsforhumanity.org)
- [qcinf](https://github.com/atomsforhumanity/qcinf) - Cheminformatics algorithms and structure utilities for [qcdata](https://github.com/atomsforhumanity/qcdata) structures.
- [qccodec](https://github.com/atomsforhumanity/qccodec) - Translates [qcdata](https://github.com/atomsforhumanity/qcdata) inputs into native program inputs and parses program outputs back into qcdata objects, one codec per program. [Documentation](https://qccodec.docs.atomsforhumanity.org)
- [qccompute](https://github.com/atomsforhumanity/qccompute) - Runs quantum chemistry programs on [qcdata](https://github.com/atomsforhumanity/qcdata) inputs using [qccodec](https://github.com/atomsforhumanity/qccodec) codecs and returns structured results. [Documentation](https://qccompute.docs.atomsforhumanity.org)
- [BigChem](https://github.com/mtzgroup/bigchem) - Distributed execution of qccompute calculations across clusters of computers or the cloud.
- [ChemCloud](https://github.com/mtzgroup/chemcloud-client) - A [web application](https://github.com/mtzgroup/chemcloud-server) and [Python client](https://github.com/mtzgroup/chemcloud-client) that expose a BigChem cluster securely over the internet.

## ✨ Basic Usage

qccodec never runs programs itself; [qccompute](https://github.com/atomsforhumanity/qccompute) runs them and uses qccodec on both ends.

```sh
python -m pip install qccompute   # also installs qccodec
```

```python
from qcdata import CalcType, Model, ProgramInput, Structure
from qccompute import compute

prog_input = ProgramInput(
    program="psi4",
    calctype=CalcType.gradient,
    structure=Structure(
        symbols=["O", "H", "H"],
        geometry=[[0.0, 0.0, 0.0], [0.524, 1.687, 0.48], [1.146, -0.45, -1.354]],
    ),
    model=Model(method="wb97x-d", basis="def2-svp"),
    keywords={"d_convergence": 1e-8},  # Psi4's own option names
)
output = compute(prog_input)
print(output.results.energy, output.results.gradient)
```

Decode output you already have, from Python or the command line:

```python
from pathlib import Path
from qccodec import decode

data = decode("terachem", "hessian", stdout=Path("tc.out").read_text())
data.energy, data.hessian, data.freqs_wavenumber
```

```sh
qccodec terachem hessian tc.out > data.json
```

See [Decoding program output](https://qccodec.docs.atomsforhumanity.org/guides/decoding/) for directories, failed calculations, and encoding without running.

## Supported programs

Each program has a documentation page and a runnable example script for every calculation type in [`examples/`](./examples).

| `program` | Calculation types | Notes |
| --- | --- | --- |
| [`crest`](https://qccodec.docs.atomsforhumanity.org/programs/crest/) | energy, gradient, hessian, optimization, conformer_search | GFN-xTB and GFN-FF built in |
| [`geometric`](https://qccodec.docs.atomsforhumanity.org/programs/geometric/) | optimization, transition_state | Drives any gradient program (`qccodec[geometric]`) |
| [`orca`](https://qccodec.docs.atomsforhumanity.org/programs/orca/) | energy, gradient, hessian, optimization, transition_state | |
| [`psi4`](https://qccodec.docs.atomsforhumanity.org/programs/psi4/) | energy, gradient, hessian, optimization, transition_state | Any Psi4 method; point charges for QM/MM |
| [`terachem`](https://qccodec.docs.atomsforhumanity.org/programs/terachem/) | energy, gradient, hessian, optimization | GPU quantum chemistry |
| [`terachem-fe`, `terachem-pbs`](https://qccodec.docs.atomsforhumanity.org/programs/terachem-servers/) | energy, gradient | TeraChem servers through tcpb (`qccodec[tcpb]`) |
| [`xtb`](https://qccodec.docs.atomsforhumanity.org/programs/xtb/) | energy, gradient, hessian, optimization | GFN0/1/2-xTB, GFN-FF, g-xTB |

To support a new program, see [Writing a codec](https://qccodec.docs.atomsforhumanity.org/guides/writing-a-codec/) and the step-by-step walkthrough in [CONTRIBUTING.md](./CONTRIBUTING.md).

## Contributing

See [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup, the pre-commit workflow, running tests, and the release process.

If there's data you'd like parsed from output files or a program you'd like supported, open an issue describing the data and include an example output file, like [this](https://github.com/atomsforhumanity/qccodec/issues/2).

## Optional dependencies

Optional integrations install with `qccodec[geometric]` or `qccodec[tcpb]`; their libraries are imported only when a calculation is invoked.
