Ejemplo n.º 1
0
        public void TestManuallyCentreActive()
        {
            var type           = new RadicalSiteInitiationHReaction();
            var setOfReactants = GetExampleReactants();
            var molecule       = setOfReactants[0];

            /* initiate */
            MakeSureAtomTypesAreRecognized(molecule);

            /* manually put the reactive center */
            molecule.Atoms[0].IsReactiveCenter = true;
            molecule.Atoms[3].IsReactiveCenter = true;
            molecule.Atoms[4].IsReactiveCenter = true;
            molecule.Bonds[2].IsReactiveCenter = true;
            molecule.Bonds[3].IsReactiveCenter = true;

            var paramList = new List <IParameterReaction>();
            var param     = new SetReactionCenter();

            param.IsSetParameter = true;
            paramList.Add(param);
            type.ParameterList = paramList;
            var setOfReactions = type.Initiate(setOfReactants, null);

            Assert.AreEqual(1, setOfReactions.Count);
            Assert.AreEqual(2, setOfReactions[0].Products.Count);

            var product1 = setOfReactions[0].Products[0];

            /* C=C */
            var molecule1 = GetExpectedProducts()[0];

            var queryAtom = QueryAtomContainerCreator.CreateSymbolAndChargeQueryContainer(product1);

            Assert.IsTrue(new UniversalIsomorphismTester().IsIsomorph(molecule1, queryAtom));

            var product2 = setOfReactions[0].Products[1];

            /* [H*] */
            var molecule2 = GetExpectedProducts()[1];

            queryAtom = QueryAtomContainerCreator.CreateSymbolAndChargeQueryContainer(product2);
            Assert.IsTrue(new UniversalIsomorphismTester().IsIsomorph(molecule2, queryAtom));
        }
Ejemplo n.º 2
0
        public void TestMapping()
        {
            IReactionProcess type         = new RadicalSiteInitiationHReaction();
            var            setOfReactants = GetExampleReactants();
            IAtomContainer molecule       = setOfReactants[0];

            /* initiate */

            /* manually put the reactive center */
            molecule.Atoms[0].IsReactiveCenter = true;
            molecule.Atoms[3].IsReactiveCenter = true;
            molecule.Atoms[4].IsReactiveCenter = true;
            molecule.Bonds[2].IsReactiveCenter = true;
            molecule.Bonds[3].IsReactiveCenter = true;

            var paramList = new List <IParameterReaction>();
            var param     = new SetReactionCenter();

            param.IsSetParameter = true;
            paramList.Add(param);
            type.ParameterList = paramList;
            var setOfReactions = type.Initiate(setOfReactants, null);

            IAtomContainer product = setOfReactions[0].Products[0];

            Assert.AreEqual(7, setOfReactions[0].Mappings.Count);

            IAtom mappedProductA1 = (IAtom)ReactionManipulator.GetMappedChemObject(setOfReactions[0],
                                                                                   molecule.Atoms[0]);

            Assert.AreEqual(mappedProductA1, product.Atoms[0]);
            IAtom mappedProductA2 = (IAtom)ReactionManipulator.GetMappedChemObject(setOfReactions[0],
                                                                                   molecule.Atoms[0]);

            Assert.AreEqual(mappedProductA2, product.Atoms[0]);
            IAtom mappedProductA3 = (IAtom)ReactionManipulator.GetMappedChemObject(setOfReactions[0],
                                                                                   molecule.Atoms[3]);

            Assert.AreEqual(mappedProductA3, product.Atoms[3]);
        }
Ejemplo n.º 3
0
        public override void TestInitiate_IAtomContainerSet_IAtomContainerSet()
        {
            var type           = new RadicalSiteInitiationHReaction();
            var setOfReactants = GetExampleReactants();
            var molecule       = setOfReactants[0];

            /* initiate */
            MakeSureAtomTypesAreRecognized(molecule);

            var paramList = new List <IParameterReaction>();
            var param     = new SetReactionCenter();

            param.IsSetParameter = false;
            paramList.Add(param);
            type.ParameterList = paramList;
            var setOfReactions = type.Initiate(setOfReactants, null);

            Assert.AreEqual(3, setOfReactions.Count);
            Assert.AreEqual(2, setOfReactions[0].Products.Count);

            var product1 = setOfReactions[0].Products[0];

            /* C=C */
            var molecule1 = GetExpectedProducts()[0];

            var queryAtom = QueryAtomContainerCreator.CreateSymbolAndChargeQueryContainer(product1);

            Assert.IsTrue(new UniversalIsomorphismTester().IsIsomorph(molecule1, queryAtom));

            var product2 = setOfReactions[0].Products[1];

            /* [H*] */
            var molecule2 = GetExpectedProducts()[1];

            queryAtom = QueryAtomContainerCreator.CreateSymbolAndChargeQueryContainer(product2);
            Assert.IsTrue(new UniversalIsomorphismTester().IsIsomorph(molecule2, queryAtom));
        }
Ejemplo n.º 4
0
        public void TestCDKConstants_REACTIVE_CENTER()
        {
            var type           = new RadicalSiteInitiationHReaction();
            var setOfReactants = GetExampleReactants();
            var molecule       = setOfReactants[0];

            /* initiate */
            MakeSureAtomTypesAreRecognized(molecule);

            /* manually put the reactive center */
            molecule.Atoms[0].IsReactiveCenter = true;
            molecule.Atoms[3].IsReactiveCenter = true;
            molecule.Atoms[4].IsReactiveCenter = true;
            molecule.Bonds[2].IsReactiveCenter = true;
            molecule.Bonds[3].IsReactiveCenter = true;

            var paramList = new List <IParameterReaction>();
            var param     = new SetReactionCenter();

            param.IsSetParameter = true;
            paramList.Add(param);
            type.ParameterList = paramList;
            var setOfReactions = type.Initiate(setOfReactants, null);

            var reactant = setOfReactions[0].Reactants[0];

            Assert.IsTrue(molecule.Atoms[0].IsReactiveCenter);
            Assert.IsTrue(reactant.Atoms[0].IsReactiveCenter);
            Assert.IsTrue(molecule.Atoms[3].IsReactiveCenter);
            Assert.IsTrue(reactant.Atoms[3].IsReactiveCenter);
            Assert.IsTrue(molecule.Atoms[4].IsReactiveCenter);
            Assert.IsTrue(reactant.Atoms[4].IsReactiveCenter);
            Assert.IsTrue(molecule.Bonds[2].IsReactiveCenter);
            Assert.IsTrue(reactant.Bonds[2].IsReactiveCenter);
            Assert.IsTrue(molecule.Bonds[3].IsReactiveCenter);
            Assert.IsTrue(reactant.Bonds[3].IsReactiveCenter);
        }
Ejemplo n.º 5
0
        public void TestRadicalSiteInitiationHReaction()
        {
            var type = new RadicalSiteInitiationHReaction();

            Assert.IsNotNull(type);
        }