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
Not to keep flags in VABCVolume.calculate(IAtomContainer) #404
Conversation
Current implementation keeps only molecule's flags. It makes inconsistency between molecule and containing atoms/bonds.
Algorithms are not supposed to change flag (decision from a long time ago), unless they are meant to change them (of course). The noted inconsistency should be fixed, but then it should be fixed that atom and bond flags are also not changed. So, I would suggest to not apply this patch, but:
@johnmay, do you agree? |
@@ -103,7 +103,6 @@ public static double calculate(IAtomContainer molecule) throws CDKException { | |||
} | |||
sum -= 5.92 * (molecule.getBondCount() + totalHCount); | |||
|
|||
boolean[] originalFlags = molecule.getFlags(); |
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.
See comments on the PR.
What was the issue with the current code, i.e. which flags were being set/cleared? A lot of the QSAR descriptors are in a bit of a mess as to avoid the non-modify rule a lot of the implementations simply clone the input (expensive). |
I consider aromaticity model has to be applied only in caller code because unexpected aromaticity model change can affect the other descriptor results using the same |
Although I don't like it, the simple fix here is to clone the container (see others). IMO the better design choice is to decide on a "normal form" of a molecule, it has: a) bond orders assigned, b) non-null hydrogen counts, c) ring flags assigned (isInRing), and d) some aromaticity applied, e) maybe atom types assigned but I don't think they're needed - everything else should be internal to the descriptor (e.g. using a thread local cache). Although there are different aromaticity models and some particular descriptor may need some specific model - providing the caller can choose and assign a different model thats okay. |
I agree with John. I consider it is by cdk's design. |
This is fixed in #407. |
Current implementation keeps only molecule's flags. It makes inconsistency between a molecule and containing atoms/bonds.