code: private static double getRmsd(int focusResn, int[] focusRes1, int[] focusRes2, AFPChain afpChain, Atom[] ca1, Atom[] ca2){
  
  
  
  		Atom[] tmp1 = new Atom[focusResn];
  		Atom[] tmp2 = new Atom[focusResn];
  
  		for ( int i =0 ; i< focusResn;i++){
  			tmp1[i] =       ca1[focusRes1[i]];
  			tmp2[i] = (Atom)ca2[focusRes2[i]].clone();
  			if (tmp1[i].getCoords() == null){
  				System.err.println("tmp1 got null: " +i + " pos: " + focusRes1[i]);
  			}
  			if (tmp2[i].getCoords() == null){
  				System.err.println("tmp1 got null: " +i + " pos: " + focusRes2[i]);
  			}
  			//XX
  			//tmp2[i].setParent((Group) ca2[focusRes2[i]].getParent().clone());
  		}
  		double rmsd = 99;
  		try {
  			rmsd = getRmsd(tmp1,tmp2);
  
  		} catch (Exception e){
  			e.printStackTrace();
  		}
  		return rmsd;
  
  	}
docs: the the RMSD for the residues defined in the two arrays
  
  @param focusResn
  @param focusRes1
  @param focusRes2
  @return