Logo Search packages:      
Sourcecode: cdk version File versions  Download package

boolean org::openscience::cdk::layout::TemplateHandler::mapTemplateExact ( IAtomContainer  molecule ) throws CDKException [inline]

Checks if one of the loaded templates is isomorph to the given Molecule. If so, it assigns the coordinates from the template to the respective atoms in the Molecule, and marks the atoms as ISPLACED.

moleculeThe molecule to be check for potential templates
True if there was a possible mapping

Definition at line 154 of file TemplateHandler.java.

References org::openscience::cdk::tools::LoggingTool::debug(), org::openscience::cdk::isomorphism::mcss::RMap::getId1(), org::openscience::cdk::isomorphism::mcss::RMap::getId2(), org::openscience::cdk::isomorphism::UniversalIsomorphismTester::getIsomorphAtomsMap(), org::openscience::cdk::interfaces::IAtom::getPoint2d(), org::openscience::cdk::isomorphism::UniversalIsomorphismTester::isIsomorph(), org::openscience::cdk::CDKConstants::ISPLACED, org::openscience::cdk::interfaces::IChemObject::setFlag(), and org::openscience::cdk::interfaces::IAtom::setPoint2d().

Referenced by org::openscience::cdk::layout::StructureDiagramGenerator::layoutRingSet().

                        logger.debug("Trying to map a molecule...");
            boolean mapped = false;
            IMolecule template = null;
            RMap map = null;
            IAtom atom1 = null;
            IAtom atom2 = null;
            for (int f = 0; f < templates.size(); f++)
                  template = (IMolecule) templates.get(f);
                  if (UniversalIsomorphismTester.isIsomorph(molecule, template))
                        List<RMap> list = UniversalIsomorphismTester.getIsomorphAtomsMap(
                        logger.debug("Found a subgraph mapping of size " + list.size() + ", template: " + template.getID());
                        for (int i = 0; i < list.size(); i++)
                              map = list.get(i);
                              atom1 = molecule.getAtom(map.getId1());
                              atom2 = template.getAtom(map.getId2());
                              atom1.setPoint2d(new Point2d(atom2.getPoint2d()));
                              atom1.setFlag(CDKConstants.ISPLACED, true);
                        mapped = true;
                  } else {
                        logger.debug("Structure does not match template: ", template.getID());
            return mapped;

Here is the call graph for this function:

Here is the caller graph for this function:

Generated by  Doxygen 1.6.0   Back to index