How to use the qcengine.programs.empirical_dispersion_resources function in qcengine

To help you get started, we’ve selected a few qcengine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github psi4 / psi4 / tests / pytests / test_qcng_dftd3_mp2d.py View on Github external
def test_dftd3__from_arrays(inp, expected):
    res = empirical_dispersion_resources.from_arrays(**inp[0])
    assert compare_recursive(expected, res, atol=1.e-4)
    assert compare(inp[1], _compute_key(res), 'key')
    res = empirical_dispersion_resources.from_arrays(name_hint=res['fctldash'], level_hint=res['dashlevel'], param_tweaks=res['dashparams'])
    assert compare_recursive(expected, res, tnm() + ' idempotent', atol=1.e-4)
github psi4 / psi4 / tests / pytests / test_qcng_dftd3_mp2d.py View on Github external
ans = {
        'dashlevel': 'chg',
        'dashparams': {
            's6': 4.05
        },
        'fctldash': 'asdf-d4',
        'dashparams_citation': '    mypaper\n'
    }
    supp = {'chg': {'definitions': {'asdf-d4': {'params': {'s6': 4.05}, 'citation': '    mypaper\n'}}}}

    res = empirical_dispersion_resources.from_arrays(name_hint='asdf-d4', level_hint='chg', dashcoeff_supplement=supp)
    assert compare_recursive(ans, res, atol=1.e-4)
    with pytest.raises(qcng.exceptions.InputError) as e:
        empirical_dispersion_resources.from_arrays(name_hint=res['fctldash'], level_hint=res['dashlevel'], param_tweaks=res['dashparams'])
    assert "Can't guess -D correction level" in str(e.value)
    res = empirical_dispersion_resources.from_arrays(
        name_hint=res['fctldash'],
        level_hint=res['dashlevel'],
        param_tweaks=res['dashparams'],
        dashcoeff_supplement=supp)
    assert compare_recursive(ans, res, tnm() + ' idempotent', atol=1.e-4)
github MolSSI / QCEngine / qcengine / programs / mp2d.py View on Github external
def build_input(
        self, input_model: "AtomicInput", config: "TaskConfig", template: Optional[str] = None
    ) -> Dict[str, Any]:

        # strip engine hint
        mtd = input_model.model.method
        if mtd.startswith("mp2d-"):
            mtd = mtd[5:]

        if input_model.driver.derivative_int() > 1:
            raise InputError(f"""MP2D valid driver options are 'energy' and 'gradient', not {input_model.driver}""")

        # temp until actual options object
        input_model.extras["info"] = empirical_dispersion_resources.from_arrays(
            name_hint=mtd,
            level_hint=input_model.keywords.get("level_hint", None),
            param_tweaks=input_model.keywords.get("params_tweaks", None),
            dashcoeff_supplement=input_model.keywords.get("dashcoeff_supplement", None),
        )

        # Need 'real' field later and that's only guaranteed for molrec
        molrec = qcel.molparse.from_schema(input_model.molecule.dict())
        xyz = qcel.molparse.to_string(molrec, dtype="xyz", units="Angstrom", ghost_format="")
        infiles = {"mp2d_geometry": xyz}
        # jobrec['molecule']['real'] = molrec['real']

        # env = {
        #    'HOME': os.environ.get('HOME'),
        #    'PATH': os.environ.get('PATH'),
        #    #'PATH': os.pathsep.join([os.path.abspath(x) for x in os.environ.get('PSIPATH', '').split(os.pathsep) if x != '']) + \
github MolSSI / QCEngine / qcengine / programs / dftd3.py View on Github external
def build_input(
        self, input_model: "AtomicInput", config: "TaskConfig", template: Optional[str] = None
    ) -> Dict[str, Any]:

        # strip engine hint
        mtd = input_model.model.method
        if mtd.startswith("d3-"):
            mtd = mtd[3:]

        if (input_model.driver.derivative_int() > 1) or (input_model.driver == "properties"):
            raise InputError(f"""DFTD3 valid driver options are 'energy' and 'gradient', not {input_model.driver}""")

        # temp until actual options object
        input_model.extras["info"] = empirical_dispersion_resources.from_arrays(
            name_hint=mtd,
            level_hint=input_model.keywords.get("level_hint", None),
            param_tweaks=input_model.keywords.get("params_tweaks", None),
            dashcoeff_supplement=input_model.keywords.get("dashcoeff_supplement", None),
        )

        # this is what the dftd3 program needs, not what the job needs
        # * form dftd3_parameters string that governs dispersion calc
        # * form dftd3_geometry string that supplies geometry to dispersion calc
        # * form command and arguments

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

        # env = {
