Esempio n. 1
0
        /// <summary>  Fings the set of all rings in a molecule
        ///
        /// </summary>
        /// <param name="atomContainer">    the molecule to be searched for rings
        /// </param>
        /// <param name="useSSSR">          use the SSSRFinder & RingPartitioner as pre-filter
        /// </param>
        /// <returns>                   a RingSet containing the rings in molecule
        /// </returns>
        /// <exception cref="CDKException"> An exception thrown if something goes wrong or if the timeout limit is reached
        /// </exception>
        public virtual IRingSet findAllRings(IAtomContainer atomContainer, bool useSSSR)
        {
            if (startTime == 0)
            {
                startTime = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
            }
            System.Collections.ArrayList pathes = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
            IRingSet       ringSet = atomContainer.Builder.newRingSet();
            IAtomContainer ac      = atomContainer.Builder.newAtomContainer();

            originalAc = atomContainer;
            ac.add(atomContainer);
            if (debug)
            {
                System.Console.Out.WriteLine("AtomCount before removal of aliphatic atoms: " + ac.AtomCount);
            }
            removeAliphatic(ac);
            if (debug)
            {
                System.Console.Out.WriteLine("AtomCount after removal of aliphatic atoms: " + ac.AtomCount);
            }
            if (useSSSR)
            {
                SSSRFinder sssrf = new SSSRFinder(atomContainer);
                IRingSet   sssr  = sssrf.findSSSR();
                System.Collections.ArrayList ringSets = RingPartitioner.partitionRings(sssr);

                for (int r = 0; r < ringSets.Count; r++)
                {
                    IAtomContainer tempAC = RingPartitioner.convertToAtomContainer((IRingSet)ringSets[r]);

                    doSearch(tempAC, pathes, ringSet);
                }
            }
            else
            {
                doSearch(ac, pathes, ringSet);
            }
            atomContainer.setProperty(CDKConstants.ALL_RINGS, ringSet);
            return(ringSet);
        }
Esempio n. 2
0
        /// <summary>  Fings the set of all rings in a molecule
        /// 
        /// </summary>
        /// <param name="atomContainer">    the molecule to be searched for rings
        /// </param>
        /// <param name="useSSSR">          use the SSSRFinder & RingPartitioner as pre-filter
        /// </param>
        /// <returns>                   a RingSet containing the rings in molecule
        /// </returns>
        /// <exception cref="CDKException"> An exception thrown if something goes wrong or if the timeout limit is reached
        /// </exception>
        public virtual IRingSet findAllRings(IAtomContainer atomContainer, bool useSSSR)
        {
            if (startTime == 0)
            {
                startTime = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
            }
            System.Collections.ArrayList pathes = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
            IRingSet ringSet = atomContainer.Builder.newRingSet();
            IAtomContainer ac = atomContainer.Builder.newAtomContainer();
            originalAc = atomContainer;
            ac.add(atomContainer);
            if (debug)
            {
                System.Console.Out.WriteLine("AtomCount before removal of aliphatic atoms: " + ac.AtomCount);
            }
            removeAliphatic(ac);
            if (debug)
            {
                System.Console.Out.WriteLine("AtomCount after removal of aliphatic atoms: " + ac.AtomCount);
            }
            if (useSSSR)
            {
                SSSRFinder sssrf = new SSSRFinder(atomContainer);
                IRingSet sssr = sssrf.findSSSR();
                System.Collections.ArrayList ringSets = RingPartitioner.partitionRings(sssr);

                for (int r = 0; r < ringSets.Count; r++)
                {
                    IAtomContainer tempAC = RingPartitioner.convertToAtomContainer((IRingSet)ringSets[r]);

                    doSearch(tempAC, pathes, ringSet);
                }
            }
            else
            {
                doSearch(ac, pathes, ringSet);
            }
            atomContainer.setProperty(CDKConstants.ALL_RINGS, ringSet);
            return ringSet;
        }
		public virtual void  saturateRingSystems(IAtomContainer atomContainer)
		{
			IRingSet rs = new SSSRFinder(atomContainer.Builder.newMolecule(atomContainer)).findSSSR();
			System.Collections.ArrayList ringSets = RingPartitioner.partitionRings(rs);
			IAtomContainer ac = null;
			IAtom atom = null;
			int[] temp;
			for (int f = 0; f < ringSets.Count; f++)
			{
				rs = (IRingSet) ringSets[f];
				ac = RingSetManipulator.getAllInOneContainer(rs);
				temp = new int[ac.AtomCount];
				for (int g = 0; g < ac.AtomCount; g++)
				{
					atom = ac.getAtomAt(g);
					temp[g] = atom.getHydrogenCount();
					atom.setHydrogenCount(atomContainer.getBondCount(atom) - ac.getBondCount(atom) - temp[g]);
				}
				saturate(ac);
				for (int g = 0; g < ac.AtomCount; g++)
				{
					atom = ac.getAtomAt(g);
					atom.setHydrogenCount(temp[g]);
				}
			}
		}