Re: [Rdkit-discuss] Calculation of atomic descriptors, Code snippet
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Greg L. <gre...@gm...> - 2008-08-15 16:12:31
|
Dear Evgueni,
this is a general interest answer, so I'm directing it to the mailing list.
On Fri, Aug 15, 2008 at 11:56 AM, Evgueni Kolossov
<eko...@bt...> wrote:
>
> I need to understand a little bit more about RingInfo.
> For a given atom I got:
> - the number of rings atom involved (pRingInfo->numAtomRings(Atom_Idx))
> - the size of the smallest ring atom involved
> (pRingInfo->minAtomRingSize(Atom_Idx))
correct.
> Now I need to iterate through the atoms in the smallest ring with my atom. I
> can get atoms using pRingInfo->atomRings() but how I know this will give me
> the list of atoms in the smallest ring and in the ring where is my atom?
sample code, not actually tested, should give the idea:
unsigned int minRingSize=ringInfo->minAtomRingSize(atomIdx);
for(VECT_INT_VECT_CI ringIt=ringInfo->atomRings().begin();
ringIt!=ringInfo->atomRings().end();++ringIt){
if(ringIt->size()==minRingSize){
if(std::find(ringIt->begin(),ringIt->end(),atomIdx)!=ringIt->end()){
// our atom is in this ring; do something
}
}
}
}
> What if my atom is a member of more than one ring?
The above code should work in that case as well.
-greg
|