code: public static Atom[] duplicateCA2(Atom[] ca2) {
  		// we don't want to rotate input atoms, do we?
  		Atom[] ca2clone = new Atom[ca2.length * 2];
  
  		int pos = 0;
  
  		Chain c = null;
  		String prevChainId = "";
  		for (Atom a : ca2) {
  			Group g = (Group) a.getGroup().clone(); // works because each group
  			// has only a single atom
  
  			if (c == null) {
  				c = new ChainImpl();
  				Chain orig = a.getGroup().getChain();
  				c.setId(orig.getId());
  				c.setName(orig.getName());
  			} else {
  				Chain orig = a.getGroup().getChain();
  				if (!orig.getId().equals(prevChainId)) {
  					c = new ChainImpl();
  					c.setId(orig.getId());
  					c.setName(orig.getName());
  				}
  			}
  
  			c.addGroup(g);
  			ca2clone[pos] = g.getAtom(a.getName());
  
  			pos++;
  		}
  
  		// Duplicate ca2!
  		c = null;
  		prevChainId = "";
  		for (Atom a : ca2) {
  			Group g = (Group) a.getGroup().clone();
  
  			if (c == null) {
  				c = new ChainImpl();
  				Chain orig = a.getGroup().getChain();
  				c.setId(orig.getId());
  				c.setName(orig.getName());
  			} else {
  				Chain orig = a.getGroup().getChain();
  				if (!orig.getId().equals(prevChainId)) {
  					c = new ChainImpl();
  					c.setId(orig.getId());
  					c.setName(orig.getName());
  				}
  			}
  
  			c.addGroup(g);
  			ca2clone[pos] = g.getAtom(a.getName());
  
  			pos++;
  		}
  
  		return ca2clone;
  
  	}
docs: Utility method for working with circular permutations. Creates a
  duplicated and cloned set of Calpha atoms from the input array.
  
  @param ca2
  atom array
  @return cloned and duplicated set of input array