Skip to main content

A package for operating Quantum Chemistry programs using qcio standardized data structures. Compatible with TeraChem, psi4, QChem, NWChem, ORCA, Molpro, geomeTRIC and many more.

Project description

Quantum Chemistry Operate

A package for operating Quantum Chemistry programs using qcio standardized data structures. Compatible with TeraChem, psi4, QChem, NWChem, ORCA, Molpro, geomeTRIC and many more.

image image image Actions status Actions status Ruff

qcop works in harmony with a suite of other quantum chemistry tools for fast, structured, and interoperable quantum chemistry.

The QC Suite of Programs

  • qcio - Elegant and intuitive data structures for quantum chemistry, featuring seamless Jupyter Notebook visualizations.
  • qcparse - A library for efficient parsing of quantum chemistry data into structured qcio objects.
  • qcop - A package for operating quantum chemistry programs using qcio standardized data structures. Compatible with TeraChem, psi4, QChem, NWChem, ORCA, Molpro, geomeTRIC, and many more, featuring seamless Jupyter Notebook visualizations.
  • BigChem - A distributed application for running quantum chemistry calculations at scale across clusters of computers or the cloud. Bring multi-node scaling to your favorite quantum chemistry program, featuring seamless Jupyter Notebook visualizations.
  • ChemCloud - A web application and associated Python client for exposing a BigChem cluster securely over the internet, featuring seamless Jupyter Notebook visualizations.

Installation

pip install qcop

Quickstart

qcop uses the qcio data structures to drive quantum chemistry programs in a standardized way. This allows for a simple and consistent interface to a wide variety of quantum chemistry programs. See the qcio library for documentation on the input and output data structures.

The compute function is the main entry point for the library and is used to run a calculation.

from qcio import Structure, ProgramInput
from qcop import compute
from qcop.exceptions import ExternalProgramError
# Create the Structure
h2o = Structure.open("h2o.xyz")

# Define the program input
prog_input = ProgramInput(
    structure=h2o,
    calctype="energy",
    model={"method": "hf", "basis": "sto-3g"},
    keywords={"purify": "no", "restricted": False},
)

# Run the calculation; will return ProgramOutput or raise an exception
try:
    po = compute("terachem", prog_input, collect_files=True)
except ExternalProgramError as e:
    # External QQ program failed in some way
    po = e.program_output
    po.input_data # Input data used by the QC program
    po.success # Will be False
    po.results # Any half-computed results before the failure
    po.traceback # Stack trace from the calculation
    po.ptraceback # Shortcut to print out the traceback in human readable format
    po.stdout # Stdout log from the calculation
    raise e
else:
    # Calculation succeeded
    po.input_data # Input data used by the QC program
    po.success # Will be True
    po.results # All structured results from the calculation
    po.stdout # Stdout log from the calculation
    po.pstdout # Shortcut to print out the stdout in human readable format
    po.files # Any files returned by the calculation
    po.provenance # Provenance information about the calculation
    po.extras # Any extra information not in the schema

One may also call compute(..., raise_exc=False) to return a ProgramOutput object rather than raising an exception when a calculation fails. This may allow easier handling of failures in some cases.

from qcio import Structure, ProgramInput
from qcop import compute
from qcop.exceptions import ExternalProgramError
# Create the Structure
h2o = Structure.open("h2o.xyz")

# Define the program input
prog_input = ProgramInput(
    structure=h2o,
    calctype="energy",
    model={"method": "hf", "basis": "sto-3g"},
    keywords={"purify": "no", "restricted": False},
)

# Run the calculation; will return a ProgramOutput objects
po = compute("terachem", prog_input, collect_files=True, raise_exc=False)
if not po.success:
    # External QQ program failed in some way
    po.input_data # Input data used by the QC program
    po.success # Will be False
    po.results # Any half-computed results before the failure
    po.traceback # Stack trace from the calculation
    po.ptraceback # Shortcut to print out the traceback in human readable format
    po.stdout # Stdout log from the calculation

else:
    # Calculation succeeded
    po.input_data # Input data used by the QC program
    po.success # Will be True
    po.results # All structured results from the calculation
    po.stdout # Stdout log from the calculation
    po.pstdout # Shortcut to print out the stdout in human readable format
    po.files # Any files returned by the calculation
    po.provenance # Provenance information about the calculation
    po.extras # Any extra information not in the schema

Alternatively, the compute_args function can be used to run a calculation with the input data structures passed in as arguments rather than as a single ProgramInput object.

from qcio import Structure
from qcop import compute_args
# Create the Structure
h2o = Structure.open("h2o.xyz")

# Run the calculation
output = compute_args(
    "terachem",
    h2o,
    calctype="energy",
    model={"method": "hf", "basis": "sto-3g"},
    keywords={"purify": "no", "restricted": False},
    files={...},
    collect_files=True
)

The behavior of compute() and compute_args() can be tuned by passing in keyword arguments like collect_files shown above. Keywords can modify which scratch directory location to use, whether to delete or keep the scratch files after a calculation completes, what files to collect from a calculation, whether to print the program stdout in real time as the program executes, and whether to propagate a wavefunction through a series of calculations. Keywords also include hooks for passing in update functions that can be called as a program executes in real time. See the compute method docstring for more details.

See the /examples directory for more examples.

✨ Visualization ✨

Visualize all your results with a single line of code!

First install the visualization module:

pip install qcio[view]

or if your shell requires '' around arguments with brackets:

pip install 'qcio[view]'

Then in a Jupyter notebook import the qcio view module and call view.view(...) passing it one or any number of qcio objects you want to visualizing including Structure objects or any ProgramOutput object. You may also pass an array of titles and/or subtitles to add additional information to the molecular structure display. If no titles are passed qcio with look for Structure identifiers such as a name or SMILES to label the Structure.

Structure Viewer

Seamless visualizations for ProgramOutput objects make results analysis easy!

Optimization Viewer

Single point calculations display their results in a table.

Single Point Viewer

If you want to use the HTML generated by the viewer to build your own dashboards use the functions inside of qcio.view.py that begin with the word generate_ to create HTML you can insert into any dashboard.

Support

If you have any issues with qcop or would like to request a feature, please open an issue.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qcop-0.9.2.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

qcop-0.9.2-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

Details for the file qcop-0.9.2.tar.gz.

File metadata

  • Download URL: qcop-0.9.2.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for qcop-0.9.2.tar.gz
Algorithm Hash digest
SHA256 3bfcf4ba5ee7c7cc4e982abdcac4154a183394d151086a7366c97f8e924b1a74
MD5 5d61ad2d693aca5f088bfe6f89729cff
BLAKE2b-256 5fa5c27ac5723934ab67bfe49c691f0ece2354d43c2a088b1f73a941b4bc4276

See more details on using hashes here.

File details

Details for the file qcop-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: qcop-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 29.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for qcop-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 24551683478e48a5d0d262fdc0131e480a1fb4317374bf8c35b8a3cf6dd3f3d6
MD5 d06de6fb68e5ee14936a8776aa885c65
BLAKE2b-256 c95547a25c42510e97da342bf94ad774dafeba58df7ffe0c386ad412b0815586

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page