code: public static final Atom[] getAtomArray(Chain c, String[] atomNames) {
  
  		List<Atom> atoms = new ArrayList<Atom>();
  
  		for (Group g : c.getAtomGroups()) {
  
  			// a temp container for the atoms of this group
  			List<Atom> thisGroupAtoms = new ArrayList<Atom>();
  			// flag to check if this group contains all the requested atoms.
  			boolean thisGroupAllAtoms = true;
  			for (String atomName : atomNames) {
  				Atom a = g.getAtom(atomName);
  				if (a == null) {
  					logger.debug("Group " + g.getResidueNumber() + " ("
  							+ g.getPDBName()
  							+ ") does not have the required atom '" + atomName
  							+ "'");
  					// this group does not have a required atom, skip it...
  					thisGroupAllAtoms = false;
  					break;
  				}
  				thisGroupAtoms.add(a);
  			}
  
  			if (thisGroupAllAtoms) {
  				// add the atoms of this group to the array.
  				for (Atom a : thisGroupAtoms) {
  					atoms.add(a);
  				}
  			}
  
  		}
  		return atoms.toArray(new Atom[atoms.size()]);
  
  	}
docs: Returns an array of the requested Atoms from the Chain object. Iterates
  over all groups and checks if the requested atoms are in this group, no
  matter if this is a AminoAcid or Hetatom group. If the group does not
  contain all requested atoms then no atoms are added for that group.
  
  @param c
  the Chain to get the atoms from
  
  @param atomNames
  contains the atom names to be used.
  @return an Atom[] array