From 8e29b40e5d4b5bc06b7a4c819fe5fa7287af3889 Mon Sep 17 00:00:00 2001 From: Lori Burns Date: Tue, 3 Sep 2019 02:26:22 -0400 Subject: [PATCH] efp: opts case insensitivity --- qcengine/programs/pylibefp.py | 22 +++++++++------------- qcengine/programs/tests/test_dftd3_mp2d.py | 3 +-- qcengine/programs/tests/test_pylibefp.py | 3 ++- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/qcengine/programs/pylibefp.py b/qcengine/programs/pylibefp.py index 7e3063c87..b81e21a5e 100644 --- a/qcengine/programs/pylibefp.py +++ b/qcengine/programs/pylibefp.py @@ -68,31 +68,27 @@ def compute(self, input_model: 'ResultInput', config: 'JobConfig') -> 'Result': input_data["success"] = False input_data["return_output"] = True - import pylibefp - efpobj = pylibefp.core.efp() - # initialize EFP fragments - efp_extras = input_model.molecule.extras['efp_molecule']['extras'] - efpobj.add_potential(efp_extras['fragment_files']) - efpobj.add_fragment(efp_extras['fragment_files']) - for ifr, (hint_type, geom_hint) in enumerate(zip(efp_extras['hint_types'], efp_extras['geom_hints'])): - efpobj.set_frag_coordinates(ifr, hint_type, geom_hint) - efpobj.prepare() + import pylibefp + # fix units when parsing efp string + efpobj = pylibefp.from_dict({**input_model.molecule.extras['efp_molecule']['extras'], 'units':'Bohr'}) # print efp geom in [A] print(efpobj.banner()) print(efpobj.geometry_summary(units_to_bohr=qcel.constants.bohr2angstroms)) if input_model.model.method != 'efpefp': - raise InputError + raise InputError(f"Method not efpefp: {input_model.model.method}") # set keywords + # * make keywords keys case insensitive # * label changes the accepted names of the keywords (xr vs. exch) # * append changes the defaults upon which they act (off for libefp vs. on for psi) - keywords_label = input_model.keywords.pop('keywords_label', 'libefp') - results_label = input_model.keywords.pop('results_label', 'libefp') + opts = {k.lower(): v for k, v in input_model.keywords.items()} + keywords_label = opts.pop('keywords_label', 'libefp').lower() + results_label = opts.pop('results_label', 'libefp').lower() try: - efpobj.set_opts(input_model.keywords, label=keywords_label, append=keywords_label) + efpobj.set_opts(opts, label=keywords_label, append=keywords_label) except pylibefp.EFPSyntaxError as e: raise InputError(e.message) diff --git a/qcengine/programs/tests/test_dftd3_mp2d.py b/qcengine/programs/tests/test_dftd3_mp2d.py index f4689bbde..4581822a3 100644 --- a/qcengine/programs/tests/test_dftd3_mp2d.py +++ b/qcengine/programs/tests/test_dftd3_mp2d.py @@ -889,8 +889,7 @@ def test_dftd3__run_dftd3__3body(inp, subjects, request): }, 'keywords': {}, } - jrec = qcng.compute(resinp, 'dftd3', raise_error=True) - jrec = jrec.dict() + jrec = qcng.compute(resinp, 'dftd3', raise_error=True, return_dict=True) assert len(jrec['extras']['qcvars']) == 8 diff --git a/qcengine/programs/tests/test_pylibefp.py b/qcengine/programs/tests/test_pylibefp.py index cf9682731..61a1122cc 100644 --- a/qcengine/programs/tests/test_pylibefp.py +++ b/qcengine/programs/tests/test_pylibefp.py @@ -218,7 +218,8 @@ def test_total_1a(system_1, keywords_label, results_label): }) elif keywords_label == 'psi': resi['keywords'].update({ - 'disp_damping': 'tt', + 'DISP_DAMPING': 'TT', + 'DISP': True, }) res = qcng.compute(resi, 'pylibefp', raise_error=True, return_dict=False)