コード例 #1
0
        /// <summary>  Converts a RingSet to an AtomContainer.
        ///
        /// </summary>
        /// <param name="ringSet"> The RingSet to be converted.
        /// </param>
        /// <returns>          The AtomContainer containing the bonds and atoms of the ringSet.
        /// </returns>
        public static IAtomContainer convertToAtomContainer(IRingSet ringSet)
        {
            IRing ring = (IRing)ringSet.getAtomContainer(0);

            if (ring == null)
            {
                return(null);
            }
            IAtomContainer ac = ring.Builder.newAtomContainer();

            for (int i = 0; i < ringSet.AtomContainerCount; i++)
            {
                ring = (IRing)ringSet.getAtomContainer(i);
                for (int r = 0; r < ring.getBondCount(); r++)
                {
                    IBond bond = ring.getBondAt(r);
                    if (!ac.contains(bond))
                    {
                        for (int j = 0; j < bond.AtomCount; j++)
                        {
                            ac.addAtom(bond.getAtomAt(j));
                        }
                        ac.addBond(bond);
                    }
                }
            }
            return(ac);
        }
コード例 #2
0
 private void getBondsInRing(IAtomContainer mol, IRing ring, int[] bonds)
 {
     for (int i = 0; i < ring.getBondCount(); i++)
     {
         int m = mol.getBondNumber(ring.getBondAt(i));
         bonds[m] = 1;
     }
 }
コード例 #3
0
 private void getBondsInRing(IAtomContainer mol, IRing ring, int[] bonds)
 {
     for (int i = 0; i < ring.getBondCount(); i++)
     {
         int m = mol.getBondNumber(ring.getBondAt(i));
         bonds[m] = 1;
     }
 }