CDKMCS { public static List<IAtomContainer> getOverlaps(IAtomContainer sourceGraph, IAtomContainer targetGraph, boolean shouldMatchBonds) throws CDKException { List<List<CDKRMap>> rMapsList = search(sourceGraph, targetGraph, new BitSet(), new BitSet(), true, false, shouldMatchBonds); ArrayList<IAtomContainer> graphList = projectList(rMapsList, sourceGraph, ID1); return getMaximum(graphList, shouldMatchBonds); }  static boolean isIsomorph(IAtomContainer sourceGraph, IAtomContainer targetGraph, boolean shouldMatchBonds); static List<CDKRMap> getIsomorphMap(IAtomContainer sourceGraph, IAtomContainer targetGraph,
            boolean shouldMatchBonds); static List<CDKRMap> getIsomorphAtomsMap(IAtomContainer sourceGraph, IAtomContainer targetGraph,
            boolean shouldMatchBonds); static List<List<CDKRMap>> getIsomorphMaps(IAtomContainer sourceGraph, IAtomContainer targetGraph,
            boolean shouldMatchBonds); static List<List<CDKRMap>> getSubgraphMaps(IAtomContainer sourceGraph, IAtomContainer targetGraph,
            boolean shouldMatchBonds); static List<CDKRMap> getSubgraphMap(IAtomContainer sourceGraph, IAtomContainer targetGraph,
            boolean shouldMatchBonds); static List<List<CDKRMap>> getSubgraphAtomsMaps(IAtomContainer sourceGraph, IAtomContainer targetGraph,
            boolean shouldMatchBonds); static List<CDKRMap> getSubgraphAtomsMap(IAtomContainer sourceGraph, IAtomContainer targetGraph,
            boolean shouldMatchBonds); static boolean isSubgraph(IAtomContainer sourceGraph, IAtomContainer targetGraph, boolean shouldMatchBonds); static List<IAtomContainer> getOverlaps(IAtomContainer sourceGraph, IAtomContainer targetGraph,
            boolean shouldMatchBonds); static BitSet getBitSet(IAtomContainer atomContainer); static CDKRGraph buildRGraph(IAtomContainer sourceGraph, IAtomContainer targetGraph, boolean shouldMatchBonds); static List<List<CDKRMap>> search(IAtomContainer sourceGraph, IAtomContainer targetGraph,
            BitSet sourceBitSet, BitSet targetBitSet, boolean findAllStructure, boolean findAllMap,
            boolean shouldMatchBonds); static IAtomContainer project(List<CDKRMap> rMapList, IAtomContainer graph, int key); static ArrayList<IAtomContainer> projectList(List<List<CDKRMap>> rMapsList, IAtomContainer graph, int key); static List<CDKRMap> checkSingleAtomCases(IAtomContainer sourceGraph, IAtomContainer targetGraph); static List<List<CDKRMap>> makeAtomsMapsOfBondsMaps(List<List<CDKRMap>> list, IAtomContainer sourceGraph,
            IAtomContainer targetGraph); static List<CDKRMap> makeAtomsMapOfBondsMap(List<CDKRMap> list, IAtomContainer sourceGraph,
            IAtomContainer targetGraph); synchronized static boolean isTimeOut();  }
@Test public void testGetOverlaps_IAtomContainer_IAtomContainer() throws Exception { String file1 = "data/mdl/5SD.mol"; String file2 = "data/mdl/ADN.mol"; IAtomContainer mol1 = new AtomContainer(); IAtomContainer mol2 = new AtomContainer(); InputStream ins1 = this.getClass().getClassLoader().getResourceAsStream(file1); new MDLV2000Reader(ins1, Mode.STRICT).read(mol1); InputStream ins2 = this.getClass().getClassLoader().getResourceAsStream(file2); new MDLV2000Reader(ins2, Mode.STRICT).read(mol2); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol1); CDKHydrogenAdder adder = CDKHydrogenAdder.getInstance(mol1.getBuilder()); adder.addImplicitHydrogens(mol1); Aromaticity.cdkLegacy().apply(mol1); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol2); adder = CDKHydrogenAdder.getInstance(mol2.getBuilder()); adder.addImplicitHydrogens(mol2); Aromaticity.cdkLegacy().apply(mol2); List<IAtomContainer> list = CDKMCS.getOverlaps(mol1, mol2, true); Assert.assertEquals(1, list.size()); Assert.assertEquals(11, (list.get(0)).getAtomCount()); list = CDKMCS.getOverlaps(mol2, mol1, true); Assert.assertEquals(1, list.size()); Assert.assertEquals(11, (list.get(0)).getAtomCount()); }
@Test public void testSFBug999330() throws Exception { String file1 = "data/mdl/5SD.mol"; String file2 = "data/mdl/ADN.mol"; IAtomContainer mol1 = new AtomContainer(); IAtomContainer mol2 = new AtomContainer(); InputStream ins1 = this.getClass().getClassLoader().getResourceAsStream(file1); new MDLV2000Reader(ins1, Mode.STRICT).read(mol1); InputStream ins2 = this.getClass().getClassLoader().getResourceAsStream(file2); new MDLV2000Reader(ins2, Mode.STRICT).read(mol2); AtomContainerAtomPermutor permutor = new AtomContainerAtomPermutor(mol2); mol2 = new AtomContainer((AtomContainer) permutor.next()); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol1); CDKHydrogenAdder adder = CDKHydrogenAdder.getInstance(mol1.getBuilder()); adder.addImplicitHydrogens(mol1); Aromaticity.cdkLegacy().apply(mol1); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol2); adder = CDKHydrogenAdder.getInstance(mol2.getBuilder()); adder.addImplicitHydrogens(mol2); Aromaticity.cdkLegacy().apply(mol2); List<IAtomContainer> list1 = CDKMCS.getOverlaps(mol1, mol2, true); List<IAtomContainer> list2 = CDKMCS.getOverlaps(mol2, mol1, true); Assert.assertEquals(1, list1.size()); Assert.assertEquals(1, list2.size()); Assert.assertEquals((list1.get(0)).getAtomCount(), (list2.get(0)).getAtomCount()); }