public override void TestInitiate_IAtomContainerSet_IAtomContainerSet() { /* Ionize(>C-C<): C=CCC -> C=C* + C+ , set the reactive center */ var setOfReactants = GetExampleReactants(); var reactant = setOfReactants[0]; foreach (var bond in reactant.Bonds) { var atom1 = bond.Atoms[0]; var atom2 = bond.Atoms[1]; if (bond.Order == BondOrder.Single && atom1.Symbol.Equals("C") && atom2.Symbol.Equals("C")) { bond.IsReactiveCenter = true; atom1.IsReactiveCenter = true; atom2.IsReactiveCenter = true; } } Assert.AreEqual(0, reactant.SingleElectrons.Count); /* initiate */ var type = new ElectronImpactSDBReaction(); var paramList = new List <IParameterReaction>(); var param = new SetReactionCenter { IsSetParameter = true }; paramList.Add(param); type.ParameterList = paramList; var setOfReactions = type.Initiate(setOfReactants, null); Assert.AreEqual(2, setOfReactions.Count); Assert.AreEqual(2, setOfReactions[0].Products.Count); var molecule1 = setOfReactions[0].Products[0];//[H][C+]=C([H])[H] Assert.AreEqual(1, molecule1.Atoms[1].FormalCharge.Value); Assert.AreEqual(0, molecule1.SingleElectrons.Count); var molecule2 = setOfReactions[0].Products[1];//[H][C*]([H])[H] Assert.AreEqual(1, molecule2.SingleElectrons.Count); Assert.AreEqual(1, molecule2.GetConnectedSingleElectrons(molecule2.Atoms[0]).Count()); Assert.IsTrue(setOfReactions[0].Mappings.Any()); Assert.AreEqual(2, setOfReactions[1].Products.Count); molecule1 = setOfReactions[1].Products[0];//[H]C=[C*]([H])[H] Assert.AreEqual(1, molecule1.GetConnectedSingleElectrons(molecule1.Atoms[1]).Count()); molecule2 = setOfReactions[1].Products[1];//[H][C+]([H])[H] Assert.AreEqual(0, molecule2.SingleElectrons.Count); Assert.AreEqual(1, molecule2.Atoms[0].FormalCharge.Value); }
public void TestElectronImpactSDBReaction() { var type = new ElectronImpactSDBReaction(); Assert.IsNotNull(type); }