code: public static List<Group> getGroups(Atom[] rAtoms) {
  
  		List<Group> groups = new ArrayList<Group>(rAtoms.length);
  
  		for (Atom a : rAtoms) {
  			Group g = a.getGroup();
  			if (g != null)
  				groups.add(g);
  			else
  				logger.info("Group not found for representative Atom {}", a);
  		}
  		return groups;
  	}
docs: Returns the List of Groups of the corresponding representative Atom
  array. The representative Atom array needs to fulfill: no two Atoms are
  from the same Group and Groups are sequential (connected in the original
  Structure), except if they are from different Chains.
  
  @param rAtoms
  array of representative Atoms (CA, P, etc).
  @return List of Groups