github psi4 / psi4 / psi4 / driver / procrouting / empirical_dispersion.py View on Github external
def __init__(self, name_hint=None, level_hint=None, param_tweaks=None, **kwargs):
        from .dft import dashcoeff_supplement
        self.dashcoeff_supplement = dashcoeff_supplement

        resolved = qcng.programs.empirical_dispersion_resources.from_arrays(
            name_hint=name_hint,
            level_hint=level_hint,
            param_tweaks=param_tweaks,
            dashcoeff_supplement=self.dashcoeff_supplement)
        self.fctldash = resolved['fctldash']
        self.dashlevel = resolved['dashlevel']
        self.dashparams = resolved['dashparams']
        self.description = qcng.programs.empirical_dispersion_resources.dashcoeff[self.dashlevel]['description']
        self.ordered_params = qcng.programs.empirical_dispersion_resources.dashcoeff[self.dashlevel]['default'].keys()
        self.dashlevel_citation = qcng.programs.empirical_dispersion_resources.dashcoeff[self.dashlevel]['citation']
        self.dashparams_citation = resolved['dashparams_citation']

        engine = kwargs.pop('engine', None)
        if engine is None:
            self.engine = _capable_engines_for_disp[self.dashlevel][0]
        else:
github psi4 / psi4 / psi4 / driver / procrouting / empirical_dispersion.py View on Github external
def __init__(self, name_hint=None, level_hint=None, param_tweaks=None, **kwargs):
        from .dft import dashcoeff_supplement
        self.dashcoeff_supplement = dashcoeff_supplement

        resolved = qcng.programs.empirical_dispersion_resources.from_arrays(
            name_hint=name_hint,
            level_hint=level_hint,
            param_tweaks=param_tweaks,
            dashcoeff_supplement=self.dashcoeff_supplement)
        self.fctldash = resolved['fctldash']
        self.dashlevel = resolved['dashlevel']
        self.dashparams = resolved['dashparams']
        self.description = qcng.programs.empirical_dispersion_resources.dashcoeff[self.dashlevel]['description']
        self.ordered_params = qcng.programs.empirical_dispersion_resources.dashcoeff[self.dashlevel]['default'].keys()
        self.dashlevel_citation = qcng.programs.empirical_dispersion_resources.dashcoeff[self.dashlevel]['citation']
        self.dashparams_citation = resolved['dashparams_citation']

        engine = kwargs.pop('engine', None)
        if engine is None:
            self.engine = _capable_engines_for_disp[self.dashlevel][0]
        else:
            if self.dashlevel in _engine_can_do[engine]:
                self.engine = engine
            else:
                raise ValidationError("""This little engine ({}) can't ({})""".format(engine, self.dashlevel))

        if self.engine == 'libdisp':
            self.disp = core.Dispersion.build(self.dashlevel, **resolved['dashparams'])
github psi4 / psi4 / psi4 / driver / procrouting / dft / dft_builder.py View on Github external
dict_functionals.update(gga_functionals.functional_list)
dict_functionals.update(mgga_functionals.functional_list)
dict_functionals.update(hyb_functionals.functional_list)
dict_functionals.update(dh_functionals.functional_list)


def get_functional_aliases(functional_dict):
    if "alias" in functional_dict:
        aliases = [each.lower() for each in functional_dict["alias"]]
        aliases.append(functional_dict["name"].lower())
    else:
        aliases = [functional_dict["name"].lower()]
    return aliases


_dispersion_aliases = qcng.programs.empirical_dispersion_resources.get_dispersion_aliases()

functionals = {}
dashcoeff_supplement = collections.defaultdict(lambda: collections.defaultdict(dict))

for functional_name in dict_functionals:
    functional_aliases = get_functional_aliases(dict_functionals[functional_name])

    # first create copies for aliases of parent functional
    for alias in functional_aliases:
        functionals[alias] = dict_functionals[functional_name]

    # if the parent functional is already dispersion corrected:
    if "dispersion" in dict_functionals[functional_name]:
        disp = dict_functionals[functional_name]['dispersion']
        for formal in functional_aliases:
            # "bless" the original functional dft/*_functionals dispersion definition including aliases