use of org.openscience.cdk.reaction.type.parameters.IParameterReact 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);
}
use of org.openscience.cdk.reaction.type.parameters.IParameterReact 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));
}
use of org.openscience.cdk.reaction.type.parameters.IParameterReact 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);
}
use of org.openscience.cdk.reaction.type.parameters.IParameterReact in project cdk by cdk.
the class RadicalSiteRrGammaReactionTest method testMapping.
/**
* A unit test suite for JUnit.
*/
@Test
public void testMapping() throws Exception {
IReactionProcess type = new RadicalSiteRrGammaReaction();
IAtomContainerSet setOfReactants = getExampleReactants();
IAtomContainer molecule = setOfReactants.getAtomContainer(0);
/* automatic search of the center active */
molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true);
molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true);
molecule.getAtom(5).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);
IAtomContainer product = setOfReactions.getReaction(0).getProducts().getAtomContainer(0);
Assert.assertEquals(22, setOfReactions.getReaction(0).getMappingCount());
IAtom mappedProductA1 = (IAtom) ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(0), molecule.getAtom(0));
Assert.assertEquals(mappedProductA1, product.getAtom(0));
IAtom mappedProductA2 = (IAtom) ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(0), molecule.getAtom(1));
Assert.assertEquals(mappedProductA2, product.getAtom(1));
IAtom mappedProductA3 = (IAtom) ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(0), molecule.getAtom(5));
Assert.assertEquals(mappedProductA3, product.getAtom(5));
}
use of org.openscience.cdk.reaction.type.parameters.IParameterReact in project cdk by cdk.
the class RadicalSiteRrGammaReactionTest 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 RadicalSiteRrGammaReaction();
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(5).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);
}
Aggregations