Search in sources :

Example 1 with IReactionProcess

use of org.openscience.cdk.reaction.IReactionProcess in project cdk by cdk.

the class RadicalSiteRrBetaReactionTest method testInitiate_IAtomContainerSet_IAtomContainerSet.

/**
 * A unit test suite for JUnit. Reaction:
 * Manually put of the center active.
 */
@Test
@Override
public void testInitiate_IAtomContainerSet_IAtomContainerSet() throws Exception {
    IReactionProcess type = new RadicalSiteRrBetaReaction();
    IAtomContainerSet setOfReactants = getExampleReactants();
    IAtomContainer molecule = setOfReactants.getAtomContainer(0);
    /* initiate */
    molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true);
    molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true);
    molecule.getAtom(4).setFlag(CDKConstants.REACTIVE_CENTER, true);
    molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true);
    List<IParameterReact> paramList = new ArrayList<>();
    IParameterReact param = new SetReactionCenter();
    param.setParameter(Boolean.TRUE);
    paramList.add(param);
    type.setParameterList(paramList);
    IReactionSet setOfReactions = type.initiate(setOfReactants, null);
    Assert.assertEquals(1, setOfReactions.getReactionCount());
    Assert.assertEquals(1, setOfReactions.getReaction(0).getProductCount());
    IAtomContainer product = setOfReactions.getReaction(0).getProducts().getAtomContainer(0);
    IAtomContainer molecule2 = getExpectedProducts().getAtomContainer(0);
    assertEquals(molecule2, product);
}
Also used : IReactionProcess(org.openscience.cdk.reaction.IReactionProcess) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IReactionSet(org.openscience.cdk.interfaces.IReactionSet) IAtomContainerSet(org.openscience.cdk.interfaces.IAtomContainerSet) IParameterReact(org.openscience.cdk.reaction.type.parameters.IParameterReact) ArrayList(java.util.ArrayList) SetReactionCenter(org.openscience.cdk.reaction.type.parameters.SetReactionCenter) Test(org.junit.Test) ReactionProcessTest(org.openscience.cdk.reaction.ReactionProcessTest)

Example 2 with IReactionProcess

use of org.openscience.cdk.reaction.IReactionProcess in project cdk by cdk.

the class RadicalSiteRrDeltaReactionTest method testCDKConstants_REACTIVE_CENTER.

/**
 * A unit test suite for JUnit.
 */
@Test
public void testCDKConstants_REACTIVE_CENTER() throws Exception {
    IReactionProcess type = new RadicalSiteRrDeltaReaction();
    IAtomContainerSet setOfReactants = getExampleReactants();
    IAtomContainer molecule = setOfReactants.getAtomContainer(0);
    /* manually put the reactive center */
    molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true);
    molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true);
    molecule.getAtom(6).setFlag(CDKConstants.REACTIVE_CENTER, true);
    molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true);
    List<IParameterReact> paramList = new ArrayList<>();
    IParameterReact param = new SetReactionCenter();
    param.setParameter(Boolean.TRUE);
    paramList.add(param);
    type.setParameterList(paramList);
    /* initiate */
    IReactionSet setOfReactions = type.initiate(setOfReactants, null);
    Assert.assertEquals(1, setOfReactions.getReactionCount());
    IAtomContainer reactant = setOfReactions.getReaction(0).getReactants().getAtomContainer(0);
    Assert.assertTrue(molecule.getAtom(0).getFlag(CDKConstants.REACTIVE_CENTER));
    Assert.assertTrue(reactant.getAtom(0).getFlag(CDKConstants.REACTIVE_CENTER));
    Assert.assertTrue(molecule.getAtom(1).getFlag(CDKConstants.REACTIVE_CENTER));
    Assert.assertTrue(reactant.getAtom(1).getFlag(CDKConstants.REACTIVE_CENTER));
    Assert.assertTrue(molecule.getAtom(6).getFlag(CDKConstants.REACTIVE_CENTER));
    Assert.assertTrue(reactant.getAtom(6).getFlag(CDKConstants.REACTIVE_CENTER));
    Assert.assertTrue(molecule.getBond(0).getFlag(CDKConstants.REACTIVE_CENTER));
    Assert.assertTrue(reactant.getBond(0).getFlag(CDKConstants.REACTIVE_CENTER));
}
Also used : IReactionProcess(org.openscience.cdk.reaction.IReactionProcess) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IReactionSet(org.openscience.cdk.interfaces.IReactionSet) IAtomContainerSet(org.openscience.cdk.interfaces.IAtomContainerSet) IParameterReact(org.openscience.cdk.reaction.type.parameters.IParameterReact) ArrayList(java.util.ArrayList) SetReactionCenter(org.openscience.cdk.reaction.type.parameters.SetReactionCenter) Test(org.junit.Test) ReactionProcessTest(org.openscience.cdk.reaction.ReactionProcessTest)

Example 3 with IReactionProcess

