Beispiel #1
0
        public void TestAtomPermutation()
        {
            AtomContainer ac = new AtomContainer();
            AtomContainer result;
            string        atoms = "";

            ac.Atoms.Add(new Atom("C"));
            ac.Atoms.Add(new Atom("N"));
            ac.Atoms.Add(new Atom("P"));
            ac.Atoms.Add(new Atom("O"));
            ac.Atoms.Add(new Atom("S"));
            ac.Atoms.Add(new Atom("Br"));
            ac.AddBond(ac.Atoms[0], ac.Atoms[1], BondOrder.Single);
            ac.AddBond(ac.Atoms[1], ac.Atoms[2], BondOrder.Single);
            ac.AddBond(ac.Atoms[2], ac.Atoms[3], BondOrder.Single);
            ac.AddBond(ac.Atoms[3], ac.Atoms[4], BondOrder.Single);
            ac.AddBond(ac.Atoms[4], ac.Atoms[5], BondOrder.Single);
            AtomContainerAtomPermutor acap = new AtomContainerAtomPermutor(ac);
            int counter = 0;

            while (acap.MoveNext())
            {
                counter++;
                atoms  = "";
                result = (AtomContainer)acap.Current;
                for (int f = 0; f < result.Atoms.Count; f++)
                {
                    atoms += result.Atoms[f].Symbol;
                }
            }
            Assert.AreEqual(719, counter);
        }
        public void Main()
        {
            var container = TestMoleculeFactory.MakeBenzene();

            #region
            AtomContainerAtomPermutor permutor = new AtomContainerAtomPermutor(container);
            while (permutor.MoveNext())
            {
                IAtomContainer permutedContainer = permutor.Current;
                // ...
            }
            #endregion
        }
        public void TestCountAtomPermutation()
        {
            AtomContainer ac = new AtomContainer();

            ac.Atoms.Add(new Atom("C"));
            ac.Atoms.Add(new Atom("N"));
            ac.Atoms.Add(new Atom("P"));
            ac.Atoms.Add(new Atom("O"));
            ac.Atoms.Add(new Atom("S"));
            ac.Atoms.Add(new Atom("Br"));
            ac.AddBond(ac.Atoms[0], ac.Atoms[1], BondOrder.Single);
            ac.AddBond(ac.Atoms[1], ac.Atoms[2], BondOrder.Single);
            ac.AddBond(ac.Atoms[2], ac.Atoms[3], BondOrder.Single);
            ac.AddBond(ac.Atoms[3], ac.Atoms[4], BondOrder.Single);
            ac.AddBond(ac.Atoms[4], ac.Atoms[5], BondOrder.Single);
            AtomContainerAtomPermutor acap = new AtomContainerAtomPermutor(ac);
            int counter = 0;

            while (acap.MoveNext())
            {
                counter++;
            }
            Assert.AreEqual(719, counter);
        }