示例#1
0
        public void AdvancedConstructorTest()
        {
            bool ignoreBondOrder = true;
            BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner(ignoreBondOrder);

            Assert.IsNotNull(refiner);
        }
示例#2
0
        public static void Test(IAtomContainer mol, int expected)
        {
            BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner();
            PermutationGroup             group   = refiner.GetAutomorphismGroup(mol);

            Assert.AreEqual(expected, group.Order());
        }
示例#3
0
 void Main()
 {
     IAtomContainer someMolecule = null;
     {
         #region 1
         IAtomContainer ac = someMolecule; // get an atom container somehow
         BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner();
         PermutationGroup             autG    = refiner.GetAutomorphismGroup(ac);
         foreach (var automorphism in autG.GenerateAll())
         {
             // do something with the permutation
         }
         #endregion
     }
     {
         #region 2
         IAtomContainer ac = someMolecule; // get an atom container somehow
         BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner();
         if (refiner.IsCanonical(ac))
         {
             // do something with the atom container
         }
         #endregion
     }
     {
         IAtomContainer ac = someMolecule;
         #region 3
         BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner();
         refiner.Refine(ac);
         bool             isCanon = refiner.IsCanonical();
         PermutationGroup autG    = refiner.GetAutomorphismGroup();
         #endregion
     }
 }
示例#4
0
        public void IsCanonical_FalseTest()
        {
            string         acpString             = "C0C1C2O3 0:1(2),0:3(1),1:2(1),2:3(1)";
            IAtomContainer ac                    = AtomContainerPrinter.FromString(acpString, builder);
            BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner();

            Assert.IsFalse(refiner.IsCanonical(ac));
        }
示例#5
0
        public void GetConnectivityTest()
        {
            string         acpString             = "C0C1C2C3 0:1(1),0:3(1),1:2(1),2:3(1)";
            IAtomContainer ac                    = AtomContainerPrinter.FromString(acpString, builder);
            BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner();

            refiner.Refine(ac);
            Assert.AreEqual(1, refiner.GetConnectivity(0, 1));
        }
示例#6
0
        public void GetVertexCountTest()
        {
            string         acpString             = "C0C1C2C3 0:1(1),0:3(1),1:2(1),2:3(1)";
            IAtomContainer ac                    = AtomContainerPrinter.FromString(acpString, builder);
            BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner();

            refiner.Refine(ac);
            Assert.AreEqual(ac.Atoms.Count, refiner.GetVertexCount());
        }
示例#7
0
        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);
            BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner();
            PermutationGroup             autG    = refiner.GetAutomorphismGroup(ac, partition);

            Assert.AreEqual(2, autG.Order());
        }
示例#8
0
        public void GetAutomorphismGroupTest()
        {
            string         acpString             = "C0C1C2O3 0:1(2),0:2(1),1:3(1),2:3(1)";
            IAtomContainer ac                    = AtomContainerPrinter.FromString(acpString, builder);
            BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner();
            PermutationGroup             autG    = refiner.GetAutomorphismGroup(ac);

            Assert.IsNotNull(autG);
            Assert.AreEqual(1, autG.Order());
        }
示例#9
0
        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);
            BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner();
            Partition autP     = refiner.GetAutomorphismPartition(ac);
            Partition expected = Partition.FromString("0|1|2|3|4|5|6|7|8|9|10");

            Assert.AreEqual(expected, autP);
        }
示例#10
0
        public void RefineTest()
        {
            string         acpString             = "C0C1O2O3 0:1(1),0:3(1),1:2(1),2:3(1)";
            IAtomContainer ac                    = AtomContainerPrinter.FromString(acpString, builder);
            BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner();

            refiner.Refine(ac);
            PermutationGroup autG = refiner.GetAutomorphismGroup();

            Assert.AreEqual(2, autG.Order());
        }
示例#11
0
        public void Refine_IgnoreBondOrderTest()
        {
            string         acpString             = "C0C1C2C3 0:1(2),0:3(1),1:2(1),2:3(2)";
            IAtomContainer ac                    = AtomContainerPrinter.FromString(acpString, builder);
            bool           ignoreBondOrder       = true;
            BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner(ignoreBondOrder);

            refiner.Refine(ac);
            PermutationGroup autG = refiner.GetAutomorphismGroup();

            Assert.AreEqual(8, autG.Order());
        }
示例#12
0
        public void GetAutomorphismGroup_StartingGroupTest()
        {
            string                       acpString = "C0C1C2C3 0:1(1),0:2(1),1:3(1),2:3(1)";
            IAtomContainer               ac        = AtomContainerPrinter.FromString(acpString, builder);
            Permutation                  flip      = new Permutation(1, 0, 3, 2);
            PermutationGroup             autG      = new PermutationGroup(4, new[] { flip });
            BondDiscretePartitionRefiner refiner   = new BondDiscretePartitionRefiner();

            refiner.GetAutomorphismGroup(ac, autG);
            Assert.IsNotNull(autG);
            Assert.AreEqual(8, autG.Order());
        }
示例#13
0
        public void ResetTest()
        {
            string         acpString1            = "C0C1C2 0:1(1),1:2(1)";
            IAtomContainer ac1                   = AtomContainerPrinter.FromString(acpString1, builder);
            BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner();

            refiner.Refine(ac1);
            Assert.AreEqual(refiner.GetConnectivity(0, 1), 1);
            Assert.AreEqual(refiner.GetVertexCount(), 2);

            string         acpString2 = "C0C1C2 0:1(1),0:2(1),1:2(1)";
            IAtomContainer ac2        = AtomContainerPrinter.FromString(acpString2, builder);

            refiner.Refine(ac2);
            Assert.AreEqual(refiner.GetConnectivity(0, 2), 1);
            Assert.AreEqual(refiner.GetVertexCount(), 3);
        }
示例#14
0
        public void TestBiphenyl()
        {
            IAtomContainer mol = TestMoleculeFactory.MakeBiphenyl();

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

            BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner();

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

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

            Assert.AreEqual(expected, autP, "Wrong class assignment");
        }
示例#15
0
        public void DefaultConstructorTest()
        {
            BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner();

            Assert.IsNotNull(refiner);
        }