Ejemplo n.º 1
0
        public override void TestInitiate_IAtomContainerSet_IAtomContainerSet()
        {
            IReactionProcess type = new SharingChargeDBReaction();

            var            setOfReactants = GetExampleReactants();
            IAtomContainer molecule       = setOfReactants[0];

            /* initiate */

            var paramList = new List <IParameterReaction>();
            var param     = new SetReactionCenter
            {
                IsSetParameter = false
            };

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

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

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

            Assert.AreEqual(1, product.Atoms[1].FormalCharge.Value);
            Assert.AreEqual(0, product.GetConnectedLonePairs(product.Atoms[1]).Count());

            /* C[C+]O| */
            IAtomContainer molecule2 = GetExpectedProducts()[0];

            IQueryAtomContainer queryAtom = QueryAtomContainerCreator.CreateSymbolAndChargeQueryContainer(product);

            Assert.IsTrue(new UniversalIsomorphismTester().IsIsomorph(molecule2, queryAtom));
        }
Ejemplo n.º 2
0
        public void TestCDKConstants_REACTIVE_CENTER()
        {
            IReactionProcess type = new SharingChargeDBReaction();

            var            setOfReactants = GetExampleReactants();
            IAtomContainer molecule       = setOfReactants[0];

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

            var paramList = new List <IParameterReaction>();
            var param     = new SetReactionCenter
            {
                IsSetParameter = true
            };

            paramList.Add(param);
            type.ParameterList = paramList;

            /* initiate */
            var setOfReactions = type.Initiate(setOfReactants, null);

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

            Assert.IsTrue(molecule.Atoms[1].IsReactiveCenter);
            Assert.IsTrue(reactant.Atoms[1].IsReactiveCenter);
            Assert.IsTrue(molecule.Atoms[2].IsReactiveCenter);
            Assert.IsTrue(reactant.Atoms[2].IsReactiveCenter);
            Assert.IsTrue(molecule.Bonds[1].IsReactiveCenter);
            Assert.IsTrue(reactant.Bonds[1].IsReactiveCenter);
        }
Ejemplo n.º 3
0
        public void TestMapping()
        {
            IReactionProcess type = new SharingChargeDBReaction();

            var            setOfReactants = GetExampleReactants();
            IAtomContainer molecule       = setOfReactants[0];

            /* automatic search of the center active */
            var paramList = new List <IParameterReaction>();
            var param     = new SetReactionCenter
            {
                IsSetParameter = false
            };

            paramList.Add(param);
            type.ParameterList = paramList;
            /* initiate */

            var setOfReactions = type.Initiate(setOfReactants, null);

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

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

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

            Assert.AreEqual(mappedProductA1, product.Atoms[1]);
            mappedProductA1 = (IAtom)ReactionManipulator.GetMappedChemObject(setOfReactions[0],
                                                                             molecule.Atoms[2]);
            Assert.AreEqual(mappedProductA1, product.Atoms[2]);
        }
Ejemplo n.º 4
0
        public void TestManuallyCentreActive()
        {
            IReactionProcess type = new SharingChargeDBReaction();

            var            setOfReactants = GetExampleReactants();
            IAtomContainer molecule       = setOfReactants[0];

            /* manually put the center active */
            molecule.Atoms[1].IsReactiveCenter = true;
            molecule.Atoms[2].IsReactiveCenter = true;
            molecule.Bonds[1].IsReactiveCenter = true;

            var paramList = new List <IParameterReaction>();
            var param     = new SetReactionCenter
            {
                IsSetParameter = true
            };

            paramList.Add(param);
            type.ParameterList = paramList;

            /* initiate */

            var setOfReactions = type.Initiate(setOfReactants, null);

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

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

            /* C-[C+]O| */
            IAtomContainer molecule2 = GetExpectedProducts()[0];

            IQueryAtomContainer queryAtom = QueryAtomContainerCreator.CreateSymbolAndChargeQueryContainer(product);

            Assert.IsTrue(new UniversalIsomorphismTester().IsIsomorph(molecule2, queryAtom));
        }
Ejemplo n.º 5
0
        public void TestSharingChargeDBReaction()
        {
            IReactionProcess type = new SharingChargeDBReaction();

            Assert.IsNotNull(type);
        }