code: public List<IAtom> getRgroupQueryAtoms(Integer rgroupNumber) {
  
          List<IAtom> rGroupQueryAtoms = null;
  
          if (rootStructure != null) {
              rGroupQueryAtoms = new ArrayList<IAtom>();
  
              for (int i = 0; i < rootStructure.getAtomCount(); i++) {
                  IAtom atom = rootStructure.getAtom(i);
                  if (atom instanceof IPseudoAtom) {
                      IPseudoAtom rGroup = (IPseudoAtom) atom;
                      if (!rGroup.getLabel().equals("R")
                              && // just "R" is not a proper query atom
                              rGroup.getLabel().startsWith("R")
                              && (rgroupNumber == null || Integer.valueOf(rGroup.getLabel().substring(1)).equals(
                                      rgroupNumber))) rGroupQueryAtoms.add(atom);
                  }
              }
          }
          return rGroupQueryAtoms;
      }
docs: Returns all R# type atoms (pseudo atoms) found in the root structure
  for a certain provided RGgroup number.<p>
  @param rgroupNumber R# number, 1..32
  @return list of (pseudo) atoms with the provided rgroupNumber as label