code: private boolean hasSubGroup(int tmp_model,int tmp_chain,int tmp_group) {
  
  		if (tmp_model >= structure.nrModels()) {
  			return false;
  		}
  
  		List<Chain> model = structure.getModel(tmp_model);
  
  		if (tmp_chain >= model.size()) {
  			if(fixed_model)
  				return false;
  			return hasSubGroup(tmp_model + 1, 0, 0);
  		}
  
  		Chain chain = model.get(tmp_chain);
  
  		// start search at beginning of next chain.
  		return tmp_group < chain.getAtomLength() || hasSubGroup(tmp_model, tmp_chain + 1, 0);
  
  	}
docs: recursive method to determine if there is a next group. Helper
  method for hasNext().
  @see #hasNext