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
Catch/raise descriptive error on conformer generation failure #1050
Conversation
This pull request introduces 1 alert when merging 1c79ec1 into f41e671 - view on LGTM.com new alerts:
|
if rdmol.GetNumConformers() == 0: | ||
raise ConformerGenerationError("RDKit conformer generation failed.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does RDKit output any of its own error messages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not as far as I'm aware, but I don't use RDKit directly too often so I could be missing something.
>>> from rdkit import Chem
>>> from rdkit.Chem import AllChem
>>> rdmol = Chem.MolFromSmiles(100 * "CC")
>>> rdmol = Chem.AddHs(rdmol)
>>> AllChem.EmbedMultipleConfs(rdmol, numConfs=1, pruneRmsThresh=1)
<rdkit.rdBase._vecti object at 0x13763e200>
>>> rdmol.GetNumConformers()
0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's disappointing :(.
Maybe you could query the output directly? It's supposed to contain the conformer IDs of the conformers generated, so if there aren't any, that should correspond to conformer generation failing. Conformers are already cleared by default (clearConfs=True
) so this should lead to the same behaviour.
status = AllChem.EmbedMultipleConfs(
rdmol,
numConfs=n_conformers,
pruneRmsThresh=rms_cutoff / unit.angstrom,
randomSeed=1,
# params=AllChem.ETKDG()
)
if not status:
raise ConformerGenerationError("RDKit conformer generation failed.")
Incidentally, I do get a conformer if I start off with random coordinates. I wonder if the distance matrix is having difficulty with the number of atoms.
From the docs:
useRandomCoords: Start the embedding from random coordinates instead of using eigenvalues of the distance matrix.
>>> status = AllChem.EmbedMultipleConfs(rdmol, numConfs=1, useRandomCoords=True)
>>> list(status)
[0]
Looks alright I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a reasonable C200 to me.
I don't think this is a good way of testing for this failures, since other settings or future RDKit updates could make generating stupidly large molecules safer/faster, and I'd like to avoid asking it to do an even larger molecule like a million-carbon alkane just to catch a failure. I figure there's got to be a small molecule out there that will reliably fail to be turned into 3D, but not for other reasons (i.e. RDKit wouldn't throw an error for other reasons). But that's as far as I got with that line of thinking. Any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One option would be to blindly grab something from their issue tracker, but that's more or less the opposite of maintainable code. The C200 I have right now fails in about 50 seconds on my machine, but two of the smaller molecules from rdkit/rdkit#1433 fail in about 15 seconds each.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea, sorry 😬 from that issue I'd guess it's flexible or large molecules that give it trouble, although I can't work out what's especially hard about "C1CC1c2[nH]nc3C4CCC4c23"
. I did make a variation on a theme ("C12C3C(C1C2)C4=N[N](C(=C34)C5C6C5CC6)C7CC7"
) for something that might not get directly addressed in the future.
>>> rdmol = Chem.MolFromSmiles("C12C3C(C1C2)C4=N[N](C(=C34)C5C6C5CC6)C7CC7")
>>> rdmol = Chem.AddHs(rdmol)
>>> status = AllChem.EmbedMultipleConfs(rdmol, numConfs=1, useRandomCoords=True)
>>> len(status)
0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked in Slack and the PIs chimed in with a list of suggestions, the smallest of which was uranium hexafluoride, which I'm rolling with. Coincidentally it has the funniest SMILIES string I've seen to date ...
Co-authored-by: Lily Wang <31115101+lilyminium@users.noreply.github.com>
…' into conformer-generation-exception
While working on the unit tests, I came across some molecules that OEChem doesn't like but RDKit likes (enough to generate something): >>> from openff.toolkit.topology import Molecule
>>> smi = "B1(OB(OB(O1)OC)OC)OC"
>>> molecule = Molecule.from_smiles(smi)
>>> from openff.toolkit.utils.toolkits import OpenEyeToolkitWrapper, RDKitToolkitWrapper, AmberToolsToolkitWrapper, GLOBAL_TOOLKIT_REGISTRY, ToolkitRegistry
>>> molecule.generate_conformers(n_conformers=1, toolkit_registry=RDKitToolkitWrapper())
>>> molecule.generate_conformers(n_conformers=1, toolkit_registry=OpenEyeToolkitWrapper())
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: Unable to find bend parameters for
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: : Force field setup failed due to missing parameters
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: Unable to find bend parameters for
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: : Force field setup failed due to missing parameters
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/mwt/software/openforcefield/openff/toolkit/topology/molecule.py", line 3230, in generate_conformers
return toolkit.generate_conformers(
File "/Users/mwt/software/openforcefield/openff/toolkit/utils/openeye_wrapper.py", line 1693, in generate_conformers
raise ConformerGenerationError(
openff.toolkit.utils.exceptions.ConformerGenerationError: OpenEye Omega conformer generation failed
>>> molecule.generate_conformers(n_conformers=1)
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: Unable to find bend parameters for
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: : Force field setup failed due to missing parameters
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: Unable to find bend parameters for
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: : Force field setup failed due to missing parameters
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/mwt/software/openforcefield/openff/toolkit/topology/molecule.py", line 3221, in generate_conformers
return toolkit_registry.call(
File "/Users/mwt/software/openforcefield/openff/toolkit/utils/toolkit_registry.py", line 366, in call
raise e
File "/Users/mwt/software/openforcefield/openff/toolkit/utils/toolkit_registry.py", line 362, in call
return method(*args, **kwargs)
File "/Users/mwt/software/openforcefield/openff/toolkit/utils/openeye_wrapper.py", line 1693, in generate_conformers
raise ConformerGenerationError(
openff.toolkit.utils.exceptions.ConformerGenerationError: OpenEye Omega conformer generation failed
GLOBAL_TOOLKIT_REGISTRY
ToolkitRegistry containing OpenEye Toolkit, The RDKit, AmberTools, Built-in Toolkit
>>> molecule.generate_conformers(n_conformers=1, toolkit_registry=GLOBAL_TOOLKIT_REGISTRY)
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: Unable to find bend parameters for
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: : Force field setup failed due to missing parameters
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: Unable to find bend parameters for
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: : Force field setup failed due to missing parameters
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/mwt/software/openforcefield/openff/toolkit/topology/molecule.py", line 3221, in generate_conformers
return toolkit_registry.call(
File "/Users/mwt/software/openforcefield/openff/toolkit/utils/toolkit_registry.py", line 366, in call
raise e
File "/Users/mwt/software/openforcefield/openff/toolkit/utils/toolkit_registry.py", line 362, in call
return method(*args, **kwargs)
File "/Users/mwt/software/openforcefield/openff/toolkit/utils/openeye_wrapper.py", line 1693, in generate_conformers
raise ConformerGenerationError(
openff.toolkit.utils.exceptions.ConformerGenerationError: OpenEye Omega conformer generation failed As far as I understand it, the first two calls do what we expect; tell the toolkit which wrapped toolkit to use, and report those results. However, I expected the vanilla case to fail on OpenEye but then proceed to try RDKit. This is what |
You would need to set |
It might have been easier to define an allow-list of exceptions, really... |
Ah, you're right. I forgot the falsiness of the default value openff-toolkit/openff/toolkit/utils/toolkit_registry.py Lines 354 to 355 in f41e671
I agree there might be a better way to control this behavior, this behavior resulting from passing an empty list is not intuitive to me. Behaving as expected now, I think: In [1]: >>> from openff.toolkit.topology import Molecule
...: >>> smi = "B1(OB(OB(O1)OC)OC)OC"
...: >>> molecule = Molecule.from_smiles(smi)
...: >>> from openff.toolkit.utils.toolkits import OpenEyeToolkitWrapper, RDKitToolkitWrapper, AmberToolsToolkitWrapper, GLOBAL_TOOLKIT_REGISTRY, ToolkitRegistry
...:
In [2]: >>> molecule.generate_conformers(n_conformers=1)
...:
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: Unable to find bend parameters for
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: : Force field setup failed due to missing parameters
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: Unable to find bend parameters for
Warning: no MMFF bend parameters for atoms 1 2 3
Warning: : Force field setup failed due to missing parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, thanks @lilyminium and @mattwthompson for digging into this! Yeah, the exception blocklist was a weird call I made during an attempt to appease the ToolkitAM1BCCHandler
as I was trying to teach it what is vs. isn't fatal during system creation. This PR is a massive improvement to a lot of things, and past some non-blocking comments, the only additional thing I'd really like to see is a releasenotes update for the behavior change of molecule.generate_conformers
.
Squashed commit of the following: commit b3bcc88 Author: Jeff Wagner <jwagnerjpl@gmail.com> Date: Fri Sep 10 13:42:37 2021 -0700 Update latest release tag to be 'stable' instead of 'latest' (#1068) * update use of latest tag to refer to 'stable' instead of 'latest' (since 'latest' clashes with the RTD builtin 'latest' keyword) * Update .github/workflows/release.yml Co-authored-by: Josh A. Mitchell <yoshanuikabundi@gmail.com> * Update notebook links from 'latest' to 'stable' tag * cosmetic commit to kick ci Co-authored-by: Josh A. Mitchell <yoshanuikabundi@gmail.com> commit 9d9f933 Author: Matt Thompson <mattwthompson@protonmail.com> Date: Thu Sep 9 18:24:25 2021 -0500 Safely import OpenMM (#1063) * Pin to OpenMM 7.5.x * Loosen OpenMM pin * Fix link to OpenMM ForceField API docs * Unpin everything * Cleanup * Gracefully import OpenMM in examples * Safely import OpenMM everywhere * Clean up an import * Run CI with openmm==7.5 pin * Run CI with openmm==7.6 pin * Unpin OpenMM, run slow tests * Revert addition of slow tests commit e4b56ab Author: Matt Thompson <mattwthompson@protonmail.com> Date: Thu Sep 9 17:12:30 2021 -0500 Catch/raise descriptive error on conformer generation failure (#1050) * Catch/raise descriptive error on conformer generation failure * Run slow tests in PR * Remove useless raise_exception_types, add test in Molecule API * Remove unused import * Update openff/toolkit/utils/exceptions.py Co-authored-by: Lily Wang <31115101+lilyminium@users.noreply.github.com> * Use uranium hexafluoride to test conformer generation failures * Make conformer generation try other toolkits * Explicitly test that both OpenEye and RDKit fail on UF6 * Update CHANGELOG * Fix change pushed to wrong branch Co-authored-by: Lily Wang <31115101+lilyminium@users.noreply.github.com> commit 7a3fad5 Author: Matt Thompson <mattwthompson@protonmail.com> Date: Wed Sep 8 16:01:00 2021 -0500 nbqa-black -> black (#1064)
* Update check_parameter_coverage to Sage FF * Update conformer-energies to Sage FF * Update forcefield_modification to Sage FF * Update inspect_assigned_parameters to Sage FF * Update smirnoff_simulation to Sage FF * Update using_smirnoff_in_amber_or_gromacs to Sage FF * Update swap_amber_parameters to Sage FF * Update toolkit_showcase to Sage FF * Update using_smirnoff_with_amber_protein_forcefield to Sage FF * Update virtual_sites to Sage FF * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update changelog * Fix references to old force fields in comments * Update conformer_energies.py to use Sage and print out the used force field * Add pin for openff-forcefield >=2.0.0 to examples environment * Add example script behaviour change to changelog * Merge `master` into `update-example-ffs` Squashed commit of the following: commit b3bcc88 Author: Jeff Wagner <jwagnerjpl@gmail.com> Date: Fri Sep 10 13:42:37 2021 -0700 Update latest release tag to be 'stable' instead of 'latest' (#1068) * update use of latest tag to refer to 'stable' instead of 'latest' (since 'latest' clashes with the RTD builtin 'latest' keyword) * Update .github/workflows/release.yml Co-authored-by: Josh A. Mitchell <yoshanuikabundi@gmail.com> * Update notebook links from 'latest' to 'stable' tag * cosmetic commit to kick ci Co-authored-by: Josh A. Mitchell <yoshanuikabundi@gmail.com> commit 9d9f933 Author: Matt Thompson <mattwthompson@protonmail.com> Date: Thu Sep 9 18:24:25 2021 -0500 Safely import OpenMM (#1063) * Pin to OpenMM 7.5.x * Loosen OpenMM pin * Fix link to OpenMM ForceField API docs * Unpin everything * Cleanup * Gracefully import OpenMM in examples * Safely import OpenMM everywhere * Clean up an import * Run CI with openmm==7.5 pin * Run CI with openmm==7.6 pin * Unpin OpenMM, run slow tests * Revert addition of slow tests commit e4b56ab Author: Matt Thompson <mattwthompson@protonmail.com> Date: Thu Sep 9 17:12:30 2021 -0500 Catch/raise descriptive error on conformer generation failure (#1050) * Catch/raise descriptive error on conformer generation failure * Run slow tests in PR * Remove useless raise_exception_types, add test in Molecule API * Remove unused import * Update openff/toolkit/utils/exceptions.py Co-authored-by: Lily Wang <31115101+lilyminium@users.noreply.github.com> * Use uranium hexafluoride to test conformer generation failures * Make conformer generation try other toolkits * Explicitly test that both OpenEye and RDKit fail on UF6 * Update CHANGELOG * Fix change pushed to wrong branch Co-authored-by: Lily Wang <31115101+lilyminium@users.noreply.github.com> commit 7a3fad5 Author: Matt Thompson <mattwthompson@protonmail.com> Date: Wed Sep 8 16:01:00 2021 -0500 nbqa-black -> black (#1064) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Squashed commit of the following: commit 708a5c7 Author: Jeff Wagner <jwagnerjpl@gmail.com> Date: Tue Oct 26 13:13:04 2021 -0700 Update README.md commit 48a3e3f Author: Jeff Wagner <jwagnerjpl@gmail.com> Date: Tue Oct 26 13:11:07 2021 -0700 Update releasehistory.md commit 88b03bf Author: Jeff Wagner <jwagnerjpl@gmail.com> Date: Tue Oct 26 11:58:35 2021 -0700 Cleanup and releasenotes prep for 0.10.1 (#1112) * cleanup and releasenotes prep for 0.10.1 * Apply suggestions from code review Co-authored-by: Matt Thompson <mattwthompson@protonmail.com> * make CI run without mypy/typing-extensions * drop deps that are pulling in pydantic --> typing-extensions * revert changes to pre-release testing Co-authored-by: Matt Thompson <mattwthompson@protonmail.com> commit ac99d2e Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Oct 18 05:39:02 2021 -0500 Bump actions/checkout from 2.3.4 to 2.3.5 (#1107) Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.4 to 2.3.5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v2.3.4...v2.3.5) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit e8353ef Author: Matt Thompson <mattwthompson@protonmail.com> Date: Thu Oct 7 10:47:56 2021 -0500 Fall back to hill formula in Molecule.__repr__ if to_smiles() fails (#1087) * Fall back to hill formula in Molecule.__repr__ if to_smiles() fails * Update openff/toolkit/tests/test_molecule.py Co-authored-by: Jeff Wagner <jwagnerjpl@gmail.com> * Lint * Update openff/toolkit/tests/test_molecule.py * Lint * Update release history Co-authored-by: Jeff Wagner <jwagnerjpl@gmail.com> commit 893575a Merge: 36e4e30 a8472a7 Author: David Dotson <dotsdl@gmail.com> Date: Fri Oct 1 16:43:38 2021 -0700 Merge pull request #1101 from openforcefield/qcschema_fix `to_qcschema` fix with no bonds. commit a8472a7 Author: David Dotson <dotsdl@gmail.com> Date: Fri Oct 1 10:08:01 2021 -0700 Added changelog entry for #1101 commit bf10ad8 Author: Josh Horton <Josh.Horton@newcastle.ac.uk> Date: Fri Oct 1 16:49:58 2021 +0100 make sure connectivity is none when we have no bonds commit 36e4e30 Author: Matt Thompson <mattwthompson@protonmail.com> Date: Thu Sep 30 11:00:33 2021 -0500 Use Quantity.value_in_unit() instead of dividing quantities by units (#1088) * Use Quantity.value_in_unit() instead of dividing quantities by units * More fixes found by @lilyminium * Update openff/toolkit/topology/molecule.py Co-authored-by: trevorgokey <50244806+trevorgokey@users.noreply.github.com> * Fix atom positions unit logic Co-authored-by: trevorgokey <50244806+trevorgokey@users.noreply.github.com> commit 8a076ae Author: Matt Thompson <mattwthompson@protonmail.com> Date: Thu Sep 30 10:20:26 2021 -0500 Make atom names more unique (#1096) * Append 'x' to atom names to avoid downstream clashes * Update release notes, note TODO from review commit 7ab1636 Author: Matt Thompson <mattwthompson@protonmail.com> Date: Thu Sep 30 08:38:35 2021 -0500 Avoid ParseError deprecation warning when not imported (#1094) commit d39905b Author: Lily Wang <31115101+lilyminium@users.noreply.github.com> Date: Thu Sep 23 11:55:46 2021 -0700 Speed up rdkit distances (#1070) * replace rdkit distances * add branch to ci * small modifications * blacken and remove CI * add comments and change variable name Co-authored-by: Matt Thompson <mattwthompson@protonmail.com> commit fa18468 Author: Matt Thompson <mattwthompson@protonmail.com> Date: Thu Sep 23 12:12:27 2021 -0500 Preparations for supporting type annotations (#1059) * Gradual typing: Set up mypy without type annotations * Add mypy to CI * Add mypy to CI * Fix syntax in environment file * Update configuration, turn off no-redef globally * Prevent mypy from quitting CI runs early * Run mypy in CI only when RDKit and OpenEye backends are installed * Only run mypy on "true/true" parts of matrix * Update import skips for openmm commit 6cfad71 Author: Lily Wang <31115101+lilyminium@users.noreply.github.com> Date: Wed Sep 22 16:42:21 2021 -0700 Raise subclass of AttributeError in __getattr__ (#1052) * add new exception * black likes newlines * isort alphabetically * update releasehistory commit b9caeac Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed Sep 22 14:39:17 2021 -0700 [pre-commit.ci] pre-commit autoupdate (#1083) updates: - [github.com/psf/black: 21.8b0 → 21.9b0](psf/black@21.8b0...21.9b0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> commit c0f9ebe Author: Matt Thompson <mattwthompson@protonmail.com> Date: Wed Sep 22 16:27:34 2021 -0500 Assorted README fixes (#1082) * Update README: smirnoff.html links, latest -> stable, Sage changes * Add link to force field plugin entry point commit 9310765 Author: Josh A. Mitchell <yoshanuikabundi@gmail.com> Date: Thu Sep 23 00:40:06 2021 +1000 Updating install guide (#1062) * Update install guide * Reorganise installation.md to avoid repeating information * Describe installing from source * Add section describing WSL and platform support * Recommend WSL2 and mention hardware reqs * Mention the Jupyter WSL caveat * Update changelog Co-authored-by: Jeff Wagner <jwagnerjpl@gmail.com> commit b1c41ae Author: Josh A. Mitchell <yoshanuikabundi@gmail.com> Date: Thu Sep 16 10:02:20 2021 +1000 Disable HTML post processing to help RTD builds pass (#1080) commit be3079e Author: Jeff Wagner <jwagnerjpl@gmail.com> Date: Wed Sep 15 16:21:52 2021 -0700 fix binder links commit 6a85063 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue Sep 14 09:35:58 2021 -0500 Bump codecov/codecov-action from 2.0.3 to 2.1.0 (#1078) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2.0.3 to 2.1.0. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md) - [Commits](codecov/codecov-action@v2.0.3...v2.1.0) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 1440cf6 Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon Sep 13 14:41:46 2021 -0500 [pre-commit.ci] pre-commit autoupdate (#1077) updates: - [github.com/nbQA-dev/nbQA: 1.1.0 → 1.1.1](nbQA-dev/nbQA@1.1.0...1.1.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> commit 36f3c75 Author: Josh A. Mitchell <yoshanuikabundi@gmail.com> Date: Mon Sep 13 19:52:38 2021 +1000 Update Example notebooks to Sage force field (#1065) * Update check_parameter_coverage to Sage FF * Update conformer-energies to Sage FF * Update forcefield_modification to Sage FF * Update inspect_assigned_parameters to Sage FF * Update smirnoff_simulation to Sage FF * Update using_smirnoff_in_amber_or_gromacs to Sage FF * Update swap_amber_parameters to Sage FF * Update toolkit_showcase to Sage FF * Update using_smirnoff_with_amber_protein_forcefield to Sage FF * Update virtual_sites to Sage FF * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update changelog * Fix references to old force fields in comments * Update conformer_energies.py to use Sage and print out the used force field * Add pin for openff-forcefield >=2.0.0 to examples environment * Add example script behaviour change to changelog * Merge `master` into `update-example-ffs` Squashed commit of the following: commit b3bcc88 Author: Jeff Wagner <jwagnerjpl@gmail.com> Date: Fri Sep 10 13:42:37 2021 -0700 Update latest release tag to be 'stable' instead of 'latest' (#1068) * update use of latest tag to refer to 'stable' instead of 'latest' (since 'latest' clashes with the RTD builtin 'latest' keyword) * Update .github/workflows/release.yml Co-authored-by: Josh A. Mitchell <yoshanuikabundi@gmail.com> * Update notebook links from 'latest' to 'stable' tag * cosmetic commit to kick ci Co-authored-by: Josh A. Mitchell <yoshanuikabundi@gmail.com> commit 9d9f933 Author: Matt Thompson <mattwthompson@protonmail.com> Date: Thu Sep 9 18:24:25 2021 -0500 Safely import OpenMM (#1063) * Pin to OpenMM 7.5.x * Loosen OpenMM pin * Fix link to OpenMM ForceField API docs * Unpin everything * Cleanup * Gracefully import OpenMM in examples * Safely import OpenMM everywhere * Clean up an import * Run CI with openmm==7.5 pin * Run CI with openmm==7.6 pin * Unpin OpenMM, run slow tests * Revert addition of slow tests commit e4b56ab Author: Matt Thompson <mattwthompson@protonmail.com> Date: Thu Sep 9 17:12:30 2021 -0500 Catch/raise descriptive error on conformer generation failure (#1050) * Catch/raise descriptive error on conformer generation failure * Run slow tests in PR * Remove useless raise_exception_types, add test in Molecule API * Remove unused import * Update openff/toolkit/utils/exceptions.py Co-authored-by: Lily Wang <31115101+lilyminium@users.noreply.github.com> * Use uranium hexafluoride to test conformer generation failures * Make conformer generation try other toolkits * Explicitly test that both OpenEye and RDKit fail on UF6 * Update CHANGELOG * Fix change pushed to wrong branch Co-authored-by: Lily Wang <31115101+lilyminium@users.noreply.github.com> commit 7a3fad5 Author: Matt Thompson <mattwthompson@protonmail.com> Date: Wed Sep 8 16:01:00 2021 -0500 nbqa-black -> black (#1064) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> commit b3bcc88 Author: Jeff Wagner <jwagnerjpl@gmail.com> Date: Fri Sep 10 13:42:37 2021 -0700 Update latest release tag to be 'stable' instead of 'latest' (#1068) * update use of latest tag to refer to 'stable' instead of 'latest' (since 'latest' clashes with the RTD builtin 'latest' keyword) * Update .github/workflows/release.yml Co-authored-by: Josh A. Mitchell <yoshanuikabundi@gmail.com> * Update notebook links from 'latest' to 'stable' tag * cosmetic commit to kick ci Co-authored-by: Josh A. Mitchell <yoshanuikabundi@gmail.com> commit 9d9f933 Author: Matt Thompson <mattwthompson@protonmail.com> Date: Thu Sep 9 18:24:25 2021 -0500 Safely import OpenMM (#1063) * Pin to OpenMM 7.5.x * Loosen OpenMM pin * Fix link to OpenMM ForceField API docs * Unpin everything * Cleanup * Gracefully import OpenMM in examples * Safely import OpenMM everywhere * Clean up an import * Run CI with openmm==7.5 pin * Run CI with openmm==7.6 pin * Unpin OpenMM, run slow tests * Revert addition of slow tests commit e4b56ab Author: Matt Thompson <mattwthompson@protonmail.com> Date: Thu Sep 9 17:12:30 2021 -0500 Catch/raise descriptive error on conformer generation failure (#1050) * Catch/raise descriptive error on conformer generation failure * Run slow tests in PR * Remove useless raise_exception_types, add test in Molecule API * Remove unused import * Update openff/toolkit/utils/exceptions.py Co-authored-by: Lily Wang <31115101+lilyminium@users.noreply.github.com> * Use uranium hexafluoride to test conformer generation failures * Make conformer generation try other toolkits * Explicitly test that both OpenEye and RDKit fail on UF6 * Update CHANGELOG * Fix change pushed to wrong branch Co-authored-by: Lily Wang <31115101+lilyminium@users.noreply.github.com> commit 7a3fad5 Author: Matt Thompson <mattwthompson@protonmail.com> Date: Wed Sep 8 16:01:00 2021 -0500 nbqa-black -> black (#1064) commit 6463e8a Author: Matt Thompson <mattwthompson@protonmail.com> Date: Thu Sep 2 17:36:06 2021 -0500 Remove dormant API points (#1058) * Remove dead API points * Remove _networkx_to_hill_formula, replace _to_mdtraj, update release notes * Fix typo commit 881c29a Author: Matt Thompson <mattwthompson@protonmail.com> Date: Thu Sep 2 15:49:04 2021 -0500 Minor fixes for OpenMM 7.6 API changes (#1061) * Pin to OpenMM 7.5.x * Loosen OpenMM pin * Fix link to OpenMM ForceField API docs * Unpin everything * Cleanup * Gracefully import OpenMM in examples * Test on OpenMM 7.5 * Remove OpenMM 7.5 pin commit e0b632d Author: Josh A. Mitchell <yoshanuikabundi@gmail.com> Date: Thu Sep 2 09:11:23 2021 +1000 Enable new OpenFF theme (#979) * Enable openff theme * Typo * Convert headers in index to captions * Updates to work with main theme branch * Fix logo colours Co-authored-by: Jeff Wagner <jwagnerjpl@gmail.com> commit 7cb165a Author: Josh A. Mitchell <yoshanuikabundi@gmail.com> Date: Thu Sep 2 09:10:27 2021 +1000 Improve visualization with RDKit backend (#1001) * Improve usage of RDKit visualization backend * Compute 2d coordinates again every time * lint * Update changelog * Update visualize test for new return type * Implement show_hydrogens for openeye * Remove errant print * Fix incorrect rendering of radicals Rdkit has a complicated system for including Hydrogen atoms. It is discussed here: https://sourceforge.net/p/rdkit/mailman/message/36699970/ In brief, there are three levels of hydrogen inclusion: Explicit and in graph, explicit, and implicit. This is meant to model the difference between hydrogens that are explicit in a SMILES string, and those that are inferred by the toolkit, but it unfortunately goes even further than that. For instance, if hydrogens are removed from a molecule with the rdkit.Chem.rdmolops.RemoveHs() function, which is the recommended way to make explicit hydrogens implicit for visualization, RdKit can then imply the existence of hydrogens using its valence model. This can, for example, convert a radical to the stable species of equivalent charge, even if this means adding hydrogens. In fact, before this commit, simply calling the OFFTK Molecule.to_rdkit method could convert, for example, the hydroxyl radical to water: >>> from openff.toolkit.topology import Molecule >>> from rdkit import Chem >>> >>> radical = Molecule.from_smiles("[O][H]") >>> rd_radical = radical.to_rdkit() >>> Chem.MolToSmiles(rd_radical) '[H]O' Visualizing rd_radical clearly demonstrates that this is water; the oxygen atom has an implicit hydrogen. This can also be seen by building the radical up from individual atoms and bonds. OFFTK has a different philosophy: all the hydrogens are either provided or inferred when the Molecule is created, and then they are explicitly represented in the molecular graph forever. This commit sets the `NoImplicit` property for all atoms in a rdkit molecule created by to_rdkit to True. Since all the hydrogens in a Molecule are already explicitly represented, this more faithfully represents the desired molecule in the rdkit ecosystem. The molecular species is even now stable over sanitization: >>> radical = Molecule.from_smiles("[O][H]") >>> rd_hydroxyl_rad = radical.to_rdkit() >>> Chem.SanitizeMol(rd_hydroxyl_rad) # Modifies in place >>> Chem.MolToSmiles(rd_hydroxyl_rad) [H][O] Visualization even includes the radical dot! * Fix release history lost in previous merge conflict * ipython -> IPython * Apply suggestions from code review * Note TODOs * Default boolean argument to a boolean value * Update behaviour change in changelog Co-authored-by: Matthew W. Thompson <mattwthompson@protonmail.com> Co-authored-by: Jeff Wagner <jwagnerjpl@gmail.com> commit f5b5558 Author: Matt Thompson <mattwthompson@protonmail.com> Date: Wed Sep 1 15:58:26 2021 -0500 Add @requires_pkg on Interchange tests (#1054) commit da37f07 Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon Aug 30 16:43:57 2021 -0500 [pre-commit.ci] pre-commit autoupdate (#1060) updates: - [github.com/psf/black: 21.7b0 → 21.8b0](psf/black@21.7b0...21.8b0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> commit a837709 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed Aug 25 11:14:29 2021 -0500 Bump codecov/codecov-action from 2.0.2 to 2.0.3 (#1055) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2.0.2 to 2.0.3. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md) - [Commits](codecov/codecov-action@v2.0.2...v2.0.3) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Kinda addresses #1049, at least for the RDKit case.