class RadicalSiteInitiationReaction extends ReactionEngine implements IReactionProcess {

    @Override
    public IReactionSet initiate(IAtomContainerSet reactants, IAtomContainerSet agents) throws CDKException {
        logger.debug("initiate reaction: RadicalSiteInitiationReaction");

        if (reactants.getAtomContainerCount() != 1) {
            throw new CDKException("RadicalSiteInitiationReaction only expects one reactant");
        }
        if (agents != null) {
            throw new CDKException("RadicalSiteInitiationReaction don't expects agents");
        }

        IReactionSet setOfReactions = reactants.getBuilder().newInstance(IReactionSet.class);
        IAtomContainer reactant = reactants.getAtomContainer(0);

        /*
         * if the parameter hasActiveCenter is not fixed yet, set the active
         * centers
         */
        IParameterReact ipr = super.getParameterClass(SetReactionCenter.class);
        if (ipr != null && !ipr.isSetParameter()) setActiveCenters(reactant);

        Iterator<IAtom> atoms = reactants.getAtomContainer(0).atoms().iterator();
        while (atoms.hasNext()) {
            IAtom atomi = atoms.next();
            if (atomi.getFlag(CDKConstants.REACTIVE_CENTER) && reactant.getConnectedSingleElectronsCount(atomi) == 1
                    && atomi.getFormalCharge() == 0) {

                Iterator<IBond> bondis = reactant.getConnectedBondsList(atomi).iterator();

                while (bondis.hasNext()) {
                    IBond bondi = bondis.next();

                    if (bondi.getFlag(CDKConstants.REACTIVE_CENTER) && bondi.getOrder() == IBond.Order.SINGLE) {

                        IAtom atomj = bondi.getOther(atomi);
                        if (atomj.getFlag(CDKConstants.REACTIVE_CENTER) && atomj.getFormalCharge() == 0) {

                            Iterator<IBond> bondjs = reactant.getConnectedBondsList(atomj).iterator();
                            while (bondjs.hasNext()) {
                                IBond bondj = bondjs.next();

                                if (bondj.equals(bondi)) continue;

                                if (bondj.getFlag(CDKConstants.REACTIVE_CENTER)
                                        && bondj.getOrder() == IBond.Order.SINGLE) {

                                    IAtom atomk = bondj.getOther(atomj);
                                    if (atomk.getFlag(CDKConstants.REACTIVE_CENTER) && atomk.getSymbol().equals("C")
                                            && atomk.getFormalCharge() == 0) {

                                        ArrayList<IAtom> atomList = new ArrayList<IAtom>();
                                        atomList.add(atomi);
                                        atomList.add(atomj);
                                        atomList.add(atomk);
                                        ArrayList<IBond> bondList = new ArrayList<IBond>();
                                        bondList.add(bondi);
                                        bondList.add(bondj);

                                        IAtomContainerSet moleculeSet = reactant.getBuilder().newInstance(
                                                IAtomContainerSet.class);
                                        moleculeSet.addAtomContainer(reactant);
                                        IReaction reaction = mechanism.initiate(moleculeSet, atomList, bondList);
                                        if (reaction == null)
                                            continue;
                                        else
                                            setOfReactions.addReaction(reaction);

                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return setOfReactions;

    }

    public  RadicalSiteInitiationReaction();

}