예제 #1
0
        /// <summary>
        /// Remove an ElectronContainer from all AtomContainers
        /// inside an IChemModel.
        /// </summary>
        /// <param name="chemModel">The IChemModel object.</param>
        /// <param name="electrons">The ElectronContainer to remove.</param>
        public static void RemoveElectronContainer(IChemModel chemModel, IElectronContainer electrons)
        {
            ICrystal crystal = chemModel.Crystal;

            if (crystal != null)
            {
                if (crystal.Contains(electrons))
                {
                    crystal.Remove(electrons);
                }
                return;
            }
            IChemObjectSet <IAtomContainer> moleculeSet = chemModel.MoleculeSet;

            if (moleculeSet != null)
            {
                MoleculeSetManipulator.RemoveElectronContainer(moleculeSet, electrons);
            }
            IReactionSet reactionSet = chemModel.ReactionSet;

            if (reactionSet != null)
            {
                ReactionSetManipulator.RemoveElectronContainer(reactionSet, electrons);
            }
        }
예제 #2
0
        /// <summary>
        /// Remove an Atom and the connected ElectronContainers from all AtomContainers
        /// inside an IChemModel.
        /// </summary>
        /// <param name="chemModel">The IChemModel object.</param>
        /// <param name="atom">The Atom object to remove.</param>
        public static void RemoveAtomAndConnectedElectronContainers(IChemModel chemModel, IAtom atom)
        {
            ICrystal crystal = chemModel.Crystal;

            if (crystal != null)
            {
                if (crystal.Contains(atom))
                {
                    crystal.RemoveAtom(atom);
                }
                return;
            }
            IChemObjectSet <IAtomContainer> moleculeSet = chemModel.MoleculeSet;

            if (moleculeSet != null)
            {
                MoleculeSetManipulator.RemoveAtomAndConnectedElectronContainers(moleculeSet, atom);
            }
            IReactionSet reactionSet = chemModel.ReactionSet;

            if (reactionSet != null)
            {
                ReactionSetManipulator.RemoveAtomAndConnectedElectronContainers(reactionSet, atom);
            }
        }