Exemplo n.º 1
0
 public static void RemoveAtomAndConnectedElectronContainers(IReactionSet set, IAtom atom)
 {
     foreach (var reaction in set)
     {
         ReactionManipulator.RemoveAtomAndConnectedElectronContainers(reaction, atom);
     }
 }
Exemplo n.º 2
0
        public void TestRemoveAtomAndConnectedElectronContainers_IReaction_IAtom()
        {
            var            builder  = ChemObjectBuilder.Instance;
            IReaction      reaction = builder.NewReaction();
            IAtomContainer mol      = builder.NewAtomContainer();

            mol.Atoms.Add(builder.NewAtom("C"));
            mol.Atoms.Add(builder.NewAtom("C"));
            mol.AddBond(mol.Atoms[0], mol.Atoms[1], BondOrder.Single);
            Assert.AreEqual(2, mol.Atoms.Count);
            Assert.AreEqual(1, mol.Bonds.Count);
            reaction.Reactants.Add(mol);
            reaction.Reactants.Add(builder.NewAtomContainer());
            reaction.Reactants.Add(builder.NewAtomContainer());
            reaction.Products.Add(builder.NewAtomContainer());
            reaction.Products.Add(builder.NewAtomContainer());
            ReactionManipulator.RemoveAtomAndConnectedElectronContainers(reaction, mol.Atoms[0]);

            Assert.AreEqual(1, mol.Atoms.Count);
            Assert.AreEqual(0, mol.Bonds.Count);
        }