Program: 16635
Project: 16635
Buggy source:
/** 
 * This method runs iteratively CeSymm on the symmetric units until no more symmetries exist.
 * @param atoms Coordinates of the structure atoms
 * @throws StructureException
 */
private void iterate(Atom[] atoms) throws StructureException {
  if (atoms.length <= params.getWinSize() || atoms.length <= params.getMinSubunitLength()) {
    logger.debug("String_Node_Str",atoms.length);
    return;
  }
  CeSymm aligner=new CeSymm();
  MultipleAlignment align=aligner.analyze(atoms,params);
  if (name == null)   name=align.getEnsemble().getStructureNames().get(0);
  if (!SymmetryTools.isRefined(align))   return;
 else   if (align.getScore(MultipleAlignmentScorer.AVGTM_SCORE) < params.getSymmetryThreshold() || align.getCoreLength() < params.getMinSubunitLength()) {
    return;
  }
  levels.add(align);
  Block b=align.getBlock(0);
  for (int pos=0; pos < b.length(); pos++) {
    for (int su=0; su < b.size() - 1; su++) {
      Integer pos1=b.getAlignRes().get(su).get(pos);
      Integer pos2=b.getAlignRes().get(su + 1).get(pos);
      if (pos1 != null && pos2 != null) {
        alignment.get(pos1).add(pos2);
      }
    }
  }
  Integer start=null;
  int it=0;
  while (start == null) {
    start=align.getBlocks().get(0).getAlignRes().get(0).get(it);
    it++;
  }
  Integer end=null;
  it=align.getBlocks().get(0).getAlignRes().get(0).size() - 1;
  while (end == null) {
    end=align.getBlocks().get(0).getAlignRes().get(0).get(it);
    it--;
  }
  Atom[] atomsR=Arrays.copyOfRange(atoms,start,end + 1);
  iterate(atomsR);
}

Fixed version (ground truth):
/** 
 * This method runs iteratively CeSymm on the symmetric units until no more symmetries exist.
 * @param atoms Coordinates of the structure atoms
 * @throws StructureException
 */
private void iterate(Atom[] atoms) throws StructureException {
  logger.debug("String_Node_Str");
  if (atoms.length <= params.getWinSize() || atoms.length <= params.getMinSubunitLength()) {
    logger.debug("String_Node_Str" + "String_Node_Str",atoms.length);
    return;
  }
  CeSymm aligner=new CeSymm();
  MultipleAlignment align=aligner.analyze(atoms,params);
  if (name == null)   name=align.getEnsemble().getStructureNames().get(0);
  if (!SymmetryTools.isRefined(align))   return;
 else   if (align.getScore(MultipleAlignmentScorer.AVGTM_SCORE) < params.getSymmetryThreshold() || align.getCoreLength() < params.getMinSubunitLength()) {
    return;
  }
  levels.add(align);
  Block b=align.getBlock(0);
  for (int pos=0; pos < b.length(); pos++) {
    for (int su=0; su < b.size() - 1; su++) {
      Integer pos1=b.getAlignRes().get(su).get(pos);
      Integer pos2=b.getAlignRes().get(su + 1).get(pos);
      if (pos1 != null && pos2 != null) {
        alignment.get(pos1).add(pos2);
      }
    }
  }
  Integer start=null;
  int it=0;
  while (start == null) {
    start=align.getBlocks().get(0).getAlignRes().get(0).get(it);
    it++;
  }
  Integer end=null;
  it=align.getBlocks().get(0).getAlignRes().get(0).size() - 1;
  while (end == null) {
    end=align.getBlocks().get(0).getAlignRes().get(0).get(it);
    it--;
  }
  Atom[] atomsR=Arrays.copyOfRange(atoms,start,end + 1);
  iterate(atomsR);
}