Name | tcparse JSON |
Version |
0.2.1
JSON |
| download |
home_page | |
Summary | A package for parsing TeraChem file outputs into structured MolSSI data objects. |
upload_time | 2023-03-25 22:42:55 |
maintainer | |
docs_url | None |
author | Colton Hicks |
requires_python | >=3.8.1,<4.0.0 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# tcparse
A library for parsing TeraChem output files into structured MolSSI data objects.
## ✨ Basic Usage
- Installation:
```sh
python -m pip install tcparse
```
- Parse files into `AtomicResult` or `FailedOperation` objects with a single line of code.
```python
from tcparse import parse
result = parse("/path/to/tc.out")
```
- If your `xyz` file no longer exists where `tc.out` specifies (the `XYZ coordinates` line), `parse` will raise a `FileNotFoundError`. You can pass `ignore_xyz=True` and `parse` will use a dummy hydrogen molecule instead. The correct values from `tc.out` will be parsed; however, `result.molecule` will be the dummy hydrogen.
```python
from tcparse import parse
result = parse("/path/to/tc.out", ignore_xyz=True)
print(result) # Real results from tc.out
print(result.molecule) # Dummy hydrogen molecule
```
- The `result` object will be either an `AtomicResult` or `FailedOperation`. Run `dir(result)` inside a Python interpreter to see the various values you can access. A few prominent values are shown here as an example:
```python
from tcparse import parse
result = parse("/path/to/tc.out")
if result.success:
# result is AtomicResult
result.driver # "energy", "gradient", or "hessian"
result.model # Method and basis
result.return_result # Core value from the computation. Will be either energy or grad/Hess matrix
result.properties # Collection of computed properties. Two shown below.
result.properties.return_energy # Available for all calcs
result.properties.return_gradient # Available for grad/Hess calcs
result.molecule # The molecule used for the computation
result.stdout # The full TeraChem stdout
result.provenance # Provenance data for the computation (TeraChem version)
else:
# result is FailedOperation
result.error # ComputeError object describing error
result.input_data # Basic data about the inputs supplied, does NOT include keywords
result.error.error_message # Parsed error message from TeraChem stdout
result.error.extras['stdout'] # Full TeraChem stdout
```
- Parsed results can be written to disk like this:
```py
with open("myresult.json", "w") as f:
f.write(result.json())
```
- And read from disk like this:
```py
from qcelemental.models import AtomicResult, FailedOperation
successful_result = AtomicResult.parse_file("myresult.json")
failed_result = FailedOperation.parse_file("myfailure.json")
```
- You can also run `tcparse` from the command line like this:
```sh
tcparse -h # Get help message for cli
tcparse ./path/to/tc.out > myoutput.json # Parse TeraChem stdout to json
tcparse --ignore_xyz ./path/to/tc.out > myoutput.json # Ignore the XYZ file in the TeraChem stdout. Helpful in case the XYZ file is not longer available in the location specified in the file.
```
## 🤩 Next Steps
This package will be integrated into [QCEngine](https://github.com/MolSSI/QCEngine) soon. So if you like getting your TeraChem data in this format, you'll be able to drive TeraChem from pure python like this:
```python
from qcelemental.models import Molecule, AtomicInput
from qcengine import compute
molecule = Molecule.from_file("mymolecule.xyz")
atomic_input = AtomicInput(
molecule=molecule,
driver="gradient", # "energy" | "gradient" | "hessian"
model={"method": "b3lyp", "basis": "6-31gs"},
keywords={"restricted": True, "purify": "no"} # Keywords are optional
)
# result will be AtomicResult or FailedOperation
result = compute(atomic_input, "terachem")
```
## 💻 Contributing
If there's data you'd like parsed from TeraChem output files, please open an issue in this repo explaining the data items you'd like parsed and include an example output file containing the data, like [this](https://github.com/mtzgroup/tcparse/issues/2).
If you'd like to add a parser yourself see the docstring in `tcparse.parsers` for a primer and see the examples written in the module. Adding a parser for new data is quick and easy :)
Raw data
{
"_id": null,
"home_page": "",
"name": "tcparse",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8.1,<4.0.0",
"maintainer_email": "",
"keywords": "",
"author": "Colton Hicks",
"author_email": "github@coltonhicks.com",
"download_url": "https://files.pythonhosted.org/packages/b1/4d/dd26c9e9cf5f39a4f84dfa46edde932eef78de6e329bc25d42164f438f59/tcparse-0.2.1.tar.gz",
"platform": null,
"description": "# tcparse\n\nA library for parsing TeraChem output files into structured MolSSI data objects.\n\n## \u2728 Basic Usage\n\n- Installation:\n\n ```sh\n python -m pip install tcparse\n ```\n\n- Parse files into `AtomicResult` or `FailedOperation` objects with a single line of code.\n\n ```python\n from tcparse import parse\n\n result = parse(\"/path/to/tc.out\")\n ```\n\n- If your `xyz` file no longer exists where `tc.out` specifies (the `XYZ coordinates` line), `parse` will raise a `FileNotFoundError`. You can pass `ignore_xyz=True` and `parse` will use a dummy hydrogen molecule instead. The correct values from `tc.out` will be parsed; however, `result.molecule` will be the dummy hydrogen.\n\n ```python\n from tcparse import parse\n\n result = parse(\"/path/to/tc.out\", ignore_xyz=True)\n print(result) # Real results from tc.out\n print(result.molecule) # Dummy hydrogen molecule\n ```\n\n- The `result` object will be either an `AtomicResult` or `FailedOperation`. Run `dir(result)` inside a Python interpreter to see the various values you can access. A few prominent values are shown here as an example:\n\n ```python\n from tcparse import parse\n\n result = parse(\"/path/to/tc.out\")\n\n if result.success:\n # result is AtomicResult\n result.driver # \"energy\", \"gradient\", or \"hessian\"\n result.model # Method and basis\n result.return_result # Core value from the computation. Will be either energy or grad/Hess matrix\n result.properties # Collection of computed properties. Two shown below.\n result.properties.return_energy # Available for all calcs\n result.properties.return_gradient # Available for grad/Hess calcs\n result.molecule # The molecule used for the computation\n result.stdout # The full TeraChem stdout\n result.provenance # Provenance data for the computation (TeraChem version)\n else:\n # result is FailedOperation\n result.error # ComputeError object describing error\n result.input_data # Basic data about the inputs supplied, does NOT include keywords\n result.error.error_message # Parsed error message from TeraChem stdout\n result.error.extras['stdout'] # Full TeraChem stdout\n ```\n\n- Parsed results can be written to disk like this:\n\n ```py\n with open(\"myresult.json\", \"w\") as f:\n f.write(result.json())\n ```\n\n- And read from disk like this:\n\n ```py\n from qcelemental.models import AtomicResult, FailedOperation\n\n successful_result = AtomicResult.parse_file(\"myresult.json\")\n failed_result = FailedOperation.parse_file(\"myfailure.json\")\n ```\n\n- You can also run `tcparse` from the command line like this:\n\n ```sh\n tcparse -h # Get help message for cli\n\n tcparse ./path/to/tc.out > myoutput.json # Parse TeraChem stdout to json\n\n tcparse --ignore_xyz ./path/to/tc.out > myoutput.json # Ignore the XYZ file in the TeraChem stdout. Helpful in case the XYZ file is not longer available in the location specified in the file.\n ```\n\n## \ud83e\udd29 Next Steps\n\nThis package will be integrated into [QCEngine](https://github.com/MolSSI/QCEngine) soon. So if you like getting your TeraChem data in this format, you'll be able to drive TeraChem from pure python like this:\n\n```python\nfrom qcelemental.models import Molecule, AtomicInput\nfrom qcengine import compute\n\nmolecule = Molecule.from_file(\"mymolecule.xyz\")\natomic_input = AtomicInput(\n molecule=molecule,\n driver=\"gradient\", # \"energy\" | \"gradient\" | \"hessian\"\n model={\"method\": \"b3lyp\", \"basis\": \"6-31gs\"},\n keywords={\"restricted\": True, \"purify\": \"no\"} # Keywords are optional\n )\n\n# result will be AtomicResult or FailedOperation\nresult = compute(atomic_input, \"terachem\")\n```\n\n## \ud83d\udcbb Contributing\n\nIf there's data you'd like parsed from TeraChem output files, please open an issue in this repo explaining the data items you'd like parsed and include an example output file containing the data, like [this](https://github.com/mtzgroup/tcparse/issues/2).\n\nIf you'd like to add a parser yourself see the docstring in `tcparse.parsers` for a primer and see the examples written in the module. Adding a parser for new data is quick and easy :)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A package for parsing TeraChem file outputs into structured MolSSI data objects.",
"version": "0.2.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "25585c273eb9da5d007bfcbffa8992632592247e055f4bb14776d952d8fb37ae",
"md5": "565f565d77fd52a1e25e1ac0434ec0b3",
"sha256": "da654be0f433e4cac08f7151e9b5c39f96e780b807f51d04967c2fa07e9cca59"
},
"downloads": -1,
"filename": "tcparse-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "565f565d77fd52a1e25e1ac0434ec0b3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.1,<4.0.0",
"size": 8109,
"upload_time": "2023-03-25T22:42:53",
"upload_time_iso_8601": "2023-03-25T22:42:53.405866Z",
"url": "https://files.pythonhosted.org/packages/25/58/5c273eb9da5d007bfcbffa8992632592247e055f4bb14776d952d8fb37ae/tcparse-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b14ddd26c9e9cf5f39a4f84dfa46edde932eef78de6e329bc25d42164f438f59",
"md5": "fcee6c6f182e3f3b4bf8e3c9594b2264",
"sha256": "10ed85478b39ec97fa413694f78fcc64f9dc73a5268871e7ecf9f7ddf60d5245"
},
"downloads": -1,
"filename": "tcparse-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "fcee6c6f182e3f3b4bf8e3c9594b2264",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.1,<4.0.0",
"size": 7518,
"upload_time": "2023-03-25T22:42:55",
"upload_time_iso_8601": "2023-03-25T22:42:55.633887Z",
"url": "https://files.pythonhosted.org/packages/b1/4d/dd26c9e9cf5f39a4f84dfa46edde932eef78de6e329bc25d42164f438f59/tcparse-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-25 22:42:55",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "tcparse"
}