Skip to content

Commit

Permalink
Merge branch 'master' into orca
Browse files Browse the repository at this point in the history
* master: (61 commits)
  Config: Changes new programs from job to task config
  Config: JobConfig -> TaskConfig
  Config: Adds nodes to config
  entos: Black reformat of entos.py and added @using_entos mark
  PR comments
  PR comments: TYPE_CHECKING, formatting, reduce redundant code
  entos: Added entos_policy to the input file
  entos: Updated commit for qcengine_records_commit
  hessparse and compute: Forgotten imports
  entos: Begun adding support for xtb in the entos Harness
  entos: Removed soon to be deprecated option
  entos: Added entos to the test_standard_suite_hf and did some minor cleanup in the entos Harness
  entos: Starting to add HF command to entos
  Fixed typo in error name
  Multiple changes based on review
  Gamess: replace print statements with logging
  Entos: add hessian and xtb support
  Parse named properties out of NWChem output
  Get more of the relevant fields from output
  Removed unncessary "pass" statement
  ...
  • Loading branch information
muammar committed Dec 3, 2019
2 parents 6b26a41 + f9fea80 commit 2657c79
Show file tree
Hide file tree
Showing 36 changed files with 936 additions and 234 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ matrix:
# env:
# - PYTHON_VER=3.6
# - PROG=ANI
- os: linux
env:
- PYTHON_VER=3.6
- PROG=OPENMM

before_install:
# Additional info about the build
Expand All @@ -45,6 +49,8 @@ install:
python devtools/scripts/conda_env.py -n=test -p=$PYTHON_VER devtools/conda-envs/psi-nightly.yaml
elif [ $PROG == "ANI" ]; then
python devtools/scripts/conda_env.py -n=test -p=$PYTHON_VER devtools/conda-envs/torchani.yaml
elif [ $PROG == "OPENMM" ]; then
python devtools/scripts/conda_env.py -n=test -p=$PYTHON_VER devtools/conda-envs/openmm.yaml
else
echo "ERROR: No match for PROG ($PROG)."
exit 1
Expand Down
23 changes: 23 additions & 0 deletions devtools/conda-envs/openmm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: test
channels:
- conda-forge
- omnia-dev
- omnia
dependencies:
- conda-forge::rdkit
- omnia-dev::openmm
- omnia::openforcefield
- omnia::openforcefields

# Core
- python
- pyyaml
- py-cpuinfo
- psutil
- qcelemental >=0.11.1
- pydantic >=0.30.1

# Testing
- pytest
- pytest-cov
- codecov
29 changes: 29 additions & 0 deletions docs/source/environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,32 @@ The global environment can also be inspected directly.
},
'cpu_brand': 'Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz'
}
Configuration Files
-------------------

The computational environment defaults can be overridden by configuration files.

Configuration files must be named ``qcengine.yaml`` and stored either in the directory
from which you run QCEngine, a folder named ``.qcarchive`` in your home directory,
or in a folder specified by the ``DQM_CONFIG_PATH`` environmental variable.
Only one configuration file will be used if multiple are available.
The ``DQM_CONFIG_PATH`` configuration file takes precedence over the current directory,
which takes precedence over the ``.qcarchive`` folder.

The configuration file is a YAML file that contains a dictionary of different node configurations.
The keys in the YAML file are human-friendly names for the configurations.
The values are dictionaries that define configurations for different nodes,
following the ``NodeDescription`` schema:

.. autoclass:: qcengine.config.NodeDescriptor

When running QCEngine, the proper configuration for a node is determined based on the hostname of the node
and matching the ``hostname_pattern`` to each of the configurations defined in ``qcengine.yaml``.

An example ``qcengine.yaml`` file that sets the scratch directory for all nodes is as follows:

.. code:: yaml
all:
hostname_pattern: "*"
scratch_directory: ./scratch
6 changes: 3 additions & 3 deletions docs/source/program_overview.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Program Overview
================

The general capabalities available through QCEngine for each program can be
The general capabilities available through QCEngine for each program can be
found below:

Quantum Chemistry
Expand All @@ -12,7 +12,7 @@ Quantum Chemistry
+============+============+===+===+===+============+==============+
| CFOUR |||||||
+------------+------------+---+---+---+------------+--------------+
| Entos |||| |||
| Entos |||| |||
+------------+------------+---+---+---+------------+--------------+
| GAMESS |||||||
+------------+------------+---+---+---+------------+--------------+
Expand All @@ -29,7 +29,7 @@ Quantum Chemistry
| Turbomole |||||||
+------------+------------+---+---+---+------------+--------------+

Semi-Emperical
Semi-Empirical
--------------

+------------+------------+---+---+---+------------+--------------+
Expand Down
8 changes: 6 additions & 2 deletions qcengine/compute.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
"""
Integrates the computes together
"""
from typing import Any, Dict, Optional, Union
from typing import Any, Dict, Optional, Union, TYPE_CHECKING

from qcelemental.models import AtomicInput, FailedOperation
if TYPE_CHECKING:
from pydantic.main import BaseModel
from qcelemental.models import AtomicResult

from qcelemental.models import AtomicInput, FailedOperation, AtomicResult

from .config import get_config
from .exceptions import InputError, RandomError
Expand Down
19 changes: 11 additions & 8 deletions qcengine/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def get_global(key: Optional[str] = None) -> Union[str, Dict[str, Any]]:
cpu_cnt = psutil.cpu_count(logical=True)

