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

static boolean org::openscience::cdk::isomorphism::UniversalIsomorphismTester::isIsomorph ( IAtomContainer  g1,
IAtomContainer  g2 
) throws CDKException [inline, static]

Tests if g1 and g2 are isomorph.

g1first molecule. Must not be an IQueryAtomContainer.
g2second molecule. May be an IQueryAtomContainer.
true if the 2 molecule are isomorph
CDKExceptionif the first molecule is an instance of IQueryAtomContainer

Definition at line 137 of file UniversalIsomorphismTester.java.

References getIsomorphMap(), org::openscience::cdk::interfaces::IElement::getSymbol(), and org::openscience::cdk::isomorphism::matchers::IQueryAtom::matches().

Referenced by org::openscience::cdk::tools::StructureResonanceGenerator::existAC(), and org::openscience::cdk::layout::TemplateHandler::mapTemplateExact().

        if (g1 instanceof IQueryAtomContainer)
              throw new CDKException(
                  "The first IAtomContainer must not be an IQueryAtomContainer"
        if (g2.getAtomCount() != g1.getAtomCount()) return false;
      // check single atom case
      if (g2.getAtomCount() == 1) {
          IAtom atom = g1.getAtom(0);
          IAtom atom2 = g2.getAtom(0);
              if (atom instanceof IQueryAtom) {
                    IQueryAtom qAtom = (IQueryAtom)atom;
              return qAtom.matches(g2.getAtom(0));
              } else if (atom2 instanceof IQueryAtom) {
              IQueryAtom qAtom = (IQueryAtom)atom2;
              return qAtom.matches(g1.getAtom(0));
          } else {
                    String atomSymbol = atom.getSymbol();
              return g1.getAtom(0).getSymbol().equals(atomSymbol);
        return (getIsomorphMap(g1, g2) != null);

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