Skip to content

Commit

Permalink
Merge pull request #94 from ChayaSt/off-fix
Browse files Browse the repository at this point in the history
OpenFF: workaraound to get optimized molecules
  • Loading branch information
dgasmith authored Nov 3, 2018
2 parents e0a9be5 + b77650b commit 5788004
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion qcfractal/interface/collections/openffworkflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,13 @@ def list_final_molecules(self, fragments=None, refresh_cache=False):
tmp = {}
for k, v in self.data.fragments[frag].items():
if v["hash_index"] in self._torsiondrive_cache:
tmp[k] = self._torsiondrive_cache[v["hash_index"]].final_molecules()
obj = self._torsiondrive_cache[v["hash_index"]]
if isinstance(obj, orm.TorsionDriveORM):
tmp[k] = obj.final_molecules()
elif isinstance(obj, orm.OptimizationORM):
tmp[k] = obj.final_molecule()
else:
raise TypeError("Internal type error encoured, buy a dev a coffee.")
else:
tmp[k] = None

Expand Down
4 changes: 4 additions & 0 deletions qcfractal/tests/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ def test_compute_openffworkflow(fractal_compute_server):
assert final_energies["HOOH"].keys() == {"label1", "label2"}
assert pytest.approx(0.00259754, 1.e-4) == final_energies["HOOH"]["label2"]

final_molecules = wf.list_final_molecules()
assert final_molecules.keys() == {"HOOH"}
assert final_molecules["HOOH"].keys() == {"label1", "label2"}

# Add a second fragment
butane = portal.data.get_molecule("butane.json")
butane_id = butane.identifiers["canonical_isomeric_explicit_hydrogen_mapped_smiles"]
Expand Down

0 comments on commit 5788004

Please sign in to comment.