use of org.openscience.cdk.reaction.IReactionProcess in project cdk by cdk.

the class RadicalSiteRrDeltaReactionTest method testRadicalSiteRrDeltaReaction.

/**
 *  The JUnit setup method
 */
@Test
public void testRadicalSiteRrDeltaReaction() throws Exception {
    IReactionProcess type = new RadicalSiteRrDeltaReaction();
    Assert.assertNotNull(type);
}
Also used : IReactionProcess(org.openscience.cdk.reaction.IReactionProcess) Test(org.junit.Test) ReactionProcessTest(org.openscience.cdk.reaction.ReactionProcessTest)

Example 4 with IReactionProcess

use of org.openscience.cdk.reaction.IReactionProcess in project cdk by cdk.

the class RadicalSiteRrDeltaReactionTest method testInitiate_IAtomContainerSet_IAtomContainerSet.

/**
 * A unit test suite for JUnit. Reaction:
 * Manually put of the center active.
 */
@Test
@Override
public void testInitiate_IAtomContainerSet_IAtomContainerSet() throws Exception {
    IReactionProcess type = new RadicalSiteRrDeltaReaction();
    IAtomContainerSet setOfReactants = getExampleReactants();
    IAtomContainer molecule = setOfReactants.getAtomContainer(0);
    /* initiate */
    molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true);
    molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true);
    molecule.getAtom(6).setFlag(CDKConstants.REACTIVE_CENTER, true);
    molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true);
    List<IParameterReact> paramList = new ArrayList<>();
    IParameterReact param = new SetReactionCenter();
    param.setParameter(Boolean.TRUE);
    paramList.add(param);
    type.setParameterList(paramList);
    IReactionSet setOfReactions = type.initiate(setOfReactants, null);
    Assert.assertEquals(1, setOfReactions.getReactionCount());
    Assert.assertEquals(1, setOfReactions.getReaction(0).getProductCount());
    IAtomContainer product = setOfReactions.getReaction(0).getProducts().getAtomContainer(0);
    IAtomContainer molecule2 = getExpectedProducts().getAtomContainer(0);
    assertEquals(molecule2, product);
}
Also used : IReactionProcess(org.openscience.cdk.reaction.IReactionProcess) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IReactionSet(org.openscience.cdk.interfaces.IReactionSet) IAtomContainerSet(org.openscience.cdk.interfaces.IAtomContainerSet) IParameterReact(org.openscience.cdk.reaction.type.parameters.IParameterReact) ArrayList(java.util.ArrayList) SetReactionCenter(org.openscience.cdk.reaction.type.parameters.SetReactionCenter) Test(org.junit.Test) ReactionProcessTest(org.openscience.cdk.reaction.ReactionProcessTest)

Example 5 with IReactionProcess

use of org.openscience.cdk.reaction.IReactionProcess in project cdk by cdk.

the class RadicalSiteRrGammaReactionTest method testRadicalSiteRrGammaReaction.

/**
 *  The JUnit setup method
 */
@Test
public void testRadicalSiteRrGammaReaction() throws Exception {
    IReactionProcess type = new RadicalSiteRrGammaReaction();
    Assert.assertNotNull(type);
}
Also used : IReactionProcess(org.openscience.cdk.reaction.IReactionProcess) Test(org.junit.Test) ReactionProcessTest(org.openscience.cdk.reaction.ReactionProcessTest)

Aggregations

IReactionProcess (org.openscience.cdk.reaction.IReactionProcess)203 Test (org.junit.Test)197 ReactionProcessTest (org.openscience.cdk.reaction.ReactionProcessTest)192 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)166 IAtomContainerSet (org.openscience.cdk.interfaces.IAtomContainerSet)166 ArrayList (java.util.ArrayList)165 IParameterReact (org.openscience.cdk.reaction.type.parameters.IParameterReact)163 SetReactionCenter (org.openscience.cdk.reaction.type.parameters.SetReactionCenter)163 IReactionSet (org.openscience.cdk.interfaces.IReactionSet)162 IAtom (org.openscience.cdk.interfaces.IAtom)91 IQueryAtomContainer (org.openscience.cdk.isomorphism.matchers.IQueryAtomContainer)45 UniversalIsomorphismTester (org.openscience.cdk.isomorphism.UniversalIsomorphismTester)31 QueryAtomContainer (org.openscience.cdk.isomorphism.matchers.QueryAtomContainer)30 ISingleElectron (org.openscience.cdk.interfaces.ISingleElectron)17 SlowTest (org.openscience.cdk.test.SlowTest)5 LonePair (org.openscience.cdk.LonePair)3 CDKException (org.openscience.cdk.exception.CDKException)3 HyperconjugationReaction (org.openscience.cdk.reaction.type.HyperconjugationReaction)3 PiBondingMovementReaction (org.openscience.cdk.reaction.type.PiBondingMovementReaction)3 IBond (org.openscience.cdk.interfaces.IBond)2