Skip to content

Commit 4b18220

Browse files
committed
better "extras" passing in Molecule for EFP
1 parent 7cb0fc8 commit 4b18220

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

qcelemental/models/molecule.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,9 +724,9 @@ def from_data(cls,
724724
raise TypeError("Input type not understood, please supply the 'dtype' kwarg.")
725725

726726
if dtype in ["string", "psi4", "psi4+", "xyz", "xyz+"]:
727-
mol_dict = from_string(data)
728-
assert isinstance(mol_dict, dict)
729-
input_dict = to_schema(mol_dict["qm"], dtype=2)
727+
molrec = from_string(data, enable_qm=True, missing_enabled_return_qm='minimal')
728+
assert isinstance(molrec, dict)
729+
input_dict = to_schema(molrec["qm"], dtype=2)
730730
validate = True
731731
elif dtype == "numpy":
732732
data = np.asarray(data)

qcelemental/molparse/to_schema.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ def to_schema(molrec: Dict[str, Any],
9494
if 'connectivity' in molrec:
9595
molecule['connectivity'] = deepcopy(molrec['connectivity'])
9696

97+
# EFP extras
98+
if 'fragment_files' in molrec:
99+
molecule['extras'] = {
100+
'fragment_files': molrec['fragment_files'],
101+
'hint_types': molrec['hint_types'],
102+
'geom_hints': molrec['geom_hints'],
103+
}
104+
97105
if dtype == 1:
98106
qcschema = {'schema_name': 'qcschema_input', 'schema_version': 1, 'molecule': molecule}
99107
elif dtype == 2:

qcelemental/tests/test_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def test_unique_everseen(inp, expected):
5555
@pytest.mark.parametrize("inp,expected", [
5656
(({1:{"a":"A"},2:{"b":"B"}}, {2:{"c":"C"},3:{"d":"D"}}), {1:{"a":"A"},2:{"b":"B","c":"C"},3:{"d":"D"}}),
5757
(({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"}}),
58-
(({1: [None, 1]}, {1: [2, 1],3:{"d":"D"}}), {1:[2, 1], 3:{"d":"D"}})
58+
(({1: [None, 1]}, {1: [2, 1],3:{"d":"D"}}), {1:[2, 1], 3:{"d":"D"}}),
59+
(({1: True, 'extras':{'aa': [True]}}, {2: None, 'extras':{'bb': 5}}), {1: True, 2: None, 'extras':{'aa': [True], 'bb':5}}),
5960
]) # yapf: disable
6061
def test_updatewitherror(inp, expected):
6162
assert compare_recursive(expected, qcel.util.update_with_error(inp[0], inp[1]))

0 commit comments

Comments
 (0)