Return original molecule from StereoisomerEnumerator when no unspecified stereocenters are available#8924
Merged
greglandrum merged 2 commits intordkit:masterfrom Nov 11, 2025
Conversation
…ippers are available and add test for embedding behavior with input acceptance.
Contributor
Author
|
Hi @DavidACosgrove, it would be nice if you can have a look on this PR |
Collaborator
Sorry, that I missed that one. One of the maintainers will have to review it also, however, before it can be accepted and merged. |
greglandrum
reviewed
Nov 11, 2025
Code/GraphMol/EnumerateStereoisomers/EnumerateStereoisomers.cpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
Member
|
Thanks @phonglam3103 ! |
greglandrum
added a commit
that referenced
this pull request
Nov 28, 2025
…ied stereocenters are available (#8924) * Enhance StereoisomerEnumerator to return original molecule when no flippers are available and add test for embedding behavior with input acceptance. * Use std::make_unique for ROMol construction Co-authored-by: Greg Landrum <greg.landrum@gmail.com> --------- Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this implement/fix? Explain your changes.
The current implementation of rdEnumerateStereoisomers with the tryEmbedding option enabled attempts to embed the input molecule even when no stereoisomer flipping has occurred.
For example:
returns:
As a result, the input molecule disappears after enumeration.
By contrast, the original Python implementation of EnumerateStereoisomers returns the input molecule unchanged when no “flippers” (stereocenters to invert) are present:
returns:
This PR updates the C++ StereoisomerEnumerator so that it behaves consistently with the Python version. Specifically, it skips embedding when the d_flippers vector is empty (i.e., no new stereoisomers are generated). This ensures that the input molecule is preserved and avoids unnecessary embedding attempts, improving both correctness and performance.