OverlapResolver { public double resolveOverlap(IAtomContainer ac, IRingSet sssr) { Vector overlappingAtoms = new Vector(); Vector overlappingBonds = new Vector(); logger.debug("Start of resolveOverlap"); double overlapScore = getOverlapScore(ac, overlappingAtoms, overlappingBonds); if (overlapScore > 0) { overlapScore = displace(ac, overlappingAtoms, overlappingBonds); } logger.debug("overlapScore = " + overlapScore); logger.debug("End of resolveOverlap"); return overlapScore; } OverlapResolver(); double resolveOverlap(IAtomContainer ac, IRingSet sssr); double displace(IAtomContainer ac, Vector overlappingAtoms, Vector overlappingBonds); double getOverlapScore(IAtomContainer ac, Vector overlappingAtoms, Vector overlappingBonds); double getAtomOverlapScore(IAtomContainer ac, Vector overlappingAtoms); double getBondOverlapScore(IAtomContainer ac, Vector overlappingBonds); boolean areIntersected(IBond bond1, IBond bond2);  }
@Test public void testResolveOverlap4() throws Exception { double overlapScore = 0; logger.debug("Test case with atom clash"); String filename = "data/cml/overlaptest.cml"; InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); CMLReader reader = new CMLReader(ins); IChemFile chemFile = (IChemFile) reader.read(new ChemFile()); IAtomContainer atomContainer = (IAtomContainer) ChemFileManipulator.getAllAtomContainers(chemFile).get(0); OverlapResolver or = new OverlapResolver(); overlapScore = or.resolveOverlap(atomContainer, null); Assert.assertEquals(0.0, overlapScore, 0.0001); logger.debug("End of test case with atom clash"); }
@Test public void testResolveOverlap5() throws Exception { double overlapScore = 0; logger.debug("Test case with atom clash"); IAtomContainer atomContainer = new SmilesParser(DefaultChemObjectBuilder.getInstance()) .parseSmiles("OC4C(N2C1=C(C(=NC(=N1)SC)SC)C3=C2N=CN=C3N)OC(C4O)CO"); StructureDiagramGenerator sdg = new StructureDiagramGenerator(); sdg.setMolecule(new AtomContainer(atomContainer)); sdg.generateCoordinates(); atomContainer = sdg.getMolecule(); OverlapResolver or = new OverlapResolver(); overlapScore = or.resolveOverlap(atomContainer, null); Assert.assertEquals(0.0, overlapScore, 0.0001); logger.debug("End of test case with atom clash"); }