Been meaning to get round to this for a while. This patch updates hydrogen adding and removal in the AtomContainerManipulator. The removeHydrogens now considers stereo-elements and so '[C@]([H])(C)(CC)O' can be correctly converted to '[C@H](C)(CC)O'. Also the method now checks whether a hydrogen can be represented as implicit. This changes the behaviour of molecular hydrogen which now does not return an empty container.
May also want to never remove bridging hydrogens but there is already a separate method for that.
https://github.com/johnmay/cdk/compare/cdk:master...patch%2Fmanipulator-hydrogen-handling
Diff:
Oh and adding hydrogens also updates the stereo elements.
Diff:
One this has been patch I need to rewrite the hydrogen removal completely. Testing on some data and it's terribly slow thanks to 'getConnectedBondsMap'. I'll wait for this to be patched first though.
OK, looks good. But I do state that I personally find "original" better than "org", and "copy" better a variable name than "cpy"...
Applied and pushed.
A subsequent patch has replaced the method meaning the 'cpy' is no longer used.