_global_values["ncores"] = cpu_cnt
_global_values["nnodes"] = 1

_global_values["cpuinfo"] = cpuinfo.get_cpu_info()
_global_values["cpu_brand"] = _global_values["cpuinfo"]["brand"]
Expand Down Expand Up @@ -80,10 +81,11 @@ class Config:
extra = "forbid"


class JobConfig(pydantic.BaseModel):
class TaskConfig(pydantic.BaseModel):

# Specifications
ncores: int # Number of ncores per job
ncores: int # Number of ncores per task
nnodes: int # Number of nodes per task
memory: float # Amount of memory in GiB per node
scratch_directory: Optional[str] # What location to use as scratch
retries: int # Number of retries on random failures
Expand Down Expand Up @@ -125,10 +127,6 @@ def _load_defaults() -> None:
NODE_DESCRIPTORS[k] = NodeDescriptor(name=k, **v)


# Pull in the local variables
_load_defaults()


def global_repr() -> str:
"""
A representation of the current global configuration.
Expand Down Expand Up @@ -202,7 +200,7 @@ def parse_environment(data: Dict[str, Any]) -> Dict[str, Any]:
return ret


def get_config(*, hostname: Optional[str] = None, local_options: Dict[str, Any] = None) -> JobConfig:
def get_config(*, hostname: Optional[str] = None, local_options: Dict[str, Any] = None) -> TaskConfig:
"""
Returns the configuration key for qcengine.
"""
Expand Down Expand Up @@ -237,11 +235,12 @@ def get_config(*, hostname: Optional[str] = None, local_options: Dict[str, Any]
raise KeyError("Number of jobs per node exceeds the number of available cores.")

config["ncores"] = ncores
config["nnodes"] = local_options.pop("nnodes", 1)

if local_options is not None:
config.update(local_options)

return JobConfig(**config)
return TaskConfig(**config)


def get_provenance_augments() -> Dict[str, str]:
Expand All @@ -255,3 +254,7 @@ def get_provenance_augments() -> Dict[str, str]:

def get_logger() -> "Logger":
return LOGGER


# Pull in the local variables
_load_defaults()
2 changes: 1 addition & 1 deletion qcengine/procedures/geometric.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def found(self, raise_error: bool = False) -> bool:
def build_input_model(self, data: Union[Dict[str, Any], "OptimizationInput"]) -> "OptimizationInput":
return self._build_model(data, OptimizationInput)

def compute(self, input_data: "OptimizationInput", config: "JobConfig") -> "OptimizationResult":
def compute(self, input_data: "OptimizationInput", config: "TaskConfig") -> "OptimizationResult":
try:
import geometric
except ModuleNotFoundError:
Expand Down
2 changes: 1 addition & 1 deletion qcengine/procedures/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def build_input_model(self, data: Union[Dict[str, Any], "BaseModel"], raise_erro
"""

@abc.abstractmethod
def compute(self, input_data: "BaseModel", config: "JobConfig") -> "BaseModel":
def compute(self, input_data: "BaseModel", config: "TaskConfig") -> "BaseModel":
pass

@abc.abstractmethod
Expand Down
2 changes: 2 additions & 0 deletions qcengine/programs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .mp2d import MP2DHarness
from .nwchem import NWChemHarness
from .orca import OrcaHarness
from .openmm import OpenMMHarness
from .psi4 import Psi4Harness
from .qchem import QChemHarness
from .rdkit import RDKitHarness
Expand Down Expand Up @@ -112,6 +113,7 @@ def list_available_programs() -> Set[str]:

# Molecular Mechanics
register_program(RDKitHarness())
register_program(OpenMMHarness())

# Analytical Corrections
register_program(DFTD3Harness())
Expand Down
4 changes: 2 additions & 2 deletions qcengine/programs/cfour/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_version(self) -> str:

return self.version_cache[which_prog]

def compute(self, input_model: "AtomicInput", config: "JobConfig") -> "AtomicResult":
def compute(self, input_model: "AtomicInput", config: "TaskConfig") -> "AtomicResult":
self.found(raise_error=True)

job_inputs = self.build_input(input_model, config)
Expand All @@ -76,7 +76,7 @@ def compute(self, input_model: "AtomicInput", config: "JobConfig") -> "AtomicRes
return self.parse_output(dexe["outfiles"], input_model)

def build_input(
self, input_model: "AtomicInput", config: "JobConfig", template: Optional[str] = None
self, input_model: "AtomicInput", config: "TaskConfig", template: Optional[str] = None
) -> Dict[str, Any]:
cfourrec = {"infiles": {}, "scratch_directory": config.scratch_directory}

Expand Down
4 changes: 2 additions & 2 deletions qcengine/programs/dftd3.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_version(self) -> str:

return self.version_cache[which_prog]

def compute(self, input_model: "AtomicInput", config: "JobConfig") -> "AtomicResult":
def compute(self, input_model: "AtomicInput", config: "TaskConfig") -> "AtomicResult":
self.found(raise_error=True)

job_inputs = self.build_input(input_model, config)
Expand Down Expand Up @@ -98,7 +98,7 @@ def execute(
return success, dexe

def build_input(
self, input_model: "AtomicInput", config: "JobConfig", template: Optional[str] = None
self, input_model: "AtomicInput", config: "TaskConfig", template: Optional[str] = None
) -> Dict[str, Any]:

# strip engine hint
Expand Down
Loading

0 comments on commit 2657c79

Please sign in to comment.