Esempio n. 1
0
        public void ValidSum()
        {
            // aromatic
            Assert.IsTrue(Aromaticity.ValidSum(2));
            Assert.IsTrue(Aromaticity.ValidSum(6));
            Assert.IsTrue(Aromaticity.ValidSum(10));
            Assert.IsTrue(Aromaticity.ValidSum(14));
            Assert.IsTrue(Aromaticity.ValidSum(18));

            // anti-aromatic
            Assert.IsFalse(Aromaticity.ValidSum(4));
            Assert.IsFalse(Aromaticity.ValidSum(8));
            Assert.IsFalse(Aromaticity.ValidSum(12));
            Assert.IsFalse(Aromaticity.ValidSum(16));
            Assert.IsFalse(Aromaticity.ValidSum(20));

            // other numbers
            Assert.IsFalse(Aromaticity.ValidSum(0));
            Assert.IsFalse(Aromaticity.ValidSum(1));
            Assert.IsFalse(Aromaticity.ValidSum(3));
            Assert.IsFalse(Aromaticity.ValidSum(5));
            Assert.IsFalse(Aromaticity.ValidSum(7));
            Assert.IsFalse(Aromaticity.ValidSum(9));
            Assert.IsFalse(Aromaticity.ValidSum(11));
            Assert.IsFalse(Aromaticity.ValidSum(13));
            Assert.IsFalse(Aromaticity.ValidSum(15));
        }
Esempio n. 2
0
        public void EnsureConsistentRepresentation()
        {
            IAtomContainer a    = CreateFromSmiles("C1=CC2=CC3=CC4=C(C=CC=C4)C=C3C=C2C=C1");
            IAtomContainer b    = CreateFromSmiles("c1cc2cc3cc4c(cccc4)cc3cc2cc1");
            Aromaticity    arom = new Aromaticity(ElectronDonation.DaylightModel, Cycles.AllSimpleFinder);

            arom.Apply(a);
            arom.Apply(b);
            Assert.IsTrue(AtomContainerDiff.Diff(a, b).Count() == 0);
        }
Esempio n. 3
0
 public void ElectronSum()
 {
     Assert.AreEqual(4, Aromaticity.ElectronSum(new int[] { 0, 1, 2, 3, 0 }, new int[] { 1, 1, 1, 1 }, new int[] { 0, 1, 2, 3 }));
 }
Esempio n. 4
0
        public static void Main(string[] args)
        {
            {
                var molecules = new Silent.AtomContainerSet();
                #region
                ElectronDonation model       = ElectronDonation.DaylightModel;
                ICycleFinder     cycles      = Cycles.Or(Cycles.AllSimpleFinder, Cycles.GetAllFinder(6));
                Aromaticity      aromaticity = new Aromaticity(model, cycles);

                // apply our configured model to each molecule
                foreach (IAtomContainer molecule in molecules)
                {
                    aromaticity.Apply(molecule);
                }
                #endregion
            }
            {
                #region ctor
                // mimics the CDKHuckelAromaticityDetector
                Aromaticity aromaticity_cdk = new Aromaticity(ElectronDonation.CDKModel, Cycles.CDKAromaticSetFinder);
                // mimics the DoubleBondAcceptingAromaticityDetector
                Aromaticity aromaticity_exo = new Aromaticity(ElectronDonation.CDKAllowingExocyclicModel, Cycles.CDKAromaticSetFinder);
                // a good model for writing SMILES
                Aromaticity aromaticity_smi = new Aromaticity(ElectronDonation.DaylightModel, Cycles.AllSimpleFinder);
                // a good model for writing MDL/Mol2
                Aromaticity aromaticity_mdl = new Aromaticity(ElectronDonation.PiBondsModel, Cycles.AllSimpleFinder);
                #endregion
            }
            {
                #region FindBonds
                Aromaticity    aromaticity = new Aromaticity(ElectronDonation.CDKModel, Cycles.AllSimpleFinder);
                IAtomContainer container   = TestMoleculeFactory.MakeAnthracene();
                AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(container);
                try
                {
                    var bonds          = aromaticity.FindBonds(container);
                    int nAromaticBonds = bonds.Count();
                }
                catch (CDKException)
                {
                    // cycle computation was intractable
                }
                #endregion
            }
            {
                #region Apply
                Aromaticity    aromaticity = new Aromaticity(ElectronDonation.CDKModel, Cycles.AllSimpleFinder);
                IAtomContainer container   = TestMoleculeFactory.MakeAnthracene();
                try
                {
                    if (aromaticity.Apply(container))
                    {
                        //
                    }
                }
                catch (CDKException)
                {
                    // cycle computation was intractable
                }
                #endregion
            }
            {
                #region CDKLegacy_CDKAromaticSetFinder
                new Aromaticity(ElectronDonation.CDKModel, Cycles.CDKAromaticSetFinder);
                #endregion
            }
            {
                #region CDKLegacy_AllFinder_RelevantFinder
                new Aromaticity(ElectronDonation.CDKModel, Cycles.Or(Cycles.AllSimpleFinder, Cycles.RelevantFinder));
                #endregion
            }
        }