Skip to content

Commit

Permalink
Created intial working SinglePoint and FileInput calculations. Create…
Browse files Browse the repository at this point in the history
…d FileAdapter and TeraChemAdapter. Created packaged setup, CI/CD, etc. Verified working with TeraChem and using Psi4 via the QCEngine compatibility layer.
  • Loading branch information
coltonbh committed Jun 30, 2023
1 parent 750bfa9 commit fbb1cac
Show file tree
Hide file tree
Showing 39 changed files with 2,695 additions and 253 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/basic-code-quality.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Basic Code Quality

on: [push]

env:
POETRY_VIRTUALENVS_CREATE: false

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install ruff
run: pip install ruff
- name: ruff
run: ruff check .

mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install poetry
run: pip install poetry
- name: Install repo
run: poetry install --no-interaction --no-ansi
- name: mypy
run: mypy .

black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install black
run: pip install black
- name: Check code formatting with black
run: black --check .

isort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install poetry
run: pip install poetry
- name: Install repo
run: poetry install --no-interaction --no-ansi
- name: Check import formatting with isort
run: isort --check-only --diff .

detect-secrets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install detect secrets
run: pip install detect-secrets
- name: Look for secrets
run: git ls-files -z | xargs -0 detect-secrets-hook -v

typos:
name: "spell check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: crate-ci/typos@master
with:
files: .
40 changes: 40 additions & 0 deletions .github/workflows/publish-to-pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# https://github.com/marketplace/actions/pypi-publish

name: Publish to PyPI

on:
push:
tags: # Only publish on tagged commits
- "*"

jobs:
build-and-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/qcop/
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- name: Check out source repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Install dependencies
run: poetry install --no-interaction --no-ansi

- name: Build distribution 📦
run: poetry build

- name: Publish package 📤 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
24 changes: 24 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Tests

on: [push]

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
name: Set up Python
with:
python-version: "3.8"
- name: Install poetry
run: pip install poetry
- name: Install repo
run: poetry install --no-interaction --no-ansi
- name: Run tests
run: bash scripts/tests.sh
- name: Upload coverage HTML
uses: actions/upload-artifact@v3
with:
name: htmlcov
path: htmlcov
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,11 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# qcop specific ignores
# TeraChem scratch files
scr.*
tc.in
*.xyz
# Psi4 scratch files
*.dat
45 changes: 45 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: check-added-large-files
args: ["--maxkb=250"]
exclude: caffeine.frequencies.out
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
stages: [commit]
exclude: poetry.lock
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: "v0.0.272"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
hooks:
- id: mypy
additional_dependencies:
[tokenize-rt==3.2.0, pydantic>=1.0.0, types-paramiko]
- repo: local
hooks:
- id: tests
name: tests
stages: [push]
language: system
entry: poetry run pytest
types: [python]
pass_filenames: false
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"cSpell.words": [
"allclose",
"dockerized",
"hostcpus",
"htmlcov",
"qcio",
"qcop",
"qcparse",
"spinmult",
"terachem",
"terachemd"
]
}
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [unreleased]

### Added

- Core compute capabilities exposed in top-level `compute()` function, including `QCEngine` fallback for programs without a `qcop` adapter.
- Created adapter for TeraChem.
- Exposed general purpose computing for any subprocess with `FileAdaptor`

[unreleased]: https://github.com/coltonbh/qcop/compare/0.1.0...HEAD
[0.1.0]: https://github.com/coltonbh/qcop/releases/tag/0.1.0
21 changes: 21 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Contributing

## Running Test

- Run all tests (except integration test). See coverage report afterwards by opening `htmlcov/index.html`

```sh
bash scripts/tests.sh
```

- To run integration test:

```sh
pytest -m integration
```

- To run all tests + integration tests (skipping those where `program` is not installed)

```sh
pytest -m 'not not_integration'
```
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2021 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.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Quantum Chemistry Operate

A package for operating Quantum Chemistry programs using [qcio](https://github.com/coltonbh/qcio) standardized data structures.

[![image](https://img.shields.io/pypi/v/qcop.svg)](https://pypi.python.org/pypi/qcop)
[![image](https://img.shields.io/pypi/l/qcop.svg)](https://pypi.python.org/pypi/qcop)
[![image](https://img.shields.io/pypi/pyversions/qcop.svg)](https://pypi.python.org/pypi/qcop)
[![Actions status](https://github.com/coltonbh/qcop/workflows/Tests/badge.svg)](https://github.com/coltonbh/qcop/actions)
[![Actions status](https://github.com/coltonbh/qcop/workflows/Basic%20Code%20Quality/badge.svg)](https://github.com/coltonbh/qcop/actions)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)
22 changes: 22 additions & 0 deletions docs/dev-decisions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Dev Decisions and Research

## Switching to pydantic v2

- geomeTRIC does not rely up on any QCElemental objects--only a dictionary with the corresponding structure. So I don't loose `geometric_run_json` support if I drop `qcel`.
- `psi4` does use `pydantic` and specifically the `qcel` `ProtoObject` and `pydantic` `validator` in its `driver` code `psi4/driver/task_base.py` and other `psi4/driver/*` files. It's not clear if this code gets executed if you run `psi4` in executable mode rather than python API mode.

## Parsing Output files

- `QChem` requires text parsing, no structured output according to Dip. This leads me to think `tcparse` needs to become `qcparse` and work for more packages.

## Open Questions

- Consider changing signature of `BaseAdaptor.compute` to `def compute(inp_obj: InputBase, **kwargs)` to make things less redundant across adaptors. Loose some clarity, save a bunch of redundancy in specifying a signature over and over again. This caused issues

## Publishing Checklist

- Update `CHANGELOG.md`
- Bump version in `pyproject.toml`
- Tag commit with a version and GitHub Actions will publish it to pypi if tag is on `master` branch.
- `git push`
- `git push --tags`
Loading

0 comments on commit fbb1cac

Please sign in to comment.