Skip to content

Commit

Permalink
CDKHydrogenAdder should not attempt addImplicitHydrogen for pseudo at…
Browse files Browse the repository at this point in the history
…oms in an atom container

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
mark_rynbeek authored and egonw committed Jan 29, 2010
1 parent a30ca3e commit 7074cf5
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/main/org/openscience/cdk/tools/CDKHydrogenAdder.java
@@ -1,6 +1,5 @@
/* $Revision$ $Author$ $Date$
*
* Copyright (C) 2007 Egon Willighagen
/* Copyright (C) 2007 Egon Willighagen
* 2009 Mark Rijnbeek <markr@ebi.ac.uk>
*
* Contact: cdk-devel@lists.sourceforge.net
*
Expand All @@ -24,6 +23,9 @@
*/
package org.openscience.cdk.tools;

import java.util.Hashtable;
import java.util.Map;

import org.openscience.cdk.CDKConstants;
import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;
Expand All @@ -33,9 +35,7 @@
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IAtomType;
import org.openscience.cdk.interfaces.IChemObjectBuilder;

import java.util.Hashtable;
import java.util.Map;
import org.openscience.cdk.interfaces.IPseudoAtom;

/**
* Adds implicit hydrogens based on atom type definitions. The class assumes
Expand Down Expand Up @@ -107,9 +107,11 @@ public static CDKHydrogenAdder getInstance(IChemObjectBuilder builder) {
@TestMethod("testMethane,testFormaldehyde,testHCN")
public void addImplicitHydrogens(IAtomContainer container) throws CDKException {
for (IAtom atom : container.atoms()) {
addImplicitHydrogens(container, atom);
if ( !(atom instanceof IPseudoAtom) ){
addImplicitHydrogens(container, atom);
}
}
}
}

/**
* Sets the implicit hydrogen count for the indicated IAtom in the given IAtomContainer.
Expand Down

0 comments on commit 7074cf5

Please sign in to comment.