public void GetConnectivityTest()
        {
            string         acpString             = "C0C1C2C3 0:1(1),0:3(1),1:2(2),2:3(1)";
            IAtomContainer ac                    = AtomContainerPrinter.FromString(acpString, builder);
            AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();

            refiner.Refine(ac);
            IBond bond   = ac.GetBond(ac.Atoms[1], ac.Atoms[2]);
            int   orderN = bond.Order.Numeric();

            Assert.AreEqual(orderN, refiner.GetConnectivity(1, 2));
        }
        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 });
            AtomDiscretePartitionRefiner refiner   = new AtomDiscretePartitionRefiner();

            refiner.GetAutomorphismGroup(ac, autG);
            Assert.IsNotNull(autG);
            Assert.AreEqual(8, autG.Order());
        }
Пример #3
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());
        }
Пример #4
0
        public void Refine_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();

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

            Assert.AreEqual(2, autG.Order());
        }
        public void ReSetTest()
        {
            string         acpString1            = "C0C1 0:1(1)";
            IAtomContainer ac1                   = AtomContainerPrinter.FromString(acpString1, builder);
            AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();

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

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

            refiner.Refine(ac2);
            Assert.AreEqual(refiner.GetConnectivity(0, 1), 2);
            Assert.AreEqual(refiner.GetVertexCount(), 3);
        }
Пример #6
0
        /// <summary>
        /// This test is checking all permutations of an atom container to see
        /// if the refiner gives the canonical labelling map (effectively).
        /// </summary>
        /// <param name="atomContainer"></param>
        public void CheckForCanonicalForm(IAtomContainer atomContainer)
        {
            AtomContainerAtomPermutor    permutor = new AtomContainerAtomPermutor(atomContainer);
            AtomDiscretePartitionRefiner refiner  = new AtomDiscretePartitionRefiner();

            refiner.Refine(atomContainer);
            Permutation best = refiner.GetBest().Invert();
            string      cert = AtomContainerPrinter.ToString(atomContainer, best, true);

            while (permutor.MoveNext())
            {
                IAtomContainer permutedContainer = permutor.Current;
                refiner.Refine(permutedContainer);
                best = refiner.GetBest().Invert();
                string permCert = AtomContainerPrinter.ToString(permutedContainer, best, true);
                Assert.AreEqual(cert, permCert);
            }
        }
Пример #7
0
 private BondRefinable Refinable(string acpString)
 {
     return(new BondRefinable(AtomContainerPrinter.FromString(acpString, builder)));
 }
Пример #8
0
 public void NapthaleneB()
 {
     Test(AtomContainerPrinter.FromString("C0C1C2C3C4C5C6C7C8C9 0:1(1),1:2(2),2:3(1),3:4(1),4:5(2),"
                                          + "5:6(1),6:7(2),7:8(1),3:8(2),8:9(1),0:9(2)", CDK.Builder), 4);
 }
Пример #9
0
 public void CycloButadiene()
 {
     Test(AtomContainerPrinter.FromString("C0C1C2C3 0:1(2),1:2(1),2:3(2),0:3(1)", builder), 4);
 }
Пример #10
0
 public static string ToString(IAtomContainer atomContainer)
 {
     return(AtomContainerPrinter.ToString(atomContainer, new Permutation(atomContainer.Atoms.Count)));
 }
Пример #11
0
 public static void Print(IAtomContainer atomContainer)
 {
     Console.Out.WriteLine(AtomContainerPrinter.ToString(atomContainer));
 }