Hi all, please take notice of the bug report below. Please refer to FAQ CDK News 1.2, and look up the differences between the three types of valency checkers. These are used to calculate bond orders, number of missing hydrogens etc. To summarize what Uli wrote down there: there is only one of them that takes into account both charges *and* hybridization states. Use that one for typical chemoinfo tasks. The original was really only used (but still very valuable!) for structure generators, and does only take into account uncharged species, and does not have to know about hybridization states, as it will simply use them all.
So, when instantiating the HydrogenAdder(), you should use this code: ValencyHybridChecker checker = new ValencyHybridChecker(); HydrogenAdder adder = new HydrogenAdder(checker); There is also some code in the jcp21 branch which does not do this; that should be fixed too. Egon ---------- Forwarded Message ---------- Subject: [cdk-bugs] [ cdk-Bugs-1408097 ] Hydrogenadder adds hydrogens to metal ions. Date: Thursday 19 January 2006 18:52 From: "SourceForge.net" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Bugs item #1408097, was opened at 2006-01-17 12:09 Message generated for change (Comment added) made by egonw You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=120024&aid=1408097&group_id =20024 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: org.openscience.cdk.tools Group: None >Status: Closed >Resolution: Invalid Priority: 5 Submitted By: Peter Corbett (peter_corbett) >Assigned to: Egon Willighagen (egonw) Summary: Hydrogenadder adds hydrogens to metal ions. Initial Comment: public static void main(String [] args) throws Exception { Molecule mol = new Molecule(); Atom sodium = new Atom("Na"); sodium.setFormalCharge(1); mol.addAtom(sodium); System.out.println(new SmilesGenerator().createSMILES(mol)); /* [Na+] */ new HydrogenAdder().addExplicitHydrogensToSatisfyValency(mol); System.out.println(new SmilesGenerator().createSMILES(mol)); /* [H][Na+][H], should be as above */ } This causes problems, for example with Renderer2D when you want to render sodium acetate. ---------------------------------------------------------------------- >Comment By: Egon Willighagen (egonw) Date: 2006-01-19 18:52 Message: Logged In: YES user_id=25678 The default hydrogen adder does not know about charges, because it uses a ValencyChecker that does not know about charges. Construct your HydrogenAdder like below, and the problem is solved. There actually was a JUnit test in CVS for your example situation, though with a Cl- counter ion :) ValencyHybridChecker checker = new ValencyHybridChecker(); HydrogenAdder adder = new HydrogenAdder(checker); ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=120024&aid=1408097&group_id =20024 ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ Cdk-bugs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/cdk-bugs ------------------------------------------------------- -- [EMAIL PROTECTED] Blog: http://chem-bla-ics.blogspot.com/ GPG: 1024D/D6336BA6 ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ Cdk-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cdk-user

