From: Vermaas, Joshua (
Date: Fri Mar 15 2019 - 16:25:45 CDT

Hi Stacey,

The information you want is stored in SmallRing datastructures (SmallRing.h), with many of the ring-finding bits and bobs in BaseMolecule.C. It looks like the atomsel_pucker function in AtomSel.C is close to what you want, but instead of computing a pucker, you'd just want to return a list of rings.

That being said, depending on where you structure comes from, it may be correct (and vastly simpler) to just subdivide the list of indices returned into groups of 6. Most of the structure generation tools I'm familiar with will make atoms belonging to the same ring consecutive or nearly so. So I wouldn't be surprised if something like:

set ringlist [list ]
set sel [atomselect top "ringsize 6 from all"]
set idxlist [$sel get index]
for { set i 0 } { $i < [expr { [$sel num] / 6 }]} { incr i } {
lappend ringlist [lrange $idxlist [expr {$i * 6}] [expr {$i * 6 + 5}]]
puts $ringlist

would (probably) do what you want with alot less hassle.


On 2019-03-15 14:40:47-06:00 wrote:

Where can I find the source code for the atomselect "ringsize"? I would like to see how it's programmed so that I might modify it to give me a list of atoms for each ring. For example, if we have biphenyl, "ringsize 6 from all", the current code will give me all of the carbons. But I would like a list of atoms for each ring.
Thanks for the help!