code: public static final Atom[] cloneAtomArray(Atom[] ca) {
  		Atom[] newCA = new Atom[ca.length];
  
  		List<Chain> model = new ArrayList<Chain>();
  		int apos = -1;
  		for (Atom a : ca) {
  			apos++;
  			Group parentG = a.getGroup();
  			Chain parentC = parentG.getChain();
  
  			Chain newChain = null;
  			for (Chain c : model) {
  				if (c.getName().equals(parentC.getName())) {
  					newChain = c;
  					break;
  				}
  			}
  			if (newChain == null) {
  				newChain = new ChainImpl();
  				newChain.setId(parentC.getId());
  				newChain.setName(parentC.getName());
  				model.add(newChain);
  			}
  
  			Group parentN = (Group) parentG.clone();
  
  			newCA[apos] = parentN.getAtom(a.getName());
  			try {
  				// if the group doesn't exist yet, this produces a StructureException
  				newChain.getGroupByPDB(parentN.getResidueNumber());
  			} catch (StructureException e) {
  				// the group doesn't exist yet in the newChain, let's add it
  				newChain.addGroup(parentN);
  			}
  
  		}
  		return newCA;
  	}
docs: Provides an equivalent copy of Atoms in a new array. Clones everything,
  starting with parent groups and chains. The chain will only contain
  groups that are part of the input array.
  
  @param ca
  array of representative atoms, e.g. CA atoms
  @return Atom array
  @since Biojava 4.1.0