G'day,

 > Your code looks OK, but I am not sure why you need
 > to add implicit hydrogen before removing the explicit
 > hydrogens, though atom typing is expected to be more
 > accurate this way. Is that the reason?

Thanks for looking - it was a while ago now but I think I found that I
got better results doing the add followed by removal.

I have made a couple of tweaks; using the atoms Iterable for the typing
loop and just catching CDKException.

         // Explicit -> Implicit H: addImpH then removeH is better than
removeH then addImpH.
         final IChemObjectBuilder builder =
NoNotificationChemObjectBuilder.getInstance();
         final CDKAtomTypeMatcher matcher =
CDKAtomTypeMatcher.getInstance(builder);
         final IAtomContainer result = new AtomContainer(mol);
         try
         {
             for (final IAtom atom : result.atoms())
             {
                 AtomTypeManipulator.configure(atom,
matcher.findMatchingAtomType(result, atom));
             }

CDKHydrogenAdder.getInstance(builder).addImplicitHydrogens(result);
         }
         catch (final CDKException e)
         {
             LOG.log(Level.WARNING, "Failed to add hydrogens", e);
         }

         // Explicit -> Implicit H.
         return
AtomContainerManipulator.removeHydrogensPreserveMultiplyBonded(result);

Thanks,
Chris.


Syngenta Limited, Registered in England No 2710846
Registered Office : Syngenta Limited, European Regional Centre, Priestley Road, 
Surrey Research Park, Guildford, Surrey, GU2 7YH, United Kingdom



message may contain confidential information. If you are not the designated 
recipient, please notify the sender immediately, and delete the original and 
any copies. Any use of the message by you is prohibited. 


------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to