From: <mig...@us...> - 2008-02-13 20:25:41
|
Revision: 10090 http://cdk.svn.sourceforge.net/cdk/?rev=10090&view=rev Author: miguelrojasch Date: 2008-02-13 12:25:20 -0800 (Wed, 13 Feb 2008) Log Message: ----------- changed the name of Adduction to AdductionLP which specifies more specific according to adduction from LonePair orbitals. Modified Paths: -------------- branches/miguelrojasch/reaction/src/org/openscience/cdk/test/reaction/type/AdductionProtonReactionTest.java branches/miguelrojasch/reaction/src/org/openscience/cdk/test/reaction/type/AdductionSodiumReactionTest.java Added Paths: ----------- branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/mechanism/AdductionLPMechanism.java branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionProtonLPReaction.java branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionSodiumLPReaction.java Removed Paths: ------------- branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/mechanism/AdductionMechanism.java branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionProtonReaction.java branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionSodiumReaction.java Copied: branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/mechanism/AdductionLPMechanism.java (from rev 10089, branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/mechanism/AdductionMechanism.java) =================================================================== --- branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/mechanism/AdductionLPMechanism.java (rev 0) +++ branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/mechanism/AdductionLPMechanism.java 2008-02-13 20:25:20 UTC (rev 10090) @@ -0,0 +1,135 @@ +/* $Revision: 8418 $ $Author: egonw $ $Date: 2007-06-25 22:05:44 +0200 (Mon, 25 Jun 2007) $ + * + * Copyright (C) 2008 Miguel Rojas <mig...@ya...> + * + * Contact: cdk...@li... + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.openscience.cdk.reaction.mechanism; + +import java.util.ArrayList; +import java.util.List; + +import org.openscience.cdk.DefaultChemObjectBuilder; +import org.openscience.cdk.atomtype.CDKAtomTypeMatcher; +import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.interfaces.IAtom; +import org.openscience.cdk.interfaces.IAtomContainer; +import org.openscience.cdk.interfaces.IAtomType; +import org.openscience.cdk.interfaces.IBond; +import org.openscience.cdk.interfaces.ILonePair; +import org.openscience.cdk.interfaces.IMapping; +import org.openscience.cdk.interfaces.IMolecule; +import org.openscience.cdk.interfaces.IMoleculeSet; +import org.openscience.cdk.interfaces.IReaction; +import org.openscience.cdk.nonotify.NoNotificationChemObjectBuilder; +import org.openscience.cdk.reaction.IReactionMechanism; +import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; + +/** + * <p>This mechanism adduct together two fragments. The second fragment will be deficient in charge. + * It returns the reaction mechanism which has been cloned the IMolecule.</p> + * <p>This reaction could be represented as A + [B+] => A-B</p> + * + * + * @author miguelrojasch + * @cdk.created 2008-02-10 + * @cdk.module reaction + * + */ +public class AdductionLPMechanism implements IReactionMechanism{ + + private CDKAtomTypeMatcher atMatcher; + + /** + * Constructor of the AdductionLPMechanism object. + * + */ + public AdductionLPMechanism(){ + atMatcher = CDKAtomTypeMatcher.getInstance( + NoNotificationChemObjectBuilder.getInstance(), + CDKAtomTypeMatcher.REQUIRE_EXPLICIT_HYDROGENS + ); + } + + /** + * Initiates the process for the given mechanism. The atoms and bonds to apply are mapped between + * reactants and products. + * + * @param moleculeSet The IMolecule to apply the mechanism + * @param atomList The list of atoms taking part in the mechanism. Only allowed two atoms. + * @param bondList The list of bonds taking part in the mechanism. not allowed bonds. + * + * @return The Reaction mechanism + * + */ + public IReaction initiate(IMoleculeSet moleculeSet, ArrayList<IAtom> atomList,ArrayList<IBond> bondList) throws CDKException { + if (moleculeSet.getMoleculeCount() != 2) { + throw new CDKException("TautomerizationMechanism expects two IMolecule's"); + } + if (atomList.size() != 2) { + throw new CDKException("TautomerizationMechanism expects two atoms in the ArrayList"); + } + if (bondList != null) { + throw new CDKException("TautomerizationMechanism don't expect bonds in the ArrayList"); + } + IMolecule molecule = moleculeSet.getMolecule(0); + IMolecule reactantCloned; + try { + reactantCloned = (IMolecule) moleculeSet.getMolecule(0).clone(); + reactantCloned.add((IAtomContainer) moleculeSet.getMolecule(1).clone()); + } catch (CloneNotSupportedException e) { + throw new CDKException("Could not clone IMolecule!", e); + } + IAtom atom1 = atomList.get(0);// Atom 1: excess in charge + int posAtom1 = moleculeSet.getMolecule(0).getAtomNumber(atom1); + IAtom atom2 = atomList.get(1);// Atom 2: deficient in charge + int posAtom2 = moleculeSet.getMolecule(1).getAtomNumber(atom2)+moleculeSet.getMolecule(0).getAtomCount(); + + IBond newBond = molecule.getBuilder().newBond(reactantCloned.getAtom(posAtom1), reactantCloned.getAtom(posAtom2), IBond.Order.SINGLE); + reactantCloned.addBond(newBond); + + int charge = reactantCloned.getAtom(posAtom1).getFormalCharge(); + reactantCloned.getAtom(posAtom1).setFormalCharge(charge+1); + List<ILonePair> lps = reactantCloned.getConnectedLonePairsList(reactantCloned.getAtom(posAtom1)); + reactantCloned.removeLonePair(lps.get(lps.size() - 1)); + reactantCloned.getAtom(posAtom1).setHybridization(null); + AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(reactantCloned); + IAtomType type = atMatcher.findMatchingAtomType(reactantCloned, reactantCloned.getAtom(posAtom1)); + if (type == null) return null; + + charge = reactantCloned.getAtom(posAtom2).getFormalCharge(); + reactantCloned.getAtom(posAtom2).setFormalCharge(charge-1); + reactantCloned.getAtom(posAtom2).setHybridization(null); + AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(reactantCloned); + type = atMatcher.findMatchingAtomType(reactantCloned, reactantCloned.getAtom(posAtom2)); + if (type == null) return null; + + IReaction reaction = DefaultChemObjectBuilder.getInstance().newReaction(); + reaction.addReactant(molecule); + + /* mapping */ + IMapping mapping = DefaultChemObjectBuilder.getInstance().newMapping(atom1, reactantCloned.getAtom(posAtom1)); + reaction.addMapping(mapping); + mapping = DefaultChemObjectBuilder.getInstance().newMapping(atom2, reactantCloned.getAtom(posAtom2)); + reaction.addMapping(mapping); + + reaction.addProduct(reactantCloned); + + return reaction; + } + +} Deleted: branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/mechanism/AdductionMechanism.java =================================================================== --- branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/mechanism/AdductionMechanism.java 2008-02-13 20:03:59 UTC (rev 10089) +++ branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/mechanism/AdductionMechanism.java 2008-02-13 20:25:20 UTC (rev 10090) @@ -1,135 +0,0 @@ -/* $Revision: 8418 $ $Author: egonw $ $Date: 2007-06-25 22:05:44 +0200 (Mon, 25 Jun 2007) $ - * - * Copyright (C) 2008 Miguel Rojas <mig...@ya...> - * - * Contact: cdk...@li... - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - */ -package org.openscience.cdk.reaction.mechanism; - -import java.util.ArrayList; -import java.util.List; - -import org.openscience.cdk.DefaultChemObjectBuilder; -import org.openscience.cdk.atomtype.CDKAtomTypeMatcher; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.interfaces.IAtom; -import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.interfaces.IAtomType; -import org.openscience.cdk.interfaces.IBond; -import org.openscience.cdk.interfaces.ILonePair; -import org.openscience.cdk.interfaces.IMapping; -import org.openscience.cdk.interfaces.IMolecule; -import org.openscience.cdk.interfaces.IMoleculeSet; -import org.openscience.cdk.interfaces.IReaction; -import org.openscience.cdk.nonotify.NoNotificationChemObjectBuilder; -import org.openscience.cdk.reaction.IReactionMechanism; -import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; - -/** - * <p>This mechanism adduct together two fragments. The second fragment will be deficient in charge. - * It returns the reaction mechanism which has been cloned the IMolecule.</p> - * <p>This reaction could be represented as A + [B+] => A-B</p> - * - * - * @author miguelrojasch - * @cdk.created 2008-02-10 - * @cdk.module reaction - * - */ -public class AdductionMechanism implements IReactionMechanism{ - - private CDKAtomTypeMatcher atMatcher; - - /** - * Constructor of the AdductionMechanism object. - * - */ - public AdductionMechanism(){ - atMatcher = CDKAtomTypeMatcher.getInstance( - NoNotificationChemObjectBuilder.getInstance(), - CDKAtomTypeMatcher.REQUIRE_EXPLICIT_HYDROGENS - ); - } - - /** - * Initiates the process for the given mechanism. The atoms and bonds to apply are mapped between - * reactants and products. - * - * @param moleculeSet The IMolecule to apply the mechanism - * @param atomList The list of atoms taking part in the mechanism. Only allowed two atoms. - * @param bondList The list of bonds taking part in the mechanism. not allowed bonds. - * - * @return The Reaction mechanism - * - */ - public IReaction initiate(IMoleculeSet moleculeSet, ArrayList<IAtom> atomList,ArrayList<IBond> bondList) throws CDKException { - if (moleculeSet.getMoleculeCount() != 2) { - throw new CDKException("TautomerizationMechanism expects two IMolecule's"); - } - if (atomList.size() != 2) { - throw new CDKException("TautomerizationMechanism expects two atoms in the ArrayList"); - } - if (bondList != null) { - throw new CDKException("TautomerizationMechanism don't expect bonds in the ArrayList"); - } - IMolecule molecule = moleculeSet.getMolecule(0); - IMolecule reactantCloned; - try { - reactantCloned = (IMolecule) moleculeSet.getMolecule(0).clone(); - reactantCloned.add((IAtomContainer) moleculeSet.getMolecule(1).clone()); - } catch (CloneNotSupportedException e) { - throw new CDKException("Could not clone IMolecule!", e); - } - IAtom atom1 = atomList.get(0);// Atom 1: excess in charge - int posAtom1 = moleculeSet.getMolecule(0).getAtomNumber(atom1); - IAtom atom2 = atomList.get(1);// Atom 2: deficient in charge - int posAtom2 = moleculeSet.getMolecule(1).getAtomNumber(atom2)+moleculeSet.getMolecule(0).getAtomCount(); - - IBond newBond = molecule.getBuilder().newBond(reactantCloned.getAtom(posAtom1), reactantCloned.getAtom(posAtom2), IBond.Order.SINGLE); - reactantCloned.addBond(newBond); - - int charge = reactantCloned.getAtom(posAtom1).getFormalCharge(); - reactantCloned.getAtom(posAtom1).setFormalCharge(charge+1); - List<ILonePair> lps = reactantCloned.getConnectedLonePairsList(reactantCloned.getAtom(posAtom1)); - reactantCloned.removeLonePair(lps.get(lps.size() - 1)); - reactantCloned.getAtom(posAtom1).setHybridization(null); - AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(reactantCloned); - IAtomType type = atMatcher.findMatchingAtomType(reactantCloned, reactantCloned.getAtom(posAtom1)); - if (type == null) return null; - - charge = reactantCloned.getAtom(posAtom2).getFormalCharge(); - reactantCloned.getAtom(posAtom2).setFormalCharge(charge-1); - reactantCloned.getAtom(posAtom2).setHybridization(null); - AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(reactantCloned); - type = atMatcher.findMatchingAtomType(reactantCloned, reactantCloned.getAtom(posAtom2)); - if (type == null) return null; - - IReaction reaction = DefaultChemObjectBuilder.getInstance().newReaction(); - reaction.addReactant(molecule); - - /* mapping */ - IMapping mapping = DefaultChemObjectBuilder.getInstance().newMapping(atom1, reactantCloned.getAtom(posAtom1)); - reaction.addMapping(mapping); - mapping = DefaultChemObjectBuilder.getInstance().newMapping(atom2, reactantCloned.getAtom(posAtom2)); - reaction.addMapping(mapping); - - reaction.addProduct(reactantCloned); - - return reaction; - } - -} Copied: branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionProtonLPReaction.java (from rev 10088, branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionProtonReaction.java) =================================================================== --- branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionProtonLPReaction.java (rev 0) +++ branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionProtonLPReaction.java 2008-02-13 20:25:20 UTC (rev 10090) @@ -0,0 +1,236 @@ +/* + * $RCSfile$ + * $Author: egonw $ + * $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $ + * $Revision: 5855 $ + * + * Copyright (C) 2006-2007 Miguel Rojas <mig...@un...> + * + * Contact: cdk...@li... + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.openscience.cdk.reaction.type; + + +import java.util.ArrayList; +import java.util.Iterator; + +import org.openscience.cdk.CDKConstants; +import org.openscience.cdk.DefaultChemObjectBuilder; +import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.interfaces.IAtom; +import org.openscience.cdk.interfaces.IMolecule; +import org.openscience.cdk.interfaces.IMoleculeSet; +import org.openscience.cdk.interfaces.IReaction; +import org.openscience.cdk.interfaces.IReactionSet; +import org.openscience.cdk.reaction.IReactionMechanism; +import org.openscience.cdk.reaction.IReactionProcess; +import org.openscience.cdk.reaction.ReactionSpecification; +import org.openscience.cdk.reaction.mechanism.AdductionLPMechanism; +import org.openscience.cdk.tools.LoggingTool; + +/** + * <p>IReactionProcess which produces a protonation. + * As most commonly encountered, this reaction results in the formal migration + * of a hydrogen atom or proton, accompanied by a switch of a single bond and adjacent double bond</p> + * + * <pre>[X-] + [H+] => X -H</pre> + * <pre>|X + [H+] => [X+]-H</pre> + * + * <p>Below you have an example how to initiate the mechanism.</p> + * <p>It is processed by the AdductionLPMechanism class</p> + * <pre> + * IMoleculeSet setOfReactants = DefaultChemObjectBuilder.getInstance().newMoleculeSet(); + * setOfReactants.addMolecule(new Molecule()); + * IReactionProcess type = new AdductionProtonLPReaction(); + * Object[] params = {Boolean.FALSE}; + type.setParameters(params); + * IReactionSet setOfReactions = type.initiate(setOfReactants, null); + * </pre> + * + * <p>We have the possibility to localize the reactive center. Good method if you + * want to specify the reaction in a fixed point.</p> + * <pre>atoms[0].setFlag(CDKConstants.REACTIVE_CENTER,true);</pre> + * <p>Moreover you must put the parameter Boolean.TRUE</p> + * <p>If the reactive center is not specified then the reaction process will + * try to find automatically the possible reaction centers.</p> + * + * + * @author Miguel Rojas + * + * @cdk.created 2008-02-11 + * @cdk.module reaction + * @cdk.set reaction-types + * + * @see AdductionLPMechanism + **/ +public class AdductionProtonLPReaction implements IReactionProcess{ + private LoggingTool logger; + private boolean hasActiveCenter; + private IReactionMechanism mechanism; + + /** + * Constructor of the AdductionProtonLPReaction object. + * + */ + public AdductionProtonLPReaction(){ + logger = new LoggingTool(this); + mechanism = new AdductionLPMechanism(); + } + + /** + * Gets the specification attribute of the AdductionProtonLPReaction object. + * + *@return The specification value + */ + public ReactionSpecification getSpecification() { + return new ReactionSpecification( + "http://almost.cubic.uni-koeln.de/jrg/Members/mrc/reactionDict/reactionDict#ProtonationReaction", + this.getClass().getName(), + "$Id: AdductionProtonLPReaction.java,v 1.6 2006/04/01 08:26:47 mrc Exp $", + "The Chemistry Development Kit"); + } + + /** + * Sets the parameters attribute of the AdductionProtonLPReaction object. + * + * @param params The parameter is if the molecule has already fixed the center active or not. It + * should be set before to initiate the reaction with a setFlag: CDKConstants.REACTIVE_CENTER + *@exception CDKException Description of the Exception + */ + public void setParameters(Object[] params) throws CDKException { + if (params.length > 1) { + throw new CDKException("AdductionProtonLPReaction only expects one parameter"); + } + if (!(params[0] instanceof Boolean)) { + throw new CDKException("The parameter 1 must be of type boolean"); + } + hasActiveCenter = ((Boolean) params[0]).booleanValue(); + } + + + /** + * Gets the parameters attribute of the AdductionProtonLPReaction object. + * + *@return The parameters value + */ + public Object[] getParameters() { + Object[] params = new Object[1]; + params[0] = new Boolean (hasActiveCenter); + return params; + } + + /** + * Initiate process. + * It is needed to call the addExplicitHydrogensToSatisfyValency + * from the class tools.HydrogenAdder. + * + *@param reactants reactants of the reaction + *@param agents agents of the reaction (Must be in this case null) + * + *@exception CDKException Description of the Exception + */ + public IReactionSet initiate(IMoleculeSet reactants, IMoleculeSet agents) throws CDKException{ + + logger.debug("initiate reaction: AdductionProtonLPReaction"); + + if (reactants.getMoleculeCount() != 1) { + throw new CDKException("AdductionProtonLPReaction only expects one reactant"); + } + if (agents != null) { + throw new CDKException("AdductionProtonLPReaction don't expects agents"); + } + + IReactionSet setOfReactions = DefaultChemObjectBuilder.getInstance().newReactionSet(); + IMolecule reactant = reactants.getMolecule(0); + + /* if the parameter hasActiveCenter is not fixed yet, set the active centers*/ + if(!hasActiveCenter){ + setActiveCenters(reactant); + } + + Iterator<IAtom> atoms = reactant.atoms(); + while (atoms.hasNext()) { + IAtom atomi = atoms.next(); // Atom pos 1 + if(atomi.getFlag(CDKConstants.REACTIVE_CENTER) && atomi.getFormalCharge() <= 0 + && reactant.getConnectedLonePairsCount(atomi) > 0 && reactant.getConnectedSingleElectronsCount(atomi) > 0){ + + ArrayList<IAtom> atomList = new ArrayList<IAtom>(); + atomList.add(atomi); + IAtom atomH = reactant.getBuilder().newAtom("H"); + atomH.setFormalCharge(1); + atomList.add(atomH); + + IMoleculeSet moleculeSet = reactant.getBuilder().newMoleculeSet(); + moleculeSet.addMolecule(reactant); + IMolecule adduct = reactant.getBuilder().newMolecule(); + adduct.addAtom(atomH); + moleculeSet.addMolecule(adduct); + + IReaction reaction = mechanism.initiate(moleculeSet, atomList, null); + if(reaction == null) + continue; + else + setOfReactions.addReaction(reaction); + + } + } + + return setOfReactions; + } + /** + * set the active center for this molecule. + * The active center will be those which correspond with X=Y-Z-H. + * <pre> + * [X-] + * </pre> + * + * @param reactant The molecule to set the activity + * @throws CDKException + */ + private void setActiveCenters(IMolecule reactant) throws CDKException { + Iterator<IAtom> atoms = reactant.atoms(); + while (atoms.hasNext()) { + IAtom atomi = atoms.next(); // Atom pos 1 + if(atomi.getFormalCharge() <= 0 && reactant.getConnectedLonePairsCount(atomi) > 0 + && reactant.getConnectedSingleElectronsCount(atomi) > 0){ + atomi.setFlag(CDKConstants.REACTIVE_CENTER, true); + + } + } + } + /** + * Gets the parameterNames attribute of the AdductionProtonLPReaction object. + * + *@return The parameterNames value + */ + public String[] getParameterNames() { + String[] params = new String[1]; + params[0] = "hasActiveCenter"; + return params; + } + + + /** + * Gets the parameterType attribute of the AdductionProtonLPReaction object. + * + *@param name Description of the Parameter + *@return The parameterType value + */ + public Object getParameterType(String name) { + return new Boolean(false); + } +} Deleted: branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionProtonReaction.java =================================================================== --- branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionProtonReaction.java 2008-02-13 20:03:59 UTC (rev 10089) +++ branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionProtonReaction.java 2008-02-13 20:25:20 UTC (rev 10090) @@ -1,235 +0,0 @@ -/* - * $RCSfile$ - * $Author: egonw $ - * $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $ - * $Revision: 5855 $ - * - * Copyright (C) 2006-2007 Miguel Rojas <mig...@un...> - * - * Contact: cdk...@li... - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - */ -package org.openscience.cdk.reaction.type; - - -import java.util.ArrayList; -import java.util.Iterator; - -import org.openscience.cdk.CDKConstants; -import org.openscience.cdk.DefaultChemObjectBuilder; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.interfaces.IAtom; -import org.openscience.cdk.interfaces.IMolecule; -import org.openscience.cdk.interfaces.IMoleculeSet; -import org.openscience.cdk.interfaces.IReaction; -import org.openscience.cdk.interfaces.IReactionSet; -import org.openscience.cdk.reaction.IReactionMechanism; -import org.openscience.cdk.reaction.IReactionProcess; -import org.openscience.cdk.reaction.ReactionSpecification; -import org.openscience.cdk.reaction.mechanism.AdductionMechanism; -import org.openscience.cdk.tools.LoggingTool; - -/** - * <p>IReactionProcess which produces a protonation. - * As most commonly encountered, this reaction results in the formal migration - * of a hydrogen atom or proton, accompanied by a switch of a single bond and adjacent double bond</p> - * - * <pre>[X-] + [H+] => X -H</pre> - * <pre>|X + [H+] => [X+]-H</pre> - * - * <p>Below you have an example how to initiate the mechanism.</p> - * <p>It is processed by the AdductionMechanism class</p> - * <pre> - * IMoleculeSet setOfReactants = DefaultChemObjectBuilder.getInstance().newMoleculeSet(); - * setOfReactants.addMolecule(new Molecule()); - * IReactionProcess type = new AdductionProtonReaction(); - * Object[] params = {Boolean.FALSE}; - type.setParameters(params); - * IReactionSet setOfReactions = type.initiate(setOfReactants, null); - * </pre> - * - * <p>We have the possibility to localize the reactive center. Good method if you - * want to specify the reaction in a fixed point.</p> - * <pre>atoms[0].setFlag(CDKConstants.REACTIVE_CENTER,true);</pre> - * <p>Moreover you must put the parameter Boolean.TRUE</p> - * <p>If the reactive center is not specified then the reaction process will - * try to find automatically the possible reaction centers.</p> - * - * - * @author Miguel Rojas - * - * @cdk.created 2008-02-11 - * @cdk.module reaction - * @cdk.set reaction-types - * - * @see AdductionMechanism - **/ -public class AdductionProtonReaction implements IReactionProcess{ - private LoggingTool logger; - private boolean hasActiveCenter; - private IReactionMechanism mechanism; - - /** - * Constructor of the AdductionProtonReaction object. - * - */ - public AdductionProtonReaction(){ - logger = new LoggingTool(this); - mechanism = new AdductionMechanism(); - } - - /** - * Gets the specification attribute of the AdductionProtonReaction object. - * - *@return The specification value - */ - public ReactionSpecification getSpecification() { - return new ReactionSpecification( - "http://almost.cubic.uni-koeln.de/jrg/Members/mrc/reactionDict/reactionDict#ProtonationReaction", - this.getClass().getName(), - "$Id: AdductionProtonReaction.java,v 1.6 2006/04/01 08:26:47 mrc Exp $", - "The Chemistry Development Kit"); - } - - /** - * Sets the parameters attribute of the AdductionProtonReaction object. - * - * @param params The parameter is if the molecule has already fixed the center active or not. It - * should be set before to initiate the reaction with a setFlag: CDKConstants.REACTIVE_CENTER - *@exception CDKException Description of the Exception - */ - public void setParameters(Object[] params) throws CDKException { - if (params.length > 1) { - throw new CDKException("AdductionProtonReaction only expects one parameter"); - } - if (!(params[0] instanceof Boolean)) { - throw new CDKException("The parameter 1 must be of type boolean"); - } - hasActiveCenter = ((Boolean) params[0]).booleanValue(); - } - - - /** - * Gets the parameters attribute of the AdductionProtonReaction object. - * - *@return The parameters value - */ - public Object[] getParameters() { - Object[] params = new Object[1]; - params[0] = new Boolean (hasActiveCenter); - return params; - } - - /** - * Initiate process. - * It is needed to call the addExplicitHydrogensToSatisfyValency - * from the class tools.HydrogenAdder. - * - *@param reactants reactants of the reaction - *@param agents agents of the reaction (Must be in this case null) - * - *@exception CDKException Description of the Exception - */ - public IReactionSet initiate(IMoleculeSet reactants, IMoleculeSet agents) throws CDKException{ - - logger.debug("initiate reaction: AdductionProtonReaction"); - - if (reactants.getMoleculeCount() != 1) { - throw new CDKException("AdductionProtonReaction only expects one reactant"); - } - if (agents != null) { - throw new CDKException("AdductionProtonReaction don't expects agents"); - } - - IReactionSet setOfReactions = DefaultChemObjectBuilder.getInstance().newReactionSet(); - IMolecule reactant = reactants.getMolecule(0); - - /* if the parameter hasActiveCenter is not fixed yet, set the active centers*/ - if(!hasActiveCenter){ - setActiveCenters(reactant); - } - - Iterator<IAtom> atoms = reactant.atoms(); - while (atoms.hasNext()) { - IAtom atomi = atoms.next(); // Atom pos 1 - if(atomi.getFlag(CDKConstants.REACTIVE_CENTER) && atomi.getFormalCharge() <= 0 - && reactant.getConnectedLonePairsCount(atomi) > 0){ - - ArrayList<IAtom> atomList = new ArrayList<IAtom>(); - atomList.add(atomi); - IAtom atomH = reactant.getBuilder().newAtom("H"); - atomH.setFormalCharge(1); - atomList.add(atomH); - - IMoleculeSet moleculeSet = reactant.getBuilder().newMoleculeSet(); - moleculeSet.addMolecule(reactant); - IMolecule adduct = reactant.getBuilder().newMolecule(); - adduct.addAtom(atomH); - moleculeSet.addMolecule(adduct); - - IReaction reaction = mechanism.initiate(moleculeSet, atomList, null); - if(reaction == null) - continue; - else - setOfReactions.addReaction(reaction); - - } - } - - return setOfReactions; - } - /** - * set the active center for this molecule. - * The active center will be those which correspond with X=Y-Z-H. - * <pre> - * [X-] - * </pre> - * - * @param reactant The molecule to set the activity - * @throws CDKException - */ - private void setActiveCenters(IMolecule reactant) throws CDKException { - Iterator<IAtom> atoms = reactant.atoms(); - while (atoms.hasNext()) { - IAtom atomi = atoms.next(); // Atom pos 1 - if(atomi.getFormalCharge() <= 0 && reactant.getConnectedLonePairsCount(atomi) > 0){ - atomi.setFlag(CDKConstants.REACTIVE_CENTER, true); - - } - } - } - /** - * Gets the parameterNames attribute of the AdductionProtonReaction object. - * - *@return The parameterNames value - */ - public String[] getParameterNames() { - String[] params = new String[1]; - params[0] = "hasActiveCenter"; - return params; - } - - - /** - * Gets the parameterType attribute of the AdductionProtonReaction object. - * - *@param name Description of the Parameter - *@return The parameterType value - */ - public Object getParameterType(String name) { - return new Boolean(false); - } -} Copied: branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionSodiumLPReaction.java (from rev 10088, branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionSodiumReaction.java) =================================================================== --- branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionSodiumLPReaction.java (rev 0) +++ branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionSodiumLPReaction.java 2008-02-13 20:25:20 UTC (rev 10090) @@ -0,0 +1,236 @@ +/* + * $RCSfile$ + * $Author: egonw $ + * $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $ + * $Revision: 5855 $ + * + * Copyright (C) 2006-2007 Miguel Rojas <mig...@un...> + * + * Contact: cdk...@li... + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.openscience.cdk.reaction.type; + + +import java.util.ArrayList; +import java.util.Iterator; + +import org.openscience.cdk.CDKConstants; +import org.openscience.cdk.DefaultChemObjectBuilder; +import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.interfaces.IAtom; +import org.openscience.cdk.interfaces.IMolecule; +import org.openscience.cdk.interfaces.IMoleculeSet; +import org.openscience.cdk.interfaces.IReaction; +import org.openscience.cdk.interfaces.IReactionSet; +import org.openscience.cdk.reaction.IReactionMechanism; +import org.openscience.cdk.reaction.IReactionProcess; +import org.openscience.cdk.reaction.ReactionSpecification; +import org.openscience.cdk.reaction.mechanism.AdductionLPMechanism; +import org.openscience.cdk.tools.LoggingTool; + +/** + * <p>IReactionProcess which produces an adduction of the Sodium. + * As most commonly encountered, this reaction results in the formal migration + * of a hydrogen atom or proton, accompanied by a switch of a single bond and adjacent double bond</p> + * + * <pre>[X-] + [Na+] => X -Na</pre> + * <pre>|X + [Na+] => [X+]-Na</pre> + * + * <p>Below you have an example how to initiate the mechanism.</p> + * <p>It is processed by the AdductionLPMechanism class</p> + * <pre> + * IMoleculeSet setOfReactants = DefaultChemObjectBuilder.getInstance().newMoleculeSet(); + * setOfReactants.addMolecule(new Molecule()); + * IReactionProcess type = new AdductionSodiumLPReaction(); + * Object[] params = {Boolean.FALSE}; + type.setParameters(params); + * IReactionSet setOfReactions = type.initiate(setOfReactants, null); + * </pre> + * + * <p>We have the possibility to localize the reactive center. Good method if you + * want to specify the reaction in a fixed point.</p> + * <pre>atoms[0].setFlag(CDKConstants.REACTIVE_CENTER,true);</pre> + * <p>Moreover you must put the parameter Boolean.TRUE</p> + * <p>If the reactive center is not specified then the reaction process will + * try to find automatically the possible reaction centers.</p> + * + * + * @author Miguel Rojas + * + * @cdk.created 2008-02-11 + * @cdk.module reaction + * @cdk.set reaction-types + * + * @see AdductionLPMechanism + **/ +public class AdductionSodiumLPReaction implements IReactionProcess{ + private LoggingTool logger; + private boolean hasActiveCenter; + private IReactionMechanism mechanism; + + /** + * Constructor of the AdductionSodiumLPReaction object. + * + */ + public AdductionSodiumLPReaction(){ + logger = new LoggingTool(this); + mechanism = new AdductionLPMechanism(); + } + + /** + * Gets the specification attribute of the AdductionSodiumLPReaction object. + * + *@return The specification value + */ + public ReactionSpecification getSpecification() { + return new ReactionSpecification( + "http://almost.cubic.uni-koeln.de/jrg/Members/mrc/reactionDict/reactionDict#ProtonationReaction", + this.getClass().getName(), + "$Id: AdductionSodiumLPReaction.java,v 1.6 2006/04/01 08:26:47 mrc Exp $", + "The Chemistry Development Kit"); + } + + /** + * Sets the parameters attribute of the AdductionSodiumLPReaction object. + * + * @param params The parameter is if the molecule has already fixed the center active or not. It + * should be set before to initiate the reaction with a setFlag: CDKConstants.REACTIVE_CENTER + *@exception CDKException Description of the Exception + */ + public void setParameters(Object[] params) throws CDKException { + if (params.length > 1) { + throw new CDKException("AdductionSodiumLPReaction only expects one parameter"); + } + if (!(params[0] instanceof Boolean)) { + throw new CDKException("The parameter 1 must be of type boolean"); + } + hasActiveCenter = ((Boolean) params[0]).booleanValue(); + } + + + /** + * Gets the parameters attribute of the AdductionSodiumLPReaction object. + * + *@return The parameters value + */ + public Object[] getParameters() { + Object[] params = new Object[1]; + params[0] = new Boolean (hasActiveCenter); + return params; + } + + /** + * Initiate process. + * It is needed to call the addExplicitHydrogensToSatisfyValency + * from the class tools.HydrogenAdder. + * + *@param reactants reactants of the reaction + *@param agents agents of the reaction (Must be in this case null) + * + *@exception CDKException Description of the Exception + */ + public IReactionSet initiate(IMoleculeSet reactants, IMoleculeSet agents) throws CDKException{ + + logger.debug("initiate reaction: AdductionSodiumLPReaction"); + + if (reactants.getMoleculeCount() != 1) { + throw new CDKException("AdductionSodiumLPReaction only expects one reactant"); + } + if (agents != null) { + throw new CDKException("AdductionSodiumLPReaction don't expects agents"); + } + + IReactionSet setOfReactions = DefaultChemObjectBuilder.getInstance().newReactionSet(); + IMolecule reactant = reactants.getMolecule(0); + + /* if the parameter hasActiveCenter is not fixed yet, set the active centers*/ + if(!hasActiveCenter){ + setActiveCenters(reactant); + } + + Iterator<IAtom> atoms = reactant.atoms(); + while (atoms.hasNext()) { + IAtom atomi = atoms.next(); // Atom pos 1 + if(atomi.getFlag(CDKConstants.REACTIVE_CENTER) && atomi.getFormalCharge() <= 0 + && reactant.getConnectedLonePairsCount(atomi) > 0 && reactant.getConnectedSingleElectronsCount(atomi) > 0){ + + ArrayList<IAtom> atomList = new ArrayList<IAtom>(); + atomList.add(atomi); + IAtom atomH = reactant.getBuilder().newAtom("Na"); + atomH.setFormalCharge(1); + atomList.add(atomH); + + IMoleculeSet moleculeSet = reactant.getBuilder().newMoleculeSet(); + moleculeSet.addMolecule(reactant); + IMolecule adduct = reactant.getBuilder().newMolecule(); + adduct.addAtom(atomH); + moleculeSet.addMolecule(adduct); + + IReaction reaction = mechanism.initiate(moleculeSet, atomList, null); + if(reaction == null) + continue; + else + setOfReactions.addReaction(reaction); + + } + } + + return setOfReactions; + } + /** + * set the active center for this molecule. + * The active center will be those which correspond with X=Y-Z-Na. + * <pre> + * [X-] + * </pre> + * + * @param reactant The molecule to set the activity + * @throws CDKException + */ + private void setActiveCenters(IMolecule reactant) throws CDKException { + Iterator<IAtom> atoms = reactant.atoms(); + while (atoms.hasNext()) { + IAtom atomi = atoms.next(); // Atom pos 1 + if(atomi.getFormalCharge() <= 0 && reactant.getConnectedLonePairsCount(atomi) > 0 + && reactant.getConnectedSingleElectronsCount(atomi) > 0){ + atomi.setFlag(CDKConstants.REACTIVE_CENTER, true); + + } + } + } + /** + * Gets the parameterNames attribute of the AdductionSodiumLPReaction object. + * + *@return The parameterNames value + */ + public String[] getParameterNames() { + String[] params = new String[1]; + params[0] = "hasActiveCenter"; + return params; + } + + + /** + * Gets the parameterType attribute of the AdductionSodiumLPReaction object. + * + *@param name Description of the Parameter + *@return The parameterType value + */ + public Object getParameterType(String name) { + return new Boolean(false); + } +} Deleted: branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionSodiumReaction.java =================================================================== --- branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionSodiumReaction.java 2008-02-13 20:03:59 UTC (rev 10089) +++ branches/miguelrojasch/reaction/src/org/openscience/cdk/reaction/type/AdductionSodiumReaction.java 2008-02-13 20:25:20 UTC (rev 10090) @@ -1,235 +0,0 @@ -/* - * $RCSfile$ - * $Author: egonw $ - * $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $ - * $Revision: 5855 $ - * - * Copyright (C) 2006-2007 Miguel Rojas <mig...@un...> - * - * Contact: cdk...@li... - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - */ -package org.openscience.cdk.reaction.type; - - -import java.util.ArrayList; -import java.util.Iterator; - -import org.openscience.cdk.CDKConstants; -import org.openscience.cdk.DefaultChemObjectBuilder; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.interfaces.IAtom; -import org.openscience.cdk.interfaces.IMolecule; -import org.openscience.cdk.interfaces.IMoleculeSet; -import org.openscience.cdk.interfaces.IReaction; -import org.openscience.cdk.interfaces.IReactionSet; -import org.openscience.cdk.reaction.IReactionMechanism; -import org.openscience.cdk.reaction.IReactionProcess; -import org.openscience.cdk.reaction.ReactionSpecification; -import org.openscience.cdk.reaction.mechanism.AdductionMechanism; -import org.openscience.cdk.tools.LoggingTool; - -/** - * <p>IReactionProcess which produces an adduction of the Sodium. - * As most commonly encountered, this reaction results in the formal migration - * of a hydrogen atom or proton, accompanied by a switch of a single bond and adjacent double bond</p> - * - * <pre>[X-] + [Na+] => X -Na</pre> - * <pre>|X + [Na+] => [X+]-Na</pre> - * - * <p>Below you have an example how to initiate the mechanism.</p> - * <p>It is processed by the AdductionMechanism class</p> - * <pre> - * IMoleculeSet setOfReactants = DefaultChemObjectBuilder.getInstance().newMoleculeSet(); - * setOfReactants.addMolecule(new Molecule()); - * IReactionProcess type = new AdductionSodiumReaction(); - * Object[] params = {Boolean.FALSE}; - type.setParameters(params); - * IReactionSet setOfReactions = type.initiate(setOfReactants, null); - * </pre> - * - * <p>We have the possibility to localize the reactive center. Good method if you - * want to specify the reaction in a fixed point.</p> - * <pre>atoms[0].setFlag(CDKConstants.REACTIVE_CENTER,true);</pre> - * <p>Moreover you must put the parameter Boolean.TRUE</p> - * <p>If the reactive center is not specified then the reaction process will - * try to find automatically the possible reaction centers.</p> - * - * - * @author Miguel Rojas - * - * @cdk.created 2008-02-11 - * @cdk.module reaction - * @cdk.set reaction-types - * - * @see AdductionMechanism - **/ -public class AdductionSodiumReaction implements IReactionProcess{ - private LoggingTool logger; - private boolean hasActiveCenter; - private IReactionMechanism mechanism; - - /** - * Constructor of the AdductionSodiumReaction object. - * - */ - public AdductionSodiumReaction(){ - logger = new LoggingTool(this); - mechanism = new AdductionMechanism(); - } - - /** - * Gets the specification attribute of the AdductionSodiumReaction object. - * - *@return The specification value - */ - public ReactionSpecification getSpecification() { - return new ReactionSpecification( - "http://almost.cubic.uni-koeln.de/jrg/Members/mrc/reactionDict/reactionDict#ProtonationReaction", - this.getClass().getName(), - "$Id: AdductionSodiumReaction.java,v 1.6 2006/04/01 08:26:47 mrc Exp $", - "The Chemistry Development Kit"); - } - - /** - * Sets the parameters attribute of the AdductionSodiumReaction object. - * - * @param params The parameter is if the molecule has already fixed the center active or not. It - * should be set before to initiate the reaction with a setFlag: CDKConstants.REACTIVE_CENTER - *@exception CDKException Description of the Exception - */ - public void setParameters(Object[] params) throws CDKException { - if (params.length > 1) { - throw new CDKException("AdductionSodiumReaction only expects one parameter"); - } - if (!(params[0] instanceof Boolean)) { - throw new CDKException("The parameter 1 must be of type boolean"); - } - hasActiveCenter = ((Boolean) params[0]).booleanValue(); - } - - - /** - * Gets the parameters attribute of the AdductionSodiumReaction object. - * - *@return The parameters value - */ - public Object[] getParameters() { - Object[] params = new Object[1]; - params[0] = new Boolean (hasActiveCenter); - return params; - } - - /** - * Initiate process. - * It is needed to call the addExplicitHydrogensToSatisfyValency - * from the class tools.HydrogenAdder. - * - *@param reactants reactants of the reaction - *@param agents agents of the reaction (Must be in this case null) - * - *@exception CDKException Description of the Exception - */ - public IReactionSet initiate(IMoleculeSet reactants, IMoleculeSet agents) throws CDKException{ - - logger.debug("initiate reaction: AdductionSodiumReaction"); - - if (reactants.getMoleculeCount() != 1) { - throw new CDKException("AdductionSodiumReaction only expects one reactant"); - } - if (agents != null) { - throw new CDKException("AdductionSodiumReaction don't expects agents"); - } - - IReactionSet setOfReactions = DefaultChemObjectBuilder.getInstance().newReactionSet(); - IMolecule reactant = reactants.getMolecule(0); - - /* if the parameter hasActiveCenter is not fixed yet, set the active centers*/ - if(!hasActiveCenter){ - setActiveCenters(reactant); - } - - Iterator<IAtom> atoms = reactant.atoms(); - while (atoms.hasNext()) { - IAtom atomi = atoms.next(); // Atom pos 1 - if(atomi.getFlag(CDKConstants.REACTIVE_CENTER) && atomi.getFormalCharge() <= 0 - && reactant.getConnectedLonePairsCount(atomi) > 0){ - - ArrayList<IAtom> atomList = new ArrayList<IAtom>(); - atomList.add(atomi); - IAtom atomH = reactant.getBuilder().newAtom("Na"); - atomH.setFormalCharge(1); - atomList.add(atomH); - - IMoleculeSet moleculeSet = reactant.getBuilder().newMoleculeSet(); - moleculeSet.addMolecule(reactant); - IMolecule adduct = reactant.getBuilder().newMolecule(); - adduct.addAtom(atomH); - moleculeSet.addMolecule(adduct); - - IReaction reaction = mechanism.initiate(moleculeSet, atomList, null); - if(reaction == null) - continue; - else - setOfReactions.addReaction(reaction); - - } - } - - return setOfReactions; - } - /** - * set the active center for this molecule. - * The active center will be those which correspond with X=Y-Z-Na. - * <pre> - * [X-] - * </pre> - * - * @param reactant The molecule to set the activity - * @throws CDKException - */ - private void setActiveCenters(IMolecule reactant) throws CDKException { - Iterator<IAtom> atoms = reactant.atoms(); - while (atoms.hasNext()) { - IAtom atomi = atoms.next(); // Atom pos 1 - if(atomi.getFormalCharge() <= 0 && reactant.getConnectedLonePairsCount(atomi) > 0){ - atomi.setFlag(CDKConstants.REACTIVE_CENTER, true); - - } - } - } - /** - * Gets the parameterNames attribute of the AdductionSodiumReaction object. - * - *@return The parameterNames value - */ - public String[] getParameterNames() { - String[] params = new String[1]; - params[0] = "hasActiveCenter"; - return params; - } - - - /** - * Gets the parameterType attribute of the AdductionSodiumReaction object. - * - *@param name Description of the Parameter - *@return The parameterType value - */ - public Object getParameterType(String name) { - return new Boolean(false); - } -} Modified: branches/miguelrojasch/reaction/src/org/openscience/cdk/test/reaction/type/AdductionProtonReactionTest.java =================================================================== --- branches/miguelrojasch/reaction/src/org/openscience/cdk/test/reaction/type/AdductionProtonReactionTest.java 2008-02-13 20:03:59 UTC (rev 10089) +++ branches/miguelrojasch/reaction/src/org/openscience/cdk/test/reaction/type/AdductionProtonReactionTest.java 2008-02-13 20:25:20 UTC (rev 10090) @@ -41,7 +41,7 @@ import org.openscience.cdk.isomorphism.matchers.QueryAtomContainerCreator; import org.openscience.cdk.nonotify.NoNotificationChemObjectBuilder; import org.openscience.cdk.reaction.IReactionProcess; -import org.openscience.cdk.reaction.type.AdductionProtonReaction; +import org.openscience.cdk.reaction.type.AdductionProtonLPReaction; import org.openscience.cdk.test.reaction.ReactionProcessTest; import org.openscience.cdk.tools.LonePairElectronChecker; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; @@ -61,7 +61,7 @@ * The JUnit setup method */ @BeforeClass public static void setUp() throws Exception { - setReaction(AdductionProtonReaction.class); + setReaction(AdductionProtonLPReaction.class); } /** @@ -75,7 +75,7 @@ */ @Test public void testAutomaticCentreActive() throws Exception { - IReactionProcess type = new AdductionProtonReaction(); + IReactionProcess type = new AdductionProtonLPReaction(); IMolecule molecule = getAcetaldehyde(); @@ -108,7 +108,7 @@ * @return The test suite */ @Test public void testManuallyCentreActive() throws Exception { - IReactionProcess type = new AdductionProtonReaction(); + IReactionProcess type = new AdductionProtonLPReaction(); IMolecule molecule = getAcetaldehyde(); IMoleculeSet setOfReactants = DefaultChemObjectBuilder.getInstance().newMoleculeSet(); @@ -140,7 +140,7 @@ * @return The test suite */ @Test public void testCentreActive() throws Exception { - IReactionProcess type = new AdductionProtonReaction(); + IReactionProcess type = new AdductionProtonLPReaction(); Object[] object = type.getParameters(); Assert.assertFalse(((Boolean) object[0]).booleanValue()); @@ -158,7 +158,7 @@ * @return The test suite */ @Test public void testCDKConstants_REACTIVE_CENTER() throws Exception { - IReactionProcess type = new AdductionProtonReaction(); + IReactionProcess type = new AdductionProtonLPReaction(); IMoleculeSet setOfReactants = builder.newMoleculeSet(); IMolecule molecule = getAcetaldehyde(); @@ -203,7 +203,7 @@ * @return The test suite */ @Test public void testMapping() throws Exception { - IReactionProcess type = new AdductionProtonReaction(); + IReactionProcess type = new AdductionProtonLPReaction(); IMoleculeSet setOfReactants = DefaultChemObjectBuilder.getInstance().newMoleculeSet(); IMolecule molecule = getAcetaldehyde(); Modified: branches/miguelrojasch/reaction/src/org/openscience/cdk/test/reaction/type/AdductionSodiumReactionTest.java =================================================================== --- branches/miguelrojasch/reaction/src/org/openscience/cdk/test/reaction/type/AdductionSodiumReactionTest.java 2008-02-13 20:03:59 UTC (rev 10089) +++ branches/miguelrojasch/reaction/src/org/openscience/cdk/test/reaction/type/AdductionSodiumReactionTest.java 2008-02-13 20:25:20 UTC (rev 10090) @@ -41,7 +41,7 @@ import org.openscience.cdk.isomorphism.matchers.QueryAtomContainerCreator; import org.openscience.cdk.nonotify.NoNotificationChemObjectBuilder; import org.openscience.cdk.reaction.IReactionProcess; -import org.openscience.cdk.reaction.type.AdductionSodiumReaction; +import org.openscience.cdk.reaction.type.AdductionSodiumLPReaction; import org.openscience.cdk.test.reaction.ReactionProcessTest; import org.openscience.cdk.tools.LonePairElectronChecker; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; @@ -61,7 +61,7 @@ * The JUnit setup method */ @BeforeClass public static void setUp() throws Exception { - setReaction(AdductionSodiumReaction.class); + setReaction(AdductionSodiumLPReaction.class); } /** @@ -75,7 +75,7 @@ */ @Test public void testAutomaticCentreActive() throws Exception { - IReactionProcess type = new AdductionSodiumReaction(); + IReactionProcess type = new AdductionSodiumLPReaction(); IMolecule molecule = getAcetaldehyde(); @@ -108,7 +108,7 @@ * @return The test suite */ @Test public void testManuallyCentreActive() throws Exception { - IReactionProcess type = new AdductionSodiumReaction(); + IReactionProcess type = new AdductionSodiumLPReaction(); IMolecule molecule = getAcetaldehyde(); IMoleculeSet setOfReactants = DefaultChemObjectBuilder.getInstance().newMoleculeSet(); @@ -140,7 +140,7 @@ * @return The test suite */ @Test public void testCentreActive() throws Exception { - IReactionProcess type = new AdductionSodiumReaction(); + IReactionProcess type = new AdductionSodiumLPReaction(); Object[] object = type.getParameters(); Assert.assertFalse(((Boolean) object[0]).booleanValue()); @@ -158,7 +158,7 @@ * @return The test suite */ @Test public void testCDKConstants_REACTIVE_CENTER() throws Exception { - IReactionProcess type = new AdductionSodiumReaction(); + IReactionProcess type = new AdductionSodiumLPReaction(); IMoleculeSet setOfReactants = builder.newMoleculeSet(); IMolecule molecule = getAcetaldehyde(); @@ -203,7 +203,7 @@ * @return The test suite */ @Test public void testMapping() throws Exception { - IReactionProcess type = new AdductionSodiumReaction(); + IReactionProcess type = new AdductionSodiumLPReaction(); IMoleculeSet setOfReactants = DefaultChemObjectBuilder.getInstance().newMoleculeSet(); IMolecule molecule = getAcetaldehyde(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |