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

Fixes #6049 #6061

Merged
merged 4 commits into from
Feb 9, 2023
Merged

Fixes #6049 #6061

merged 4 commits into from
Feb 9, 2023

Conversation

greglandrum
Copy link
Member

Updates the query for bridgehead atoms to resolve the issue.
This also impacts the NumBridgeheadAtoms descriptors, so the version on that gets bumped as well.

@greglandrum
Copy link
Member Author

@ricrogz sorry to tag you again, but since this one is from @cdvonbargen I thought you'd want to review it

Copy link
Contributor

@ricrogz ricrogz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I always have a hard time wrapping my head around these bridgehead issues.

Somehow, this fix seems like a more complicated explanation of the intuition I keep coming back to: the idea that for a degree 3 N atom to be a bridgehead it is a necessary condition that each possible pair of bonds coming out of the atom is part of at least one common ring. I think this implies the condition the the N atom is part of 3 different rings, as it doesn't seem possible that three converging bonds/lines are part of the same ring.

In the case of the last image you posted (which is similar to the case described in the bug report), this condition is violated: bond pair (14, 0),(14, 4) is part of one 6-ring, bond pair (14, 4),(14, 11) is part of two overlapping 9-rings, but pair (14, 0),(14, 11) doesn't have any common rings, so the N atom cannot possibly be a bridgehead.

@greglandrum
Copy link
Member Author

@ricrogz I agree that your description of the conditions for something to be a bridgehead seems correct. and that it is a bit simpler to explain. It's likely also easier to implement. I'll take a look at changing the implementation (and documentation) to this formulation.

@greglandrum
Copy link
Member Author

Of course it's never that easy. Here's the counter-example for that formulation (this is one of the edge cases in the tests and it broke a number of my previous attempts
image
Looking around the N: bond pairs (4,6) and (3,6) share a ring, but (3,4) do not (since the six-ring isn't part of the set of small rings)

@greglandrum greglandrum merged commit 4d4b927 into rdkit:master Feb 9, 2023
@greglandrum greglandrum deleted the fix/github6049 branch February 9, 2023 07:31
@ricrogz
Copy link
Contributor

ricrogz commented Feb 9, 2023

Ah, right. I didn't take SSSRs into account.

@DavidACosgrove
Copy link
Collaborator

DavidACosgrove commented Feb 9, 2023 via email

@bp-kelley
Copy link
Contributor

bp-kelley commented Feb 9, 2023 via email

greglandrum added a commit that referenced this pull request Feb 23, 2023
* backup

* backup

* Fixes #6049

Bump version of NumBridgeheadAtoms descriptor

* add a specific test for the issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants