Skip to content

Commit

Permalink
efp: opts case insensitivity
Browse files Browse the repository at this point in the history
  • Loading branch information
loriab committed Sep 3, 2019
1 parent 6325fd4 commit 8e29b40
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
22 changes: 9 additions & 13 deletions qcengine/programs/pylibefp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 1 addition & 2 deletions qcengine/programs/tests/test_dftd3_mp2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion qcengine/programs/tests/test_pylibefp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8e29b40

Please sign in to comment.