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

better "extras" passing in Molecule for EFP #124

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
better "extras" passing in Molecule for EFP
  • Loading branch information
loriab committed Sep 3, 2019
commit 4b1822091447cbeaccb46cdd09b45249b3686c75
6 changes: 3 additions & 3 deletions qcelemental/models/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,9 @@ def from_data(cls,
raise TypeError("Input type not understood, please supply the 'dtype' kwarg.")

if dtype in ["string", "psi4", "psi4+", "xyz", "xyz+"]:
mol_dict = from_string(data)
assert isinstance(mol_dict, dict)
input_dict = to_schema(mol_dict["qm"], dtype=2)
molrec = from_string(data, enable_qm=True, missing_enabled_return_qm='minimal')
assert isinstance(molrec, dict)
input_dict = to_schema(molrec["qm"], dtype=2)
validate = True
elif dtype == "numpy":
data = np.asarray(data)
Expand Down
8 changes: 8 additions & 0 deletions qcelemental/molparse/to_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ def to_schema(molrec: Dict[str, Any],
if 'connectivity' in molrec:
molecule['connectivity'] = deepcopy(molrec['connectivity'])

# EFP extras
if 'fragment_files' in molrec:
molecule['extras'] = {
'fragment_files': molrec['fragment_files'],
'hint_types': molrec['hint_types'],
'geom_hints': molrec['geom_hints'],
}

if dtype == 1:
qcschema = {'schema_name': 'qcschema_input', 'schema_version': 1, 'molecule': molecule}
elif dtype == 2:
Expand Down
3 changes: 2 additions & 1 deletion qcelemental/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def test_unique_everseen(inp, expected):
@pytest.mark.parametrize("inp,expected", [
(({1:{"a":"A"},2:{"b":"B"}}, {2:{"c":"C"},3:{"d":"D"}}), {1:{"a":"A"},2:{"b":"B","c":"C"},3:{"d":"D"}}),
(({1:{"a":"A"},2:{"b":"B","c":None}}, {2:{"c":"C"},3:{"d":"D"}}), {1:{"a":"A"},2:{"b":"B","c":"C"},3:{"d":"D"}}),
(({1: [None, 1]}, {1: [2, 1],3:{"d":"D"}}), {1:[2, 1], 3:{"d":"D"}})
(({1: [None, 1]}, {1: [2, 1],3:{"d":"D"}}), {1:[2, 1], 3:{"d":"D"}}),
(({1: True, 'extras':{'aa': [True]}}, {2: None, 'extras':{'bb': 5}}), {1: True, 2: None, 'extras':{'aa': [True], 'bb':5}}),
]) # yapf: disable
def test_updatewitherror(inp, expected):
assert compare_recursive(expected, qcel.util.update_with_error(inp[0], inp[1]))
Expand Down