DeAromatizationTool { public static boolean deAromatize(IRing ring) { boolean allaromatic = true; for (int i = 0; i < ring.getBondCount(); i++) { if (!ring.getBond(i).getFlag(CDKConstants.ISAROMATIC)) allaromatic = false; } if (!allaromatic) return false; for (int i = 0; i < ring.getBondCount(); i++) { if (ring.getBond(i).getFlag(CDKConstants.ISAROMATIC)) ring.getBond(i).setOrder(IBond.Order.SINGLE); } boolean result = false; IMolecularFormula formula = MolecularFormulaManipulator.getMolecularFormula(ring); if (ring.getRingSize() == 6) { if (MolecularFormulaManipulator.getElementCount(formula, new Element("C")) == 6) { result = DeAromatizationTool.deAromatizeBenzene(ring); } else if (MolecularFormulaManipulator.getElementCount(formula, new Element("C")) == 5 && MolecularFormulaManipulator.getElementCount(formula, new Element("N")) == 1) { result = DeAromatizationTool.deAromatizePyridine(ring); } } if (ring.getRingSize() == 5) { if (MolecularFormulaManipulator.getElementCount(formula, new Element("C")) == 4 && MolecularFormulaManipulator.getElementCount(formula, new Element("N")) == 1) { result = deAromatizePyrolle(ring); } } return result; }  static boolean deAromatize(IRing ring); static void Dearomatize(IAtomContainer molecule); static boolean Dearomatize666Rings(IRingSet rings); static boolean Dearomatize566Rings(IRingSet rings); static boolean Dearomatize66Rings(IRingSet rings); static boolean Dearomatize56Rings(IRingSet rings); static boolean Dearomatize6Ring(IRingSet rings); static boolean Dearomatize5Ring(IRingSet rings);  }
@Test public void testBezene() { Ring benzene = new Ring(6, "C"); Iterator<IBond> bonds = benzene.bonds().iterator(); while (bonds.hasNext()) bonds.next().setFlag(CDKConstants.ISAROMATIC, true); boolean success = DeAromatizationTool.deAromatize(benzene); Assert.assertTrue(success); double bondOrderSum = AtomContainerManipulator.getSingleBondEquivalentSum(benzene); Assert.assertEquals(9.0, bondOrderSum, 0.00001); }
@Test public void testPyridine() { Ring pyridine = new Ring(6, "C"); pyridine.getAtom(0).setSymbol("N"); Iterator<IBond> bonds = pyridine.bonds().iterator(); while (bonds.hasNext()) bonds.next().setFlag(CDKConstants.ISAROMATIC, true); boolean success = DeAromatizationTool.deAromatize(pyridine); Assert.assertTrue(success); double bondOrderSum = AtomContainerManipulator.getSingleBondEquivalentSum(pyridine); Assert.assertEquals(9.0, bondOrderSum, 0.00001); }
@Test public void testDeAromatize_IRing() { Ring butadiene = new Ring(4, "C"); boolean success = DeAromatizationTool.deAromatize(butadiene); Assert.assertFalse(success); }