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 - Beautiful and user friendly data structures for quantum chemistry.
  • 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.
  • 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.
  • ChemCloud - A web application and associated Python client for exposing a BigChem cluster securely over the internet.

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 Molecule, ProgramInput
from qcop import compute
from qcop.exceptions import ExternalProgramError
# Create the molecule
h2o = Molecule.open("h2o.xyz")

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

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

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

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

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

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

else:
    # Calculation succeeded
    output.input_data # Input data used by the QC program
    output.success # Will be True
    output.results # All structured results from the calculation
    output.stdout # Stdout log from the calculation
    output.pstdout # Shortcut to print out the stdout in human readable format
    output.files # Any files returned by the calculation
    output.provenance # Provenance information about the calculation
    output.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 Molecule
from qcop import compute_args
# Create the molecule
h2o = Molecule.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.

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.5.3.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qcop-0.5.3-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qcop-0.5.3.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for qcop-0.5.3.tar.gz
Algorithm Hash digest
SHA256 136ccef086c3a813983348af7c7267e1ade7a28b37d1bb01b4b4b242df337175
MD5 7c490559a6646c7d32a30d0f403db5e8
BLAKE2b-256 3763cd015a2d928d0d13adafdbf595d4839e43c6c0ac3300467812781d29ed2d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qcop-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for qcop-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 61ae0438f732eee0af73704e067bf47d5798a7d521434c298e4192a45261aade
MD5 c3f1194321fd9a84cd7c0a857b777ce1
BLAKE2b-256 23f872c40b7c444452464e7773bec81bbdfe80ccb07d362451be03bf9270e99a

See more details on using hashes here.

Supported by

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