public static void removeElectronContainer(IReaction reaction, IElectronContainer electrons) { IMolecule[] reactants = reaction.Reactants.Molecules; for (int i = 0; i < reactants.Length; i++) { IMolecule mol = reactants[i]; if (mol.contains(electrons)) { mol.removeElectronContainer(electrons); } } IMolecule[] products = reaction.Products.Molecules; for (int i = 0; i < products.Length; i++) { IMolecule mol = products[i]; if (mol.contains(electrons)) { mol.removeElectronContainer(electrons); } } }
public static void removeAtomAndConnectedElectronContainers(IReaction reaction, IAtom atom) { IMolecule[] reactants = reaction.Reactants.Molecules; for (int i = 0; i < reactants.Length; i++) { IMolecule mol = reactants[i]; if (mol.contains(atom)) { mol.removeAtomAndConnectedElectronContainers(atom); } } IMolecule[] products = reaction.Products.Molecules; for (int i = 0; i < products.Length; i++) { IMolecule mol = products[i]; if (mol.contains(atom)) { mol.removeAtomAndConnectedElectronContainers(atom); } } }