public void Test(IAtomContainer mol, int expected) { AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner(); PermutationGroup group = refiner.GetAutomorphismGroup(mol); Assert.AreEqual(expected, group.Order()); }
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 } }
public void AdvancedConstructorTest() { bool ignoreElements = true; bool ignoreBondOrder = true; AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner(ignoreElements, ignoreBondOrder); Assert.IsNotNull(refiner); }
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); AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner(); Assert.IsFalse(refiner.IsCanonical(ac)); }
public void GetVertexCountTest() { 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(); refiner.Refine(ac); Assert.AreEqual(ac.Atoms.Count, refiner.GetVertexCount()); }
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 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); }
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 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()); }
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()); }
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); }
/// <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); } }
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"); }
public void DefaultConstructorTest() { AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner(); Assert.IsNotNull(refiner); }