Skip to content

Commit

Permalink
Csse pyd2 pull altered qcel and run pre-commit (#452)
Browse files Browse the repository at this point in the history
* pull altered qcel

* check nwchem

* revise nwchem version for version processing change in qcel

* set up pre-commit, run on project

* Update runner.py
  • Loading branch information
loriab authored Oct 3, 2024
1 parent 3732c38 commit 6ceb824
Show file tree
Hide file tree
Showing 18 changed files with 72 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ jobs:
qcore --accept-license
- name: Special Config - QCElemental Dep
if: false
#if: false
run: |
conda remove qcelemental --force
python -m pip install 'git+https://github.com/MolSSI/QCElemental.git@loriab-patch-2' --no-deps
python -m pip install 'git+https://github.com/loriab/QCElemental.git@csse_pyd2_shimclasses' --no-deps
# note: conda remove --force, not mamba remove --force b/c https://github.com/mamba-org/mamba/issues/412
# alt. is micromamba but not yet ready for setup-miniconda https://github.com/conda-incubator/setup-miniconda/issues/75
Expand Down
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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: v3.2.0
hooks:
- id: check-yaml
- id: check-added-large-files
args: ["--maxkb=250"]
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
stages: [commit]
exclude: "versioneer.py"
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
language_version: python3.12
args: [--line-length=120]
exclude: 'test_|versioneer.py|examples/.*|docs/.*|devtools/.*'
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
files: \.py$
args: ["--profile", "black", --line-length=120]
4 changes: 3 additions & 1 deletion examples/terachem_pbs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os
import qcengine as qcng

import qcelemental as qcel

import qcengine as qcng

os.environ["TERACHEM_PBS_HOST"] = "127.0.0.1"
os.environ["TERACHEM_PBS_PORT"] = "11111"

Expand Down
2 changes: 1 addition & 1 deletion qcengine/procedures/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from ..exceptions import InputError, ResourceError
from .berny import BernyProcedure
from .geometric import GeometricProcedure
from .model import ProcedureHarness
from .nwchem_opt import NWChemDriverProcedure
from .optking import OptKingProcedure
from .torsiondrive import TorsionDriveProcedure
from .model import ProcedureHarness

__all__ = ["register_procedure", "get_procedure", "list_all_procedures", "list_available_procedures"]

Expand Down
4 changes: 2 additions & 2 deletions qcengine/procedures/berny.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import logging
from qcengine.exceptions import UnknownError
import sys
import traceback
from io import StringIO
from typing import Any, Dict, Union

import numpy as np
from qcelemental.models import OptimizationInput, OptimizationResult, FailedOperation
from qcelemental.models import FailedOperation, OptimizationInput, OptimizationResult
from qcelemental.util import which_import

import qcengine
from qcengine.exceptions import UnknownError

from ..config import TaskConfig
from .model import ProcedureHarness
Expand Down
8 changes: 4 additions & 4 deletions qcengine/procedures/nwchem_opt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import Union, Dict, Any
from typing import Any, Dict, Union

from qcelemental.models import OptimizationInput, AtomicInput, OptimizationResult, Provenance
from qcelemental.models import AtomicInput, OptimizationInput, OptimizationResult, Provenance

from qcengine.config import TaskConfig
from qcengine.exceptions import UnknownError, InputError
from qcengine.exceptions import InputError, UnknownError
from qcengine.procedures.model import ProcedureHarness
from qcengine.procedures.nwchem_opt.harvester import harvest_as_atomic_result
from qcengine.programs.nwchem.runner import NWChemHarness
from qcengine.procedures.model import ProcedureHarness


class NWChemDriverProcedure(ProcedureHarness):
Expand Down
8 changes: 6 additions & 2 deletions qcengine/programs/aimnet2.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
from typing import TYPE_CHECKING, Dict
from qcengine.programs.model import ProgramHarness
from qcelemental.util import safe_version, which_import

from qcelemental.models import AtomicResult, Provenance
from qcelemental.util import safe_version, which_import

from qcengine.exceptions import InputError
from qcengine.programs.model import ProgramHarness

if TYPE_CHECKING:
from qcelemental.models import AtomicInput

from qcengine.config import TaskConfig


Expand Down Expand Up @@ -59,6 +62,7 @@ def load_model(self, name: str):
def compute(self, input_data: "AtomicInput", config: "TaskConfig"):
self.found(raise_error=True)
import torch

from qcengine.units import ureg

# check we can run on the set of elements
Expand Down
6 changes: 3 additions & 3 deletions qcengine/programs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
from typing import Set

from ..exceptions import InputError, ResourceError
from .model import ProgramHarness
from .adcc import AdccHarness
from .aimnet2 import AIMNET2Harness
from .cfour import CFOURHarness
from .dftd3 import DFTD3Harness
from .dftd_ng import DFTD4Harness, SDFTD3Harness
from .gamess import GAMESSHarness
from .gcp import GCPHarness, MCTCGCPHarness
from .mace import MACEHarness
from .model import ProgramHarness
from .molpro import MolproHarness
from .mopac import MopacHarness
from .mp2d import MP2DHarness
Expand All @@ -28,8 +30,6 @@
from .torchani import TorchANIHarness
from .turbomole import TurbomoleHarness
from .xtb import XTBHarness
from .mace import MACEHarness
from .aimnet2 import AIMNET2Harness

__all__ = ["register_program", "get_program", "list_all_programs", "list_available_programs"]

Expand Down
3 changes: 2 additions & 1 deletion qcengine/programs/empirical_dispersion_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import copy
from typing import Dict, List, Optional, Union

from ..exceptions import InputError
from qcelemental.util import parse_version

from ..exceptions import InputError

## ==> Dispersion Aliases and Parameters <== ##

# The dashcoeff dict below defines the -D parameters for most of the DFT methods. Some 'd2' are
Expand Down
5 changes: 4 additions & 1 deletion qcengine/programs/mace.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
from typing import TYPE_CHECKING, Dict, Union
from qcelemental.models import AtomicResult, Provenance, FailedOperation

from qcelemental.models import AtomicResult, FailedOperation, Provenance
from qcelemental.util import safe_version, which_import

from qcengine.exceptions import InputError
from qcengine.programs.model import ProgramHarness
from qcengine.units import ureg

if TYPE_CHECKING:
from qcelemental.models import AtomicInput, FailedOperation

from qcengine.config import TaskConfig


Expand Down
3 changes: 2 additions & 1 deletion qcengine/programs/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
from pydantic.v1 import BaseModel
except ImportError:
from pydantic import BaseModel

from qcelemental.models import AtomicInput, AtomicResult, FailedOperation

from qcengine.exceptions import KnownErrorException
from qcengine.config import TaskConfig
from qcengine.exceptions import KnownErrorException

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion qcengine/programs/tests/standard_suite_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import qcengine as qcng
from qcengine.programs.util import mill_qcvars

from .standard_suite_ref import answer_hash, std_suite
from .standard_suite_contracts import *
from .standard_suite_ref import answer_hash, std_suite

pp = pprint.PrettyPrinter(width=120)

Expand Down
2 changes: 1 addition & 1 deletion qcengine/programs/tests/test_ghost.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pprint
import re

import pytest
import numpy as np
import pytest
import qcelemental as qcel
from qcelemental.testing import compare, compare_values

Expand Down
2 changes: 1 addition & 1 deletion qcengine/programs/turbomole/harvester.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from math import sqrt
import re
from decimal import Decimal
from math import sqrt

import numpy as np

Expand Down
8 changes: 4 additions & 4 deletions qcengine/programs/util/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from .hessparse import load_hessian
from .pdict import PreservingDict
from .ao_reordering import (
reorder_column_ao_indices,
reorder_row_and_column_ao_indices,
cca_ao_order_spherical,
error_stamp,
get_ao_conversion,
mill_qcvars,
reorder_column_ao_indices,
reorder_row_and_column_ao_indices,
)
from .hessparse import load_hessian
from .pdict import PreservingDict
4 changes: 2 additions & 2 deletions qcengine/tests/test_procedures.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

import pytest
from qcelemental.models import DriverEnum, OptimizationInput, FailedOperation
from qcelemental.models import DriverEnum, FailedOperation, OptimizationInput
from qcelemental.models.common_models import Model
from qcelemental.models.procedures import OptimizationSpecification, QCInputSpecification, TDKeywords, TorsionDriveInput

Expand Down Expand Up @@ -256,7 +256,7 @@ def test_geometric_generic(input_data, program, model, bench):
input_data["initial_molecule"] = qcng.get_molecule("water")
input_data["input_specification"]["model"] = model
input_data["keywords"]["program"] = program
input_data["input_specification"]["extras"] = {"_secret_tags": {"mysecret_tag": "data1"}}
input_data["input_specification"]["extras"] = {"_secret_tags": {"mysecret_tag": "data1"}} # pragma: allowlist secret

ret = qcng.compute_procedure(input_data, "geometric", raise_error=True)
assert ret.success is True
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import sys

import setuptools

import versioneer

short_description = (
Expand Down
3 changes: 3 additions & 0 deletions versioneer.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,12 @@
"""

from __future__ import print_function

try:
import configparser
except ImportError:
import ConfigParser as configparser

import errno
import json
import os
Expand Down Expand Up @@ -1561,6 +1563,7 @@ def run(self):

if "cx_Freeze" in sys.modules: # cx_freeze enabled?
from cx_Freeze.dist import build_exe as _build_exe

# nczeczulin reports that py2exe won't like the pep440-style string
# as FILEVERSION, but it can be used for PRODUCTVERSION, e.g.
# setup(console=[{
Expand Down

0 comments on commit 6ceb824

Please sign in to comment.