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 f36fbef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 26 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
13 changes: 2 additions & 11 deletions 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 Expand Up @@ -270,13 +271,3 @@ def test_opts_fail_1(keywords, errmsg, system_1):
qcng.compute(resi, 'pylibefp', raise_error=True, return_dict=False)

assert errmsg in str(e.value)


"""
start by generating various halogenated benzenes
opt by b3lyp
run makefp to generate those files
run them in dimers in libefp
run them in dimers in sapt for reference
upload to qca
"""

0 comments on commit f36fbef

Please sign in to comment.