/** * Main method to be called to resolve overlap situations. * * @param ac The atomcontainer in which the atom or bond overlap exists * @param sssr A ring set for this atom container if one exists, otherwhise null */ 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; }
/** * Main method to be called to resolve overlap situations. * * @param ac The atomcontainer in which the atom or bond overlap exists * @param sssr A ring set for this atom container if one exists, otherwhise null */ 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; }
/** * A unit test for JUnit * *@exception Exception Description of the Exception */ @Test public void testResolveOverlap2() throws Exception { logger.debug("Test case with neither bond nor atom overlap"); String filename = "data/cml/overlaptest2.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); //MoleculeViewer2D.display(new AtomContainer(atomContainer), false); double score = new OverlapResolver().getOverlapScore(atomContainer, new Vector(), new Vector()); Assert.assertEquals(0.0, score, 0.0001); logger.debug("End of test case with neither bond nor atom overlap"); }
logger.debug("Random variable: " + choice + ", displacing second atom"); overlapScore = getOverlapScore(ac, overlappingAtoms, overlappingBonds); steps++; } while (overlapScore > 0 && !(steps > maxSteps));
logger.debug("Random variable: " + choice + ", displacing second atom"); overlapScore = getOverlapScore(ac, overlappingAtoms, overlappingBonds); steps++; } while (overlapScore > 0 && !(steps > maxSteps));