Exemplo n.º 1
0
        public void TestADoubleRingWithANitrogenAtom()
        {
            // Should have 4 double bonds and all three bonds to/from the nitrogen
            // should be single
            var smiles = "c1ccn2cccc2c1";
            var mol    = sp.ParseSmiles(smiles);

            AtomContainerManipulator.PercieveAtomTypesAndConfigureUnsetProperties(mol);

            IAtom nitrogen = mol.Atoms[3];

            atasc.DecideBondOrder(mol, true);

            int doubleBondCount = 0, singleBondCount = 0;

            foreach (var bond in mol.Bonds)
            {
                if (bond.Order.Equals(BondOrder.Double))
                {
                    doubleBondCount++;
                }
                if (bond.Contains(nitrogen))
                {
                    if (bond.Order.Equals(BondOrder.Single))
                    {
                        singleBondCount++;
                    }
                }
            }
            Assert.AreEqual(4, doubleBondCount);
            Assert.AreEqual(3, singleBondCount);
        }
Exemplo n.º 2
0
        public static IAtomContainer ParseSmiles(string smiles)
        {
            var molecule = CDK.SmilesParser.ParseSmiles(smiles);

            AtomContainerManipulator.PercieveAtomTypesAndConfigureUnsetProperties(molecule);
            AtomContainerManipulator.ConvertImplicitToExplicitHydrogens(molecule);
            Aromaticity.CDKLegacy.Apply(molecule);
            return(molecule);
        }