public void TestPyrrole_Silent() { var smiles = "c2ccc3n([H])c1ccccc1c3(c2)"; var sp = new SmilesParser(builder, false); var molecule = sp.ParseSmiles(smiles); AtomContainerManipulator.SetSingleOrDoubleFlags(molecule); AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(molecule); molecule = dbst.FixAromaticBondOrders(molecule); Assert.IsNotNull(molecule); molecule = (IAtomContainer)AtomContainerManipulator.RemoveHydrogens(molecule); int doubleBondCount = 0; for (int i = 0; i < molecule.Bonds.Count; i++) { IBond bond = molecule.Bonds[i]; Assert.IsTrue(bond.IsAromatic); if (bond.Order == BondOrder.Double) { doubleBondCount++; } } Assert.AreEqual(6, doubleBondCount); }
public void RadicalCanon() { var builder = CDK.Builder; IAtomContainer mola = builder.NewAtomContainer(); mola.Atoms.Add(builder.NewAtom("CH3")); mola.Atoms.Add(builder.NewAtom("CH2")); mola.Atoms.Add(builder.NewAtom("CH2")); mola.Atoms.Add(builder.NewAtom("CH2")); mola.Atoms.Add(builder.NewAtom("CH2")); mola.Atoms.Add(builder.NewAtom("CH1")); mola.Atoms.Add(builder.NewAtom("CH3")); mola.AddBond(mola.Atoms[1], mola.Atoms[2], BondOrder.Single); mola.AddBond(mola.Atoms[2], mola.Atoms[3], BondOrder.Single); mola.AddBond(mola.Atoms[3], mola.Atoms[4], BondOrder.Single); mola.AddBond(mola.Atoms[4], mola.Atoms[5], BondOrder.Single); mola.AddBond(mola.Atoms[5], mola.Atoms[6], BondOrder.Single); mola.AddBond(mola.Atoms[0], mola.Atoms[5], BondOrder.Single); mola.AddSingleElectronTo(mola.Atoms[1]); SmilesParser smipar = new SmilesParser(builder); var molb = smipar.ParseSmiles("CC(CCC[CH2])C |^1:5|"); SmilesGenerator smigen = new SmilesGenerator(SmiFlavors.Canonical | SmiFlavors.CxRadical); Assert.AreEqual(smigen.Create(molb), smigen.Create(mola)); }