code: public void partitionNonRingPartners(IAtom atom, IRing ring, IAtomContainer ringAtoms, IAtomContainer nonRingAtoms) {
          List atoms = molecule.getConnectedAtomsList(atom);
          for (int i = 0; i < atoms.size(); i++) {
              IAtom curAtom = (IAtom) atoms.get(i);
              if (!ring.contains(curAtom)) {
                  nonRingAtoms.addAtom(curAtom);
              } else {
                  ringAtoms.addAtom(curAtom);
              }
          }
      }
docs: Partition the bonding partners of a given atom into ring atoms and non-ring atoms
  
  @param   atom  The atom whose bonding partners are to be partitioned
  @param   ring  The ring against which the bonding partners are checked
  @param   ringAtoms  An AtomContainer to store the ring bonding partners
  @param   nonRingAtoms  An AtomContainer to store the non-ring bonding partners