Example #1
0
        /// <summary> Labels the Atom's and Bond's in the AtomContainer using the a1, a2, b1, b2
        /// scheme often used in CML.
        ///
        /// </summary>
        /// <seealso cref="createIDs(ISetOfAtomContainers)">
        /// </seealso>
        public virtual void createIDs(IAtomContainer container)
        {
            if (tabuList == null)
            {
                tabuList = AtomContainerManipulator.getAllIDs(container);
            }

            if (container.ID == null)
            {
                moleculeCount++;
                while (tabuList.Contains("m" + moleculeCount))
                {
                    moleculeCount++;
                }
                container.ID = "m" + moleculeCount;
            }

            IAtom[] atoms = container.Atoms;
            for (int i = 0; i < atoms.Length; i++)
            {
                IAtom atom = atoms[i];
                if (atom.ID == null)
                {
                    atomCount++;
                    while (tabuList.Contains("a" + atomCount))
                    {
                        atomCount++;
                    }
                    atoms[i].ID = "a" + atomCount;
                }
            }
            IBond[] bonds = container.Bonds;
            for (int i = 0; i < bonds.Length; i++)
            {
                IBond bond = bonds[i];
                if (bond.ID == null)
                {
                    bondCount++;
                    while (tabuList.Contains("b" + bondCount))
                    {
                        bondCount++;
                    }
                    bonds[i].ID = "b" + bondCount;
                }
            }
        }