/** * Calculates a score based on the overlap of atoms and intersection of bonds. * The overlap is calculated by summing up the distances between all pairs of * atoms, if they are less than half the standard bondlength apart. * *@param ac The Atomcontainer to work on *@param overlappingAtoms Description of the Parameter *@param overlappingBonds Description of the Parameter *@return The overlapScore value */ public double getOverlapScore(IAtomContainer ac, Vector overlappingAtoms, Vector overlappingBonds) { double overlapScore = 0; overlapScore = getAtomOverlapScore(ac, overlappingAtoms); //overlapScore += getBondOverlapScore(ac, overlappingBonds); return overlapScore; }
/** * Calculates a score based on the overlap of atoms and intersection of bonds. * The overlap is calculated by summing up the distances between all pairs of * atoms, if they are less than half the standard bondlength apart. * *@param ac The Atomcontainer to work on *@param overlappingAtoms Description of the Parameter *@param overlappingBonds Description of the Parameter *@return The overlapScore value */ public double getOverlapScore(IAtomContainer ac, Vector overlappingAtoms, Vector overlappingBonds) { double overlapScore = 0; overlapScore = getAtomOverlapScore(ac, overlappingAtoms); //overlapScore += getBondOverlapScore(ac, overlappingBonds); return overlapScore; }
/** * A unit test for JUnit * *@exception Exception Description of the Exception */ @Test public void testResolveOverlap1() throws Exception { 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(); double score = new OverlapResolver().getAtomOverlapScore(atomContainer, new Vector()); logger.debug("Overlap Score before treatment: " + score); Assert.assertTrue(score > 0); or.resolveOverlap(atomContainer, null); //MoleculeViewer2D.display(new AtomContainer(atomContainer), false); score = new OverlapResolver().getAtomOverlapScore(atomContainer, new Vector()); logger.debug("Overlap Score after treatment: " + score); Assert.assertEquals(0.0, score, 0.00001); logger.debug("End of test case with atom clash"); }