Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update gCP levels and extend D4 defaults #393

Merged
merged 8 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion qcengine/programs/empirical_dispersion_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Dict, List, Optional, Union

from ..exceptions import InputError
from pkg_resources import parse_version
loriab marked this conversation as resolved.
Show resolved Hide resolved

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

Expand Down Expand Up @@ -881,7 +882,17 @@
"bibtex": "Caldeweyher:2019:154122",
"doi": "10.1063/1.5090222150",
"default": collections.OrderedDict(
[("a1", 1.0), ("a2", 1.0), ("alp", 16.0), ("s6", 1.0), ("s8", 1.0), ("s9", 1.0)]
[
("a1", 1.0),
("a2", 1.0),
("alp", 16.0),
("s6", 1.0),
("s8", 1.0),
("s9", 1.0),
("ga", 3.0),
("gc", 2.0),
("wf", 6.0),
]
),
"definitions": {
# D4 parameters loaded below from authoritative source below. Keep a couple for reference
Expand All @@ -891,6 +902,21 @@
},
}

try:
from dftd4 import __version__ as d4_version

new_d4_api = parse_version(d4_version) >= parse_version("3.5.0")
except ModuleNotFoundError:
new_d4_api = False
except ImportError:
# handles when no dftd4 present
new_d4_api = False
loriab marked this conversation as resolved.
Show resolved Hide resolved

# different defaults for dftd4 versions < 3.5.0
if new_d4_api is False:
loriab marked this conversation as resolved.
Show resolved Hide resolved
dashcoeff["d4bjeeqatm"]["default"] = collections.OrderedDict(
[("a1", 1.0), ("a2", 1.0), ("alp", 16.0), ("s6", 1.0), ("s8", 1.0), ("s9", 1.0)]
)

# for d3*atm, only skeleton entries with metadata defined above. below copies in parameters from d3*2b
for d in ["d3zero", "d3bj", "d3mzero", "d3mbj", "d3op"]:
Expand Down Expand Up @@ -964,6 +990,13 @@ def get_params(entry: dict, base: dict, defaults: list) -> dict:
except KeyError:
continue

# defaults ga, gc, wf are not in the toml parameter file and need to be provided by qcengine
if new_d4_api:
for entry in definitions.keys():
definitions[entry]["params"]["ga"] = 3.0
definitions[entry]["params"]["gc"] = 2.0
definitions[entry]["params"]["wf"] = 6.0

return definitions


Expand Down
13 changes: 11 additions & 2 deletions qcengine/programs/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,25 @@ def build_input(
# thus code blocks with FILE below are not used yet.
# 'file',
]
# some methods not available in legacy version
mctc_gcp_levels = ["B973C", "R2SCAN3C"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

B97-3c should be supported with the original version of gcp already.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Holger was pretty sure otherwise. See "Dev notes" at psi4/psi4#2842 (comment) . v2.0.2 at https://anaconda.org/psi4/gcp/files is the relevant "classic" one that I'm trying to wean psi4 folks off of. mctc-gcp is preferred as of psi4 v1.8.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, inclusion of the b97-3c explained at more psi4/psi4#1898 (comment) . I'm going to leave the code here as-is/exclusionary since "classic" is usually the tarball-from-Grimme-website build variously labeled 2.2 or 2.0.2.


executable = self._defaults["name"].lower()
if executable == "mctc-gcp":
available_levels.extend(mctc_gcp_levels)

available_levels = [f.upper() for f in available_levels]
# temp until actual options object
method = input_model.model.method.upper()
if method not in available_levels:
raise InputError(f"GCP does not have method: {method}")
if method in mctc_gcp_levels and executable == "gcp":
raise InputError(f"GCP does not have method {method} but MCTC-GCP does.")
else:
raise InputError(f"GCP does not have method: {method}")

# Need 'real' field later and that's only guaranteed for molrec
molrec = qcel.molparse.from_schema(input_model.molecule.dict())

executable = self._defaults["name"].lower()
calldash = {"gcp": "-", "mctc-gcp": "--"}[executable]

command = [executable, "gcp_geometry.xyz", calldash + "level", method]
Expand Down
1 change: 1 addition & 0 deletions qcengine/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def get_job(self):
"dftd3": which("dftd3", return_bool=True),
"dftd3_321": is_program_new_enough("dftd3", "3.2.1"),
"dftd4": which_import("dftd4", return_bool=True),
"dftd4_350": is_program_new_enough("dftd4", "3.5.0"),
"s-dftd3": which_import("dftd3", return_bool=True),
"qcore": is_program_new_enough("qcore", "0.8.9"),
"gamess": which("rungms", return_bool=True),
Expand Down
Loading