コード例 #1
0
        public static void removeElectronContainer(IChemModel chemModel, IElectronContainer electrons)
        {
            ICrystal crystal = chemModel.Crystal;

            if (crystal != null)
            {
                if (crystal.contains(electrons))
                {
                    crystal.removeElectronContainer(electrons);
                }
                return;
            }
            ISetOfMolecules moleculeSet = chemModel.SetOfMolecules;

            if (moleculeSet != null)
            {
                SetOfMoleculesManipulator.removeElectronContainer(moleculeSet, electrons);
            }
            ISetOfReactions reactionSet = chemModel.SetOfReactions;

            if (reactionSet != null)
            {
                SetOfReactionsManipulator.removeElectronContainer(reactionSet, electrons);
            }
        }
コード例 #2
0
        public static void removeAtomAndConnectedElectronContainers(IChemModel chemModel, IAtom atom)
        {
            ICrystal crystal = chemModel.Crystal;

            if (crystal != null)
            {
                if (crystal.contains(atom))
                {
                    crystal.removeAtomAndConnectedElectronContainers(atom);
                }
                return;
            }
            ISetOfMolecules moleculeSet = chemModel.SetOfMolecules;

            if (moleculeSet != null)
            {
                SetOfMoleculesManipulator.removeAtomAndConnectedElectronContainers(moleculeSet, atom);
            }
            ISetOfReactions reactionSet = chemModel.SetOfReactions;

            if (reactionSet != null)
            {
                SetOfReactionsManipulator.removeAtomAndConnectedElectronContainers(reactionSet, atom);
            }
        }
コード例 #3
0
        public static IAtomContainer getRelevantAtomContainer(IReaction reaction, IBond bond)
        {
            IAtomContainer result = SetOfMoleculesManipulator.getRelevantAtomContainer(reaction.Reactants, bond);

            if (result != null)
            {
                return(result);
            }
            return(SetOfMoleculesManipulator.getRelevantAtomContainer(reaction.Products, bond));
        }
コード例 #4
0
        /// <summary> Returns all the AtomContainer's of a ChemModel.</summary>
        public static IAtomContainer[] getAllAtomContainers(IChemModel chemModel)
        {
            ISetOfMolecules moleculeSet = chemModel.Builder.newSetOfMolecules();

            if (chemModel.SetOfMolecules != null)
            {
                moleculeSet.add(chemModel.SetOfMolecules);
            }
            if (chemModel.SetOfReactions != null)
            {
                moleculeSet.add(SetOfReactionsManipulator.getAllMolecules(chemModel.SetOfReactions));
            }
            return(SetOfMoleculesManipulator.getAllAtomContainers(moleculeSet));
        }
コード例 #5
0
 public static void setAtomProperties(IChemModel chemModel, System.Object propKey, System.Object propVal)
 {
     if (chemModel.SetOfMolecules != null)
     {
         SetOfMoleculesManipulator.setAtomProperties(chemModel.SetOfMolecules, propKey, propVal);
     }
     if (chemModel.SetOfReactions != null)
     {
         SetOfReactionsManipulator.setAtomProperties(chemModel.SetOfReactions, propKey, propVal);
     }
     if (chemModel.Crystal != null)
     {
         AtomContainerManipulator.setAtomProperties(chemModel.Crystal, propKey, propVal);
     }
 }
コード例 #6
0
        public static IAtomContainer getRelevantAtomContainer(IChemModel chemModel, IBond bond)
        {
            IAtomContainer result = null;

            if (chemModel.SetOfMolecules != null)
            {
                ISetOfMolecules moleculeSet = chemModel.SetOfMolecules;
                result = SetOfMoleculesManipulator.getRelevantAtomContainer(moleculeSet, bond);
                if (result != null)
                {
                    return(result);
                }
            }
            if (chemModel.SetOfReactions != null)
            {
                ISetOfReactions reactionSet = chemModel.SetOfReactions;
                return(SetOfReactionsManipulator.getRelevantAtomContainer(reactionSet, bond));
            }
            // This should never happen.
            return(null);
        }
コード例 #7
0
        public static int getBondCount(IChemModel chemModel)
        {
            int      count   = 0;
            ICrystal crystal = chemModel.Crystal;

            if (crystal != null)
            {
                count += crystal.getBondCount();
            }
            ISetOfMolecules moleculeSet = chemModel.SetOfMolecules;

            if (moleculeSet != null)
            {
                count += SetOfMoleculesManipulator.getBondCount(moleculeSet);
            }
            ISetOfReactions reactionSet = chemModel.SetOfReactions;

            if (reactionSet != null)
            {
                count += SetOfReactionsManipulator.getBondCount(reactionSet);
            }
            return(count);
        }
コード例 #8
0
        /// <summary> Puts all the Molecules of this container together in one
        /// AtomContainer.
        ///
        /// </summary>
        /// <returns>  The AtomContainer with all the Molecules of this container
        ///
        /// </returns>
        /// <deprecated> This method has a serious performace impact. Try to use
        /// other methods.
        /// </deprecated>
        public static IAtomContainer getAllInOneContainer(IChemModel chemModel)
        {
            IAtomContainer container = chemModel.Builder.newAtomContainer();
            ICrystal       crystal   = chemModel.Crystal;

            if (crystal != null)
            {
                container.add(crystal);
            }
            ISetOfMolecules moleculeSet = chemModel.SetOfMolecules;

            if (moleculeSet != null)
            {
                container.add(SetOfMoleculesManipulator.getAllInOneContainer(moleculeSet));
            }
            ISetOfReactions reactionSet = chemModel.SetOfReactions;

            if (reactionSet != null)
            {
                container.add(SetOfReactionsManipulator.getAllInOneContainer(reactionSet));
            }
            return(container);
        }
コード例 #9
0
        public static System.Collections.IList getAllChemObjects(IChemModel chemModel)
        {
            System.Collections.ArrayList list = new System.Collections.ArrayList();
            list.Add(chemModel);
            ICrystal crystal = chemModel.Crystal;

            if (crystal != null)
            {
                list.Add(crystal);
            }
            ISetOfMolecules moleculeSet = chemModel.SetOfMolecules;

            if (moleculeSet != null)
            {
                list.AddRange(SetOfMoleculesManipulator.getAllChemObjects(moleculeSet));
            }
            ISetOfReactions reactionSet = chemModel.SetOfReactions;

            if (reactionSet != null)
            {
                list.AddRange(SetOfReactionsManipulator.getAllChemObjects(reactionSet));
            }
            return(list);
        }
コード例 #10
0
 /// <summary> Returns all the AtomContainer's of a Reaction.</summary>
 public static IAtomContainer[] getAllAtomContainers(ISetOfReactions set_Renamed)
 {
     return(SetOfMoleculesManipulator.getAllAtomContainers(getAllMolecules(set_Renamed)));
 }
コード例 #11
0
 /// <summary> Returns all the AtomContainer's of a Reaction.</summary>
 public static IAtomContainer[] getAllAtomContainers(IReaction reaction)
 {
     return(SetOfMoleculesManipulator.getAllAtomContainers(getAllMolecules(reaction)));
 }