SMSDNormalizer extends AtomContainerManipulator { public static IAtomContainer convertExplicitToImplicitHydrogens(IAtomContainer atomContainer) { IAtomContainer mol = atomContainer.getBuilder().newInstance(IAtomContainer.class, atomContainer); convertImplicitToExplicitHydrogens(mol); if (mol.getAtomCount() > 1) { mol = removeHydrogens(mol); } else if (atomContainer.atoms().iterator().next().getSymbol().equalsIgnoreCase("H")) { System.err.println("WARNING: single hydrogen atom removal not supported!"); } mol.addProperties(atomContainer.getProperties()); mol.setFlags(atomContainer.getFlags()); if (atomContainer.getID() != null) { mol.setID(atomContainer.getID()); } return mol; }  static IAtomContainer makeDeepCopy(IAtomContainer container); static void aromatizeMolecule(IAtomContainer mol); static int getExplicitHydrogenCount(IAtomContainer atomContainer, IAtom atom); static int getImplicitHydrogenCount(IAtomContainer atomContainer, IAtom atom); static int getHydrogenCount(IAtomContainer atomContainer, IAtom atom); static IAtomContainer removeHydrogensAndPreserveAtomID(IAtomContainer atomContainer); static IAtomContainer convertExplicitToImplicitHydrogens(IAtomContainer atomContainer); static void percieveAtomTypesAndConfigureAtoms(IAtomContainer container);  }
@Test public void testConvertExplicitToImplicitHydrogens() throws InvalidSmilesException { String rawMolSmiles = "[H]POOSC(Br)C(Cl)C(F)I"; SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer atomContainer = sp.parseSmiles(rawMolSmiles); int expResult = 11; IAtomContainer result = SMSDNormalizer.convertExplicitToImplicitHydrogens(atomContainer); assertEquals(expResult, result.getAtomCount()); }