Пример #1
0
 void Main()
 {
     IAtomContainer someMolecule = null;
     {
         #region 1
         IAtomContainer ac = someMolecule; // get an atom container somehow
         AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();
         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
         AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();
         if (refiner.IsCanonical(ac))
         {
             // do something with the atom container
         }
         #endregion
     }
     {
         IAtomContainer ac = someMolecule;
         #region 3
         AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();
         refiner.Refine(ac);
         bool             isCanon = refiner.IsCanonical();
         PermutationGroup autG    = refiner.GetAutomorphismGroup();
         #endregion
     }
 }
Пример #2
0
        public void Test(IAtomContainer mol, int expected)
        {
            AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();
            PermutationGroup             group   = refiner.GetAutomorphismGroup(mol);

            Assert.AreEqual(expected, group.Order());
        }
        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());
        }
        public void GetAutomorphismGroupTest()
        {
            string         acpString             = "C0C1C2O3 0:1(2),0:2(1),1:3(1),2:3(1)";
            IAtomContainer ac                    = AtomContainerPrinter.FromString(acpString, builder);
            AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();
            PermutationGroup             autG    = refiner.GetAutomorphismGroup(ac);

            Assert.IsNotNull(autG);
            Assert.AreEqual(1, autG.Order());
        }
        public void RefineTest()
        {
            string         acpString             = "C0C1O2O3 0:1(1),0:3(1),1:2(1),2:3(1)";
            IAtomContainer ac                    = AtomContainerPrinter.FromString(acpString, builder);
            AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();

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

            Assert.AreEqual(2, autG.Order());
        }
        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());
        }
        public void Refine_IgnoreElementsTest()
        {
            string         acpString             = "C0C1O2O3 0:1(1),0:3(1),1:2(1),2:3(1)";
            IAtomContainer ac                    = AtomContainerPrinter.FromString(acpString, builder);
            bool           ignoreElements        = true;
            bool           ignoreBondOrder       = false;
            AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner(ignoreElements, ignoreBondOrder);

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

            Assert.AreEqual(8, autG.Order());
        }