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 } }
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); }
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)); }
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()); }
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()); }
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()); }
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 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"); }