-
Notifications
You must be signed in to change notification settings - Fork 845
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
stop caching ring-finding results #5955
stop caching ring-finding results #5955
Conversation
We should probably search for findSSSR in the code (or fastFindRings) and move the isInitialized to the caller. Example: Wrap/MolOps.cpp line 309
will always call the ring finding code now regardless of whether it exists or not. |
I think there are only a few of these. Mol2FileParser are two that I've found in a brief search. |
ExtendedMurckoScaffold always calls fastFindRings as well - you found this, the function name was clipped. |
As does regioIsomerhash - you found this as well as the Normalizer |
I think you have everything except the Wrapper, Mol2FileParser and ReactionWriter |
Correct - that's exactly what this bug fix is doing: when the user/client calls the ring finding code, it will always be run |
The Wrapper doesn't need a change (see my earlier comment). In the Mol2FileParser the work is being done during molecule construction, so we know we don't need to do the test. I've updated the ReactionWriter |
Yep, the Wrapper was a brain fart. |
LGTM |
Nice, I think this will help with a lot of confusion. |
Now, if we delete a ring bond or atom, do we or should we invalidate the ring info? |
We do: https://github.com/rdkit/rdkit/blob/master/Code/GraphMol/RWMol.cpp#L315 |
Currently the ring-finding code caches its results, which leads to delightful confusion like this:
That mess is by design, but it seems like a bug.
This removes the caching so that things are a bit less surprising.
We could add something to be more specific about what we cache, but there's really no reason for people to be calling the ring finding code multiple times on the same molecule, so this seems like wasted effort to me.
Thanks to @fwaibl for pointing out the problem