Program: 16561
Project: 16561
Buggy source:
/** 
 * This method runs iteratively the analysis of one level of symmetry with CeSymm on the input Atom array until no more symmetries exist.
 * @param atoms representative Atom array of the Structure
 * @return true if any symmetry was found, false if asymmetric
 * @throws StructureException
 */
private boolean iterate(Atom[] atoms) throws StructureException {
  logger.debug("String_Node_Str");
  if (atoms.length <= params.getWinSize() || atoms.length <= params.getMinCoreLength()) {
    logger.debug("String_Node_Str" + "String_Node_Str",atoms.length);
    return !levels.isEmpty();
  }
  if (params.getSymmLevels() > 0) {
    if (levels.size() == params.getSymmLevels())     return true;
  }
  CeSymmResult r=CeSymm.analyzeLevel(atoms,params);
  if (result == null)   result=r;
  if (params.getRefineMethod() == RefineMethod.NOT_REFINED)   return false;
 else   if (!result.isSignificant())   return !levels.isEmpty();
  Integer start=null;
  int it=0;
  while (start == null) {
    start=result.getMultipleAlignment().getBlocks().get(0).getAlignRes().get(0).get(it);
    it++;
  }
  Integer end=null;
  it=result.getMultipleAlignment().getBlocks().get(0).getAlignRes().get(0).size() - 1;
  while (end == null) {
    end=result.getMultipleAlignment().getBlocks().get(0).getAlignRes().get(0).get(it);
    it--;
  }
  Atom[] atomsR=Arrays.copyOfRange(atoms,start,end + 1);
  if (countHelixStrandSSE(atomsR) < params.getSSEThreshold())   return !levels.isEmpty();
  Block b=result.getMultipleAlignment().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) {
        alignGraph.get(pos1).add(pos2);
      }
    }
  }
  levels.add(result.getMultipleAlignment());
  return iterate(atomsR);
}

Fixed version (ground truth):
/** 
 * This method runs iteratively the analysis of one level of symmetry with CeSymm on the input Atom array until no more symmetries exist.
 * @param atoms representative Atom array of the Structure
 * @return true if any symmetry was found, false if asymmetric
 * @throws StructureException
 */
private boolean iterate(Atom[] atoms) throws StructureException {
  logger.debug("String_Node_Str");
  if (atoms.length <= params.getWinSize() || atoms.length <= params.getMinCoreLength()) {
    logger.debug("String_Node_Str" + "String_Node_Str",atoms.length);
    return !levels.isEmpty();
  }
  if (params.getSymmLevels() > 0) {
    if (levels.size() == params.getSymmLevels())     return true;
  }
  CeSymmResult r=CeSymm.analyzeLevel(atoms,params);
  if (result == null)   result=r;
  if (params.getRefineMethod() == RefineMethod.NOT_REFINED)   return false;
 else   if (!r.isSignificant())   return !levels.isEmpty();
  Integer start=null;
  int it=0;
  while (start == null) {
    start=r.getMultipleAlignment().getBlocks().get(0).getAlignRes().get(0).get(it);
    it++;
  }
  Integer end=null;
  it=r.getMultipleAlignment().getBlocks().get(0).getAlignRes().get(0).size() - 1;
  while (end == null) {
    end=r.getMultipleAlignment().getBlocks().get(0).getAlignRes().get(0).get(it);
    it--;
  }
  Atom[] atomsR=Arrays.copyOfRange(atoms,start,end + 1);
  if (countHelixStrandSSE(atomsR) < params.getSSEThreshold())   return !levels.isEmpty();
  Block b=r.getMultipleAlignment().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) {
        alignGraph.get(pos1).add(pos2);
      }
    }
  }
  levels.add(r.getMultipleAlignment());
  return iterate(atomsR);
}