Пример #1
0
        public void FromStringTest2()
        {
            Partition p = Partition.FromString("[0|1,2,3]");

            Assert.AreEqual(2, p.Count);
            Assert.AreEqual(4, p.NumberOfElements());
        }
        public void Cube2eneWithBonds()
        {
            AtomRefinable             ar      = Make(Cubene(), false);
            EquitablePartitionRefiner refiner = new EquitablePartitionRefiner(ar);
            Partition finer    = refiner.Refine(Partition.Unit(8));
            Partition expected = Partition.FromString("0,2,5,7|1,3,4,6");

            Assert.AreEqual(expected, finer);
        }
Пример #3
0
        public void RefineTest()
        {
            EquitablePartitionRefiner refiner = new EquitablePartitionRefiner(MakeExampleTable());
            Partition coarser  = Partition.FromString("[0|1,2,3]");
            Partition finer    = refiner.Refine(coarser);
            Partition expected = Partition.FromString("[0|1,2|3]");

            Assert.AreEqual(expected, finer);
        }
Пример #4
0
        public void GetBondPartitionTest()
        {
            string         acpString     = "C0C1C2C3O4 0:1(2),0:4(1),1:2(1),2:3(2),3:4(1)";
            IAtomContainer ac            = AtomContainerPrinter.FromString(acpString, builder);
            BondRefinable  refinable     = new BondRefinable(ac);
            Partition      bondPartition = refinable.GetInitialPartition();
            Partition      expected      = Partition.FromString("0,3|1,4|2");

            Assert.AreEqual(expected, bondPartition);
        }
        public void GetAutomorphismGroup_StartingPartitionTest()
        {
            Partition      partition             = Partition.FromString("0,1|2,3");
            string         acpString             = "C0C1C2C3 0:1(1),0:3(1),1:2(1),2:3(1)";
            IAtomContainer ac                    = AtomContainerPrinter.FromString(acpString, builder);
            AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();
            PermutationGroup             autG    = refiner.GetAutomorphismGroup(ac, partition);

            Assert.AreEqual(2, autG.Order());
        }
Пример #6
0
        public void DisorderedElementPartitionTest()
        {
            IAtomContainer ac       = MakeAtomContainer("NNNNCCCCOOOO");
            Partition      expected = Partition.FromString("4,5,6,7|0,1,2,3|8,9,10,11");

            AtomRefinable refinable = new AtomRefinable(ac);

            Partition elPartition = refinable.GetInitialPartition();

            Assert.AreEqual(expected, elPartition);
        }
Пример #7
0
        public void OddEvenElementPartitionTest()
        {
            IAtomContainer ac       = MakeAtomContainer("CNCNCN");
            Partition      expected = Partition.FromString("0,2,4|1,3,5");

            AtomRefinable refinable = new AtomRefinable(ac);

            Partition elPartition = refinable.GetInitialPartition();

            Assert.AreEqual(expected, elPartition);
        }
        public void GetAutomorphismPartitionTest()
        {
            string acpString = "C0C1C2C3C4C5C6C7C8C9 0:1(2),1:2(1),2:3(2),3:4(1),"
                               + "4:5(2),5:6(1),6:7(2),7:8(1),8:9(2),5:9(1),0:9(1)";
            IAtomContainer ac = AtomContainerPrinter.FromString(acpString, builder);
            AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();
            Partition autP     = refiner.GetAutomorphismPartition(ac);
            Partition expected = Partition.FromString("0|1|2|3|4|5|6|7|8|9");

            Assert.AreEqual(expected, autP);
        }
Пример #9
0
        public void GetElementPartitionTest()
        {
            string    acpString = "C0N1C2P3C4N5";
            Partition expected  = Partition.FromString("0,2,4|1,5|3");

            IAtomContainer ac        = AtomContainerPrinter.FromString(acpString, builder);
            AtomRefinable  refinable = new AtomRefinable(ac);

            Partition elPartition = refinable.GetInitialPartition();

            Assert.AreEqual(expected, elPartition);
        }
        public void GetAutomorphismPartitionTest()
        {
            int   n = 3;
            Graph g = new Graph(n)
            {
                connectionTable = new int[][] { new[] { 0, 1, 1 }, new[] { 1, 0, 0 }, new[] { 1, 0, 0 } }
            };
            PermutationGroup group   = new PermutationGroup(n);
            MockRefiner      refiner = new MockRefiner(g);

            Setup(refiner, group, g);
            refiner.Refine(Partition.Unit(n));
            Partition autPartition = refiner.GetAutomorphismPartition();
            Partition expected     = Partition.FromString("0|1,2");

            Assert.AreEqual(expected, autPartition);
        }
        public void TestBiphenyl()
        {
            IAtomContainer mol = TestMoleculeFactory.MakeBiphenyl();

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol);
            Aromaticity.CDKLegacy.Apply(mol);
            Assert.IsNotNull(mol, "Created molecule was null");

            AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();

            refiner.Refine(mol);
            Partition autP = refiner.GetAutomorphismPartition();

            Assert.AreEqual(4, autP.Count, "Wrong number of equivalent classes");
            Partition expected = Partition.FromString("0,6|1,5,7,11|2,4,8,10|3,9");

            Assert.AreEqual(expected, autP, "Wrong class assignment");
        }