示例#1
0
  public void timeFile(File dir, String filename) throws CDKException, IOException {
    IAtomContainer atomContainer = readFile(new File(dir, filename));
    long start;

    start = System.currentTimeMillis();
    EquivalentClassPartitioner it = new EquivalentClassPartitioner(atomContainer);
    int equivalentClass[] = it.getTopoEquivClassbyHuXu(atomContainer);
    Partition huXuPartition = ArrayToPartition.convert(equivalentClass, 1);
    long elapsedHuXu = System.currentTimeMillis() - start;

    start = System.currentTimeMillis();
    AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();
    refiner.refine(atomContainer);
    Partition refinedPartition = refiner.getAutomorphismPartition();
    long elapsedRef = System.currentTimeMillis() - start;
    long order = refiner.getAutomorphismGroup().order();

    boolean partitionsEqual = refinedPartition.equals(huXuPartition);

    System.out.println(
        filename
            + "\t"
            + atomContainer.getAtomCount()
            + "\t"
            + elapsedRef
            + "\t"
            + elapsedHuXu
            + "\t"
            + order
            + "\t"
            + refinedPartition.size()
            + "\t"
            + partitionsEqual);
  }
  @Test
  public void testQuinone() throws Exception {

    IAtomContainer mol = MoleculeFactory.makeQuinone();
    Assert.assertNotNull("Created molecule was null", mol);

    AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
    CDKHueckelAromaticityDetector.detectAromaticity(mol);

    EquivalentClassPartitioner partitioner = new EquivalentClassPartitioner(mol);
    int[] eqCl = partitioner.getTopoEquivClassbyHuXu(mol);
    Partition autP = ArrayToPartition.convert(eqCl, 1);

    Assert.assertEquals("Wrong number of equivalent classes", 3, autP.size());
    Partition expected = Partition.fromString("0,7|1,4|2,3,5,6");
    Assert.assertEquals("Wrong class assignment", expected, autP);
  }
示例#3
0
  public void compareResults(IAtomContainer atomContainer, int count) throws NoSuchAtomException {
    AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();
    refiner.refine(atomContainer);
    Partition refinedPartition = refiner.getAutomorphismPartition();

    EquivalentClassPartitioner it = new EquivalentClassPartitioner(atomContainer);
    int equivalentClass[] = it.getTopoEquivClassbyHuXu(atomContainer);
    Partition huXuPartition = ArrayToPartition.convert(equivalentClass, 1);

    if (refinedPartition.equals(huXuPartition)) {
      System.out.println(count + " Equal");
    } else {
      System.out.println(count + " Failed");
      System.out.println(AtomContainerPrinter.toString(atomContainer));
      System.out.println(refinedPartition);
      System.out.println(huXuPartition);
    }
  }