public void TestDoubleRingConjugated()
        {
            var type = new PiBondingMovementReaction();
            // C1=CC(=CC2=C1C=CC=C2)C
            var setOfReactants = GetExampleReactants();

            /* initiate */
            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(2, setOfReactions.Count);
            Assert.AreEqual(1, setOfReactions[0].Products.Count);

            var product1  = setOfReactions[0].Products[0];
            var molecule1 = GetExpectedProducts()[0];

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

            var product2 = setOfReactions[1].Products[0];
            //C1=CC(=CC2=CC=CC=C12)C
            var molecule2 = builder.NewAtomContainer();

            molecule2.Atoms.Add(builder.NewAtom("C"));
            molecule2.Atoms.Add(builder.NewAtom("C"));
            molecule2.AddBond(molecule2.Atoms[0], molecule2.Atoms[1], BondOrder.Single);
            molecule2.Atoms.Add(builder.NewAtom("C"));
            molecule2.AddBond(molecule2.Atoms[1], molecule2.Atoms[2], BondOrder.Single);
            molecule2.Atoms.Add(builder.NewAtom("C"));
            molecule2.AddBond(molecule2.Atoms[2], molecule2.Atoms[3], BondOrder.Double);
            molecule2.Atoms.Add(builder.NewAtom("C"));
            molecule2.AddBond(molecule2.Atoms[3], molecule2.Atoms[4], BondOrder.Single);
            molecule2.Atoms.Add(builder.NewAtom("C"));
            molecule2.AddBond(molecule2.Atoms[4], molecule2.Atoms[5], BondOrder.Double);
            molecule2.Atoms.Add(builder.NewAtom("C"));
            molecule2.AddBond(molecule2.Atoms[5], molecule2.Atoms[6], BondOrder.Single);
            molecule2.Atoms.Add(builder.NewAtom("C"));
            molecule2.AddBond(molecule2.Atoms[6], molecule2.Atoms[7], BondOrder.Double);
            molecule2.Atoms.Add(builder.NewAtom("C"));
            molecule2.AddBond(molecule2.Atoms[7], molecule2.Atoms[8], BondOrder.Single);
            molecule2.Atoms.Add(builder.NewAtom("C"));
            molecule2.AddBond(molecule2.Atoms[8], molecule2.Atoms[9], BondOrder.Double);
            molecule2.Atoms.Add(builder.NewAtom("C"));
            molecule2.AddBond(molecule2.Atoms[9], molecule2.Atoms[10], BondOrder.Single);
            molecule2.AddBond(molecule2.Atoms[10], molecule2.Atoms[1], BondOrder.Double);
            molecule2.AddBond(molecule2.Atoms[9], molecule2.Atoms[4], BondOrder.Single);

            AddExplicitHydrogens(molecule2);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(molecule2);
            MakeSureAtomTypesAreRecognized(molecule2);

            // order depends on ring perception order (may change between versions) we check both
            // combinations just in case
            Assert.IsTrue((Matches(molecule2, product1) && Matches(molecule1, product2)) ||
                          (Matches(molecule1, product1) && Matches(molecule2, product2)));
        }
Example #2
0
        public override void TestInitiate_IAtomContainerSet_IAtomContainerSet()
        {
            IReactionProcess type = new PiBondingMovementReaction();
            // C1=C(C)-C(C)=C-C=C1
            IAtomContainer molecule = builder.NewAtomContainer();

            molecule.Atoms.Add(builder.NewAtom("C"));
            molecule.Atoms.Add(builder.NewAtom("C"));
            molecule.AddBond(molecule.Atoms[0], molecule.Atoms[1], BondOrder.Double);
            molecule.Atoms.Add(builder.NewAtom("C"));
            molecule.AddBond(molecule.Atoms[1], molecule.Atoms[2], BondOrder.Single);
            molecule.Atoms.Add(builder.NewAtom("C"));
            molecule.AddBond(molecule.Atoms[2], molecule.Atoms[3], BondOrder.Double);
            molecule.Atoms.Add(builder.NewAtom("C"));
            molecule.AddBond(molecule.Atoms[3], molecule.Atoms[4], BondOrder.Single);
            molecule.Atoms.Add(builder.NewAtom("C"));
            molecule.AddBond(molecule.Atoms[4], molecule.Atoms[5], BondOrder.Double);
            molecule.AddBond(molecule.Atoms[5], molecule.Atoms[0], BondOrder.Single);

            AddExplicitHydrogens(molecule);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(molecule);
            MakeSureAtomTypesAreRecognized(molecule);

            var setOfReactants = ChemObjectBuilder.Instance.NewAtomContainerSet();

            setOfReactants.Add(molecule);

            /* initiate */
            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(1, setOfReactions.Count);
            Assert.AreEqual(1, setOfReactions[0].Products.Count);

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

            IQueryAtomContainer queryAtom = QueryAtomContainerCreator.CreateSymbolAndChargeQueryContainer(product2);

            Assert.IsTrue(new UniversalIsomorphismTester().IsIsomorph(molecule, queryAtom));
        }
Example #3
0
        public void TestDoubleRingConjugated2()
        {
            IReactionProcess type = new PiBondingMovementReaction();
            // C1=CC(=CC2=C1C=CC=C2)C

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

            /* manually putting the reaction center */
            molecule.Bonds[1].IsReactiveCenter  = true;
            molecule.Bonds[2].IsReactiveCenter  = true;
            molecule.Bonds[3].IsReactiveCenter  = true;
            molecule.Bonds[9].IsReactiveCenter  = true;
            molecule.Bonds[10].IsReactiveCenter = true;
            molecule.Bonds[11].IsReactiveCenter = true;

            /* initiate */
            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(1, setOfReactions[0].Products.Count);

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

            IAtomContainer molecule2 = GetExpectedProducts()[0];

            IQueryAtomContainer queryAtom = QueryAtomContainerCreator.CreateSymbolAndChargeQueryContainer(product2);

            Assert.IsTrue(new UniversalIsomorphismTester().IsIsomorph(molecule2, queryAtom));
        }
Example #4
0
        public void TestPiBondingMovementReaction()
        {
            IReactionProcess type = new PiBondingMovementReaction();

            Assert.IsNotNull(type);
        }