public void TestManuallyCentreActive() { IReactionProcess type = new SharingAnionReaction(); var setOfReactants = GetExampleReactants(); IAtomContainer molecule = setOfReactants[0]; /* manually put the center active */ molecule.Atoms[0].IsReactiveCenter = true; molecule.Atoms[1].IsReactiveCenter = true; molecule.Bonds[0].IsReactiveCenter = true; var paramList = new List <IParameterReaction>(); var param = new SetReactionCenter(); param.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=[O+] */ IAtomContainer molecule2 = GetExpectedProducts()[0]; IQueryAtomContainer queryAtom = QueryAtomContainerCreator.CreateSymbolAndChargeQueryContainer(product); Assert.IsTrue(new UniversalIsomorphismTester().IsIsomorph(molecule2, queryAtom)); }
public override void TestInitiate_IAtomContainerSet_IAtomContainerSet() { IReactionProcess type = new SharingAnionReaction(); 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(1, setOfReactions.Count); Assert.AreEqual(1, setOfReactions[0].Products.Count); IAtomContainer product = setOfReactions[0].Products[0]; /* C=[O+] */ IAtomContainer molecule2 = GetExpectedProducts()[0]; IQueryAtomContainer queryAtom = QueryAtomContainerCreator.CreateSymbolAndChargeQueryContainer(product); Assert.IsTrue(new UniversalIsomorphismTester().IsIsomorph(molecule2, queryAtom)); }
public void TestCDKConstants_REACTIVE_CENTER() { IReactionProcess type = new SharingAnionReaction(); var setOfReactants = GetExampleReactants(); IAtomContainer molecule = setOfReactants[0]; /* manually put the reactive center */ molecule.Atoms[0].IsReactiveCenter = true; molecule.Atoms[1].IsReactiveCenter = true; molecule.Bonds[0].IsReactiveCenter = true; var paramList = new List <IParameterReaction>(); var param = new SetReactionCenter(); param.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[0].IsReactiveCenter); Assert.IsTrue(reactant.Atoms[0].IsReactiveCenter); Assert.IsTrue(molecule.Atoms[1].IsReactiveCenter); Assert.IsTrue(reactant.Atoms[1].IsReactiveCenter); Assert.IsTrue(molecule.Bonds[0].IsReactiveCenter); Assert.IsTrue(reactant.Bonds[0].IsReactiveCenter); }
public void TestMapping() { IReactionProcess type = new SharingAnionReaction(); var setOfReactants = GetExampleReactants(); IAtomContainer molecule = setOfReactants[0]; /* automatic search of the center active */ var paramList = new List <IParameterReaction>(); var param = new SetReactionCenter(); param.IsSetParameter = false; paramList.Add(param); type.ParameterList = paramList; /* initiate */ var setOfReactions = type.Initiate(setOfReactants, null); IAtomContainer product = setOfReactions[0].Products[0]; Assert.AreEqual(4, 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[1]); Assert.AreEqual(mappedProductA2, product.Atoms[1]); }
public void TestCarbons() { IReactionProcess type = new SharingAnionReaction(); IAtomContainer molecule = builder.NewAtomContainer(); molecule.Atoms.Add(builder.NewAtom("C")); molecule.Atoms[0].FormalCharge = 1; molecule.Atoms.Add(builder.NewAtom("C")); molecule.Atoms[1].FormalCharge = -1; molecule.AddBond(molecule.Atoms[0], molecule.Atoms[1], BondOrder.Single); AddExplicitHydrogens(molecule); AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(molecule); CDK.LonePairElectronChecker.Saturate(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 product = setOfReactions[0].Products[0]; IAtomContainer molecule2 = builder.NewAtomContainer(); molecule2.Atoms.Add(builder.NewAtom("C")); molecule2.Atoms.Add(builder.NewAtom("C")); molecule2.AddBond(molecule2.Atoms[0], molecule2.Atoms[1], BondOrder.Double); AddExplicitHydrogens(molecule2); AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(molecule2); CDK.LonePairElectronChecker.Saturate(molecule2); IQueryAtomContainer queryAtom = QueryAtomContainerCreator.CreateSymbolAndChargeQueryContainer(product); Assert.IsTrue(new UniversalIsomorphismTester().IsIsomorph(molecule2, queryAtom)); }