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

static IMoleculeSet org::openscience::cdk::graph::ConnectivityChecker::partitionIntoMolecules ( IAtomContainer  atomContainer ) [inline, static]

Partitions the atoms in an AtomContainer into covalently connected components.

Parameters:
atomContainerThe AtomContainer to be partitioned into connected components, i.e. molecules
Returns:
A MoleculeSet.

.dictref blue-obelisk:graphPartitioning

Definition at line 100 of file ConnectivityChecker.java.

References org::openscience::cdk::interfaces::IAtomContainer::add(), org::openscience::cdk::interfaces::IAtomContainer::addAtom(), org::openscience::cdk::interfaces::IAtomContainer::addBond(), org::openscience::cdk::interfaces::IAtomContainer::addElectronContainer(), org::openscience::cdk::interfaces::IMoleculeSet::addMolecule(), org::openscience::cdk::graph::PathTools::breadthFirstSearch(), org::openscience::cdk::interfaces::IAtomContainer::getAtom(), org::openscience::cdk::interfaces::IAtomContainer::getAtomCount(), org::openscience::cdk::interfaces::IChemObject::getBuilder(), org::openscience::cdk::interfaces::IChemObjectBuilder::newAtomContainer(), org::openscience::cdk::interfaces::IChemObjectBuilder::newMolecule(), org::openscience::cdk::interfaces::IChemObjectBuilder::newMoleculeSet(), org::openscience::cdk::interfaces::IAtomContainer::remove(), org::openscience::cdk::interfaces::IChemObject::setFlag(), and org::openscience::cdk::CDKConstants::VISITED.

Referenced by org::openscience::cdk::smiles::SmilesGenerator::createSMILES(), org::openscience::cdk::ringsearch::AllRingsFinder::findAllRings(), org::openscience::cdk::fingerprint::MACCSFingerprinter::getFingerprint(), org::openscience::cdk::reaction::mechanism::RemovingSEofBMechanism::initiate(), org::openscience::cdk::reaction::mechanism::RearrangementChargeMechanism::initiate(), org::openscience::cdk::reaction::mechanism::RadicalSiteIonizationMechanism::initiate(), org::openscience::cdk::reaction::mechanism::HomolyticCleavageMechanism::initiate(), org::openscience::cdk::reaction::mechanism::HeterolyticCleavageMechanism::initiate(), and org::openscience::cdk::smiles::SmilesParser::parseReactionSmiles().

                                                                                    {
            IAtomContainer newContainer = atomContainer.getBuilder().newAtomContainer();
            IMolecule molecule;
            IMoleculeSet molecules = atomContainer.getBuilder().newMoleculeSet();
            List<IAtom> sphere = new ArrayList<IAtom>();

        for (IAtom atom : atomContainer.atoms()) {
            atom.setFlag(CDKConstants.VISITED, false);
            newContainer.addAtom(atom);
        }

        for (IBond bond : atomContainer.bonds()) {
            bond.setFlag(CDKConstants.VISITED, false);
            newContainer.addBond(bond);
        }

        for (IElectronContainer eContainer : atomContainer.electronContainers()) {
            eContainer.setFlag(CDKConstants.VISITED, false);
            newContainer.addElectronContainer(eContainer);
        }

        while(newContainer.getAtomCount() > 0) {
                  IAtom atom = newContainer.getAtom(0);
                  molecule = atomContainer.getBuilder().newMolecule();
                  sphere.clear();
                  sphere.add(atom);
                  atom.setFlag(CDKConstants.VISITED, true);
                  PathTools.breadthFirstSearch(newContainer, sphere, molecule);
                  molecules.addMolecule(molecule);
                  newContainer.remove(molecule);
            }
            return molecules;
      }

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