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

IReaction org::openscience::cdk::reaction::mechanism::RadicalSiteIonizationMechanism::initiate ( IMoleculeSet  moleculeSet,
ArrayList< IAtom atomList,
ArrayList< IBond bondList 
) throws CDKException [inline]

Initiates the process for the given mechanism. The atoms to apply are mapped between reactants and products.

Parameters:
moleculeSetThe IMolecule to apply the mechanism
atomListThe list of atoms taking part in the mechanism. Only allowed two atoms. The first atom is the atom which contains the ISingleElectron and the second third is the atom which will be removed the first atom
bondListThe list of bonds taking part in the mechanism. Only allowed one bond. It is the bond which is moved
Returns:
The Reaction mechanism

Implements org::openscience::cdk::reaction::IReactionMechanism.

Definition at line 73 of file RadicalSiteIonizationMechanism.java.

References org::openscience::cdk::interfaces::IReaction::addMapping(), org::openscience::cdk::interfaces::IReaction::addProduct(), org::openscience::cdk::interfaces::IReaction::addReactant(), org::openscience::cdk::interfaces::IAtomContainer::addSingleElectron(), org::openscience::cdk::interfaces::IChemObject::clone(), org::openscience::cdk::atomtype::CDKAtomTypeMatcher::findMatchingAtomType(), org::openscience::cdk::interfaces::IAtomContainer::getAtom(), org::openscience::cdk::interfaces::IAtomContainerSet::getAtomContainerCount(), org::openscience::cdk::interfaces::IAtomContainer::getAtomNumber(), org::openscience::cdk::interfaces::IAtomContainer::getBond(), org::openscience::cdk::interfaces::IAtomContainer::getBondNumber(), org::openscience::cdk::interfaces::IAtomContainer::getConnectedSingleElectronsList(), org::openscience::cdk::interfaces::IMoleculeSet::getMolecule(), org::openscience::cdk::tools::manipulator::BondManipulator::increaseBondOrder(), org::openscience::cdk::DefaultChemObjectBuilder::newMapping(), org::openscience::cdk::DefaultChemObjectBuilder::newReaction(), org::openscience::cdk::graph::ConnectivityChecker::partitionIntoMolecules(), org::openscience::cdk::tools::manipulator::AtomContainerManipulator::percieveAtomTypesAndConfigureAtoms(), org::openscience::cdk::interfaces::IAtomContainer::removeBond(), org::openscience::cdk::interfaces::IAtomContainer::removeSingleElectron(), and org::openscience::cdk::interfaces::IAtomType::setHybridization().

                                                                                                                                   {
            CDKAtomTypeMatcher atMatcher = CDKAtomTypeMatcher.getInstance(moleculeSet.getBuilder());
            if (moleculeSet.getMoleculeCount() != 1) {
                  throw new CDKException("RadicalSiteIonizationMechanism only expects one IMolecule");
            }
            if (atomList.size() != 3) {
                  throw new CDKException("RadicalSiteIonizationMechanism expects three atoms in the ArrayList");
            }
            if (bondList.size() != 2) {
                  throw new CDKException("RadicalSiteIonizationMechanism only expect one bond in the ArrayList");
            }
            IMolecule molecule = moleculeSet.getMolecule(0);
            IMolecule reactantCloned;
            try {
                  reactantCloned = (IMolecule) molecule.clone();
            } catch (CloneNotSupportedException e) {
                  throw new CDKException("Could not clone IMolecule!", e);
            }
            IAtom atom1 = atomList.get(0);// Atom containing the ISingleElectron
            IAtom atom1C = reactantCloned.getAtom(molecule.getAtomNumber(atom1));
            IAtom atom2 = atomList.get(1);// Atom 
            IAtom atom2C = reactantCloned.getAtom(molecule.getAtomNumber(atom2));
            IAtom atom3 = atomList.get(2);// Atom to be saved
            IAtom atom3C = reactantCloned.getAtom(molecule.getAtomNumber(atom3));
            IBond bond1 = bondList.get(0);// Bond to increase the order
            int posBond1 = molecule.getBondNumber(bond1);
            IBond bond2 = bondList.get(1);// Bond to remove
            int posBond2 = molecule.getBondNumber(bond2);
            
            BondManipulator.increaseBondOrder(reactantCloned.getBond(posBond1));
            reactantCloned.removeBond(reactantCloned.getBond(posBond2));
            
      List<ISingleElectron> selectron = reactantCloned.getConnectedSingleElectronsList(atom1C);
            reactantCloned.removeSingleElectron(selectron.get(selectron.size() -1));            
            atom1C.setHybridization(null);
            AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(reactantCloned);
            IAtomType type = atMatcher.findMatchingAtomType(reactantCloned, atom1C);
            if (type == null) return null;
            
            atom2C.setHybridization(null);
            AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(reactantCloned);
            type = atMatcher.findMatchingAtomType(reactantCloned, atom2C);
            if (type == null) return null;
            
            reactantCloned.addSingleElectron(new SingleElectron(atom3C));
            atom3C.setHybridization(null);
            AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(reactantCloned);
            type = atMatcher.findMatchingAtomType(reactantCloned, atom3C);
            if (type == null) return null;
            
            IReaction reaction = DefaultChemObjectBuilder.getInstance().newReaction();
            reaction.addReactant(molecule);
            
            /* mapping */
            IMapping mapping = DefaultChemObjectBuilder.getInstance().newMapping(atom1, atom1C);
        reaction.addMapping(mapping);
        mapping = DefaultChemObjectBuilder.getInstance().newMapping(atom2, atom2C);
        reaction.addMapping(mapping);
        mapping = DefaultChemObjectBuilder.getInstance().newMapping(atom3, atom3C);
        reaction.addMapping(mapping);
        mapping = DefaultChemObjectBuilder.getInstance().newMapping(bond1, reactantCloned.getBond(posBond1));
      reaction.addMapping(mapping);
      
      IMoleculeSet moleculeSetP = ConnectivityChecker.partitionIntoMolecules(reactantCloned);
            for(int z = 0; z < moleculeSetP.getAtomContainerCount() ; z++)
                  reaction.addProduct(moleculeSetP.getMolecule(z));
      
            return reaction;
      }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index