From: Robin Betz (
Date: Fri Mar 15 2019 - 16:04:23 CDT

The ring-finding logic can be found in BaseMolecule.C in the
find_small_rings_from_back_edges function. I didn't read the code super
carefully but it looks like you follow unused edges until you find atoms
that you've seen already.

An easier way to get the list of atoms for each ring from the result is to
take advantage of the fact that the rings are returned in order and you
know the ring size is 6. So, the first 6 atom indices in the selection will
correspond to the first ring, then the next six the second, etc.

This won't work for selections with mixed ring sizes like "(ringsize 6 from
all) or (ringsize 5 from all)" though. In this case, if the residue ID of
each ring is unique, you could get all resids with a ring and then select
into each resid to get the atoms in the ring, or similar.

Hope this helps,

On Fri, Mar 15, 2019 at 1:50 PM MD Simulation <>

> Hello,
> 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!
> Stacey