Skip to content

Commit

Permalink
Psi4 minimum version check (#300)
Browse files Browse the repository at this point in the history
* change the default pre-opt method to xtb. Add a minimum version check to the mbis stage.

* update channels

* roll back pis4 version

* update minimum version

* remove mbis test
  • Loading branch information
jthorton authored Feb 23, 2022
1 parent 80df16d commit 0f88747
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions devtools/conda-envs/basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dependencies:
- tqdm

# Optional
- xtb-python
- torchani
- ambertools
- optking
19 changes: 16 additions & 3 deletions qubekit/charges/mbis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
from typing import Any, Dict, Optional

from pydantic import Field
from qcelemental.util import which_import
from qcelemental.util import parse_version, safe_version, which, which_import
from qcengine.util import popen
from typing_extensions import Literal

from qubekit.charges.base import ChargeBase
from qubekit.charges.solvent_settings import SolventPsi4
from qubekit.engines import call_qcengine
from qubekit.molecules import Dipole, Ligand, Quadrupole
from qubekit.utils.datastructures import LocalResource, QCOptions
from qubekit.utils.exceptions import SpecificationError


class MBISCharges(ChargeBase):
Expand All @@ -32,12 +34,23 @@ def is_available(cls) -> bool:
"""
The MBIS option is only available via new psi4 so make sure it is installed.
"""
return which_import(
# check installed
psi4 = which_import(
"psi4",
return_bool=True,
raise_error=True,
raise_msg="Please install via `conda install psi4 -c psi4/label/dev`.",
raise_msg="Please install via `conda install psi4 -c psi4`.",
)
# now check the version meets the minimum requirement
which_psi4 = which("psi4")
with popen([which_psi4, "--version"]) as exc:
exc["proc"].wait(timeout=30)
version = parse_version(safe_version(exc["stdout"].split()[-1]))
if version <= parse_version("1.4a1"):
raise SpecificationError(
f"The version of psi4 installed is {version} and needs to be 1.4 or newer please update it to continue."
)
return psi4

def _gas_calculation_settings(self) -> Dict[str, Any]:
return {"scf_properties": ["MBIS_CHARGES"]}
Expand Down
2 changes: 1 addition & 1 deletion qubekit/workflow/helper_stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class Optimiser(StageBase):

type: Literal["Optimiser"] = "Optimiser"
pre_optimisation_method: Optional[PreOptMethods] = Field(
"uff",
"gfn2xtb",
description="The pre-optimisation method that should be used before full QM.",
)
seed_conformers: int = Field(
Expand Down

0 comments on commit 0f88747

Please sign in to comment.