Beispiel #1
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);
        }
Beispiel #2
0
        public void ClearFlags_cyclobutadiene()
        {
            IAtomContainer cyclobutadiene = CreateFromSmiles("c1ccc1");

            daylight.Apply(cyclobutadiene);
            foreach (var bond in cyclobutadiene.Bonds)
            {
                Assert.IsFalse(bond.IsAromatic);
            }
            foreach (var atom in cyclobutadiene.Atoms)
            {
                Assert.IsFalse(atom.IsAromatic);
            }
        }
Beispiel #3
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
            }
        }