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

static boolean org::openscience::cdk::geometry::BondTools::isEndOfDoubleBond ( IAtomContainer  container,
IAtom  atom,
IAtom  parent,
boolean[]  doubleBondConfiguration 
) [inline, static, private]

Says if an atom is the end of a double bond configuration

Parameters:
atomThe atom which is the end of configuration
containerThe atomContainer the atom is in
parentThe atom we came from
doubleBondConfigurationThe array indicating where double bond configurations are specified (this method ensures that there is actually the possibility of a double bond configuration)
Returns:
false=is not end of configuration, true=is

Definition at line 206 of file BondTools.java.

References org::openscience::cdk::CDKConstants::BONDORDER_DOUBLE, org::openscience::cdk::interfaces::IAtomContainer::getAtomNumber(), org::openscience::cdk::interfaces::IAtomContainer::getBond(), org::openscience::cdk::interfaces::IAtomContainer::getBondNumber(), org::openscience::cdk::interfaces::IAtomContainer::getConnectedAtomsList(), org::openscience::cdk::interfaces::IAtom::getHydrogenCount(), org::openscience::cdk::graph::invariant::MorganNumbersTools::getMorganNumbersWithElementSymbol(), org::openscience::cdk::interfaces::IBond::getOrder(), and org::openscience::cdk::interfaces::IElement::getSymbol().

                                                                                                                                  {
    if (container.getBondNumber(atom, parent) == -1 || doubleBondConfiguration.length <= container.getBondNumber(atom, parent) || !doubleBondConfiguration[container.getBondNumber(atom, parent)]) {
      return false;
    }

      int hcount;
      if (atom.getHydrogenCount() == CDKConstants.UNSET) hcount = 0;
      else hcount = atom.getHydrogenCount();

    int lengthAtom = container.getConnectedAtomsList(atom).size() + hcount;

       if (parent.getHydrogenCount() == CDKConstants.UNSET) hcount = 0;
      else hcount = parent.getHydrogenCount();

    int lengthParent = container.getConnectedAtomsList(parent).size() + hcount;
      
    if (container.getBond(atom, parent) != null) {
      if (container.getBond(atom, parent).getOrder() == CDKConstants.BONDORDER_DOUBLE && (lengthAtom == 3 || (lengthAtom == 2 && atom.getSymbol().equals("N"))) && (lengthParent == 3 || (lengthParent == 2 && parent.getSymbol().equals("N")))) {
        List<IAtom> atoms = container.getConnectedAtomsList(atom);
        IAtom one = null;
        IAtom two = null;
          for (IAtom conAtom : atoms) {
              if (conAtom != parent && one == null) {
                  one = conAtom;
              } else if (conAtom != parent && one != null) {
                  two = conAtom;
              }
          }
        String[] morgannumbers = MorganNumbersTools.getMorganNumbersWithElementSymbol(container);
        if ((one != null && two == null && atom.getSymbol().equals("N") && Math.abs(giveAngleBothMethods(parent, atom, one, true)) > Math.PI / 10) || (!atom.getSymbol().equals("N") && one != null && two != null && !morgannumbers[container.getAtomNumber(one)].equals(morgannumbers[container.getAtomNumber(two)]))) {
          return (true);
        } else {
          return (false);
        }
      }
    }
    return (false);
  }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index