nus-yam/ex-repair huggingface dataset:
Program: 16331
Project: 16331
Buggy source:
@Override public String colorBySequenceCluster(){
  Subunits subunits=rotationAxisAligner.getSubunits();
  int n=subunits.getSubunitCount();
  List<Integer> modelNumbers=subunits.getModelNumbers();
  List<String> chainIds=subunits.getChainIds();
  List<Integer> seqClusterIds=subunits.getSequenceClusterIds();
  int clusters=Collections.max(seqClusterIds) + 1;
  Color[] col=ColorBrewer.BrBG.getColorPalette(clusters);
  Color4f[] colors=ColorConverter.convertColor4f(col);
  Map<Color4f,List<String>> colorMap=new HashMap<Color4f,List<String>>();
  for (int i=0; i < n; i++) {
    Color4f c=colors[seqClusterIds.get(i)];
    List<String> ids=colorMap.get(c);
    if (ids == null) {
      ids=new ArrayList<String>();
      colorMap.put(c,ids);
    }
    String id=getChainSpecification(modelNumbers,chainIds,i);
    ids.add(id);
  }
  return defaultColoring + getJmolColorScript(colorMap) + getJmolLigandScript();
}

Fixed version (ground truth):
@Override public String colorBySequenceCluster(){
  QuatSymmetrySubunits subunits=rotationAxisAligner.getSubunits();
  int n=subunits.getSubunitCount();
  List<Integer> modelNumbers=subunits.getModelNumbers();
  List<String> chainIds=subunits.getChainIds();
  List<Integer> seqClusterIds=subunits.getClusterIds();
  int clusters=Collections.max(seqClusterIds) + 1;
  Color[] col=ColorBrewer.BrBG.getColorPalette(clusters);
  Color4f[] colors=ColorConverter.convertColor4f(col);
  Map<Color4f,List<String>> colorMap=new HashMap<Color4f,List<String>>();
  for (int i=0; i < n; i++) {
    Color4f c=colors[seqClusterIds.get(i)];
    List<String> ids=colorMap.get(c);
    if (ids == null) {
      ids=new ArrayList<String>();
      colorMap.put(c,ids);
    }
    String id=getChainSpecification(modelNumbers,chainIds,i);
    ids.add(id);
  }
  return defaultColoring + getJmolColorScript(colorMap) + getJmolLigandScript();
}
Program: 16332
Project: 16332
Buggy source:
public abstract Subunits getSubunits();

Fixed version (ground truth):
public abstract QuatSymmetrySubunits getSubunits();
Program: 16333
Project: 16333
Buggy source:
@Override public Subunits getSubunits(){
  return subunits;
}

Fixed version (ground truth):
@Override public QuatSymmetrySubunits getSubunits(){
  return subunits;
}
Program: 16334
Project: 16334
Buggy source:
public RotationAxisAligner(QuatSymmetryResults results){
  this.subunits=results.getSubunits();
  this.rotationGroup=results.getRotationGroup();
  if (subunits == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (rotationGroup == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (subunits.getSubunitCount() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (rotationGroup.getOrder() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}

Fixed version (ground truth):
public RotationAxisAligner(QuatSymmetryResults results){
  this.subunits=new QuatSymmetrySubunits(results.getSubunitClusters());
  this.rotationGroup=results.getRotationGroup();
  if (subunits == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (rotationGroup == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (subunits.getSubunitCount() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (rotationGroup.getOrder() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 16335
Project: 16335
Buggy source:
@Override public Subunits getSubunits(){
  return subunits;
}

Fixed version (ground truth):
@Override public QuatSymmetrySubunits getSubunits(){
  return subunits;
}
Program: 16336
Project: 16336
Buggy source:
public C2RotationSolver(Subunits subunits,QuatSymmetryParameters parameters){
  if (subunits.getSubunitCount() != 2) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.subunits=subunits;
  this.parameters=parameters;
}

Fixed version (ground truth):
public C2RotationSolver(QuatSymmetrySubunits subunits,QuatSymmetryParameters parameters){
  if (subunits.getSubunitCount() != 2) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.subunits=subunits;
  this.parameters=parameters;
}
Program: 16337
Project: 16337
Buggy source:
private List<Point3d[]> calcRepeatUnits(){
  Set<Integer> uniqueModels=new HashSet<Integer>(subunits.getModelNumbers());
  int modelCount=uniqueModels.size();
  List<Integer> folds=this.subunits.getFolds();
  int maxFold=folds.get(folds.size() - 1);
  List<Point3d[]> repeatTraces=new ArrayList<Point3d[]>();
  List<Integer> models=subunits.getModelNumbers();
  List<Point3d[]> traces=subunits.getTraces();
  if (maxFold % modelCount == 0 && modelCount > 1 && subunits.getSubunitCount() > 3) {
    for (int i=0; i < modelCount; i++) {
      List<Point3d> coords=new ArrayList<Point3d>();
      for (int j=0; j < models.size(); j++) {
        if (models.get(j) == i) {
          coords.addAll(Arrays.asList(traces.get(j)));
        }
      }
      Point3d[] x=new Point3d[coords.size()];
      coords.toArray(x);
      repeatTraces.add(SuperPosition.clonePoint3dArray(x));
    }
  }
 else {
    List<Integer> sequenceClusterIds=subunits.getSequenceClusterIds();
    for (int i=0; i < subunits.getSubunitCount(); i++) {
      if (sequenceClusterIds.get(i) == 0) {
        Point3d[] x=subunits.getTraces().get(i);
        repeatTraces.add(SuperPosition.clonePoint3dArray(x));
      }
    }
  }
  return repeatTraces;
}

Fixed version (ground truth):
private List<Point3d[]> calcRepeatUnits(){
  Set<Integer> uniqueModels=new HashSet<Integer>(subunits.getModelNumbers());
  int modelCount=uniqueModels.size();
  List<Integer> folds=this.subunits.getFolds();
  int maxFold=folds.get(folds.size() - 1);
  List<Point3d[]> repeatTraces=new ArrayList<Point3d[]>();
  List<Integer> models=subunits.getModelNumbers();
  List<Point3d[]> traces=subunits.getTraces();
  if (maxFold % modelCount == 0 && modelCount > 1 && subunits.getSubunitCount() > 3) {
    for (int i=0; i < modelCount; i++) {
      List<Point3d> coords=new ArrayList<Point3d>();
      for (int j=0; j < models.size(); j++) {
        if (models.get(j) == i) {
          coords.addAll(Arrays.asList(traces.get(j)));
        }
      }
      Point3d[] x=new Point3d[coords.size()];
      coords.toArray(x);
      repeatTraces.add(SuperPosition.clonePoint3dArray(x));
    }
  }
 else {
    List<Integer> sequenceClusterIds=subunits.getClusterIds();
    for (int i=0; i < subunits.getSubunitCount(); i++) {
      if (sequenceClusterIds.get(i) == 0) {
        Point3d[] x=subunits.getTraces().get(i);
        repeatTraces.add(SuperPosition.clonePoint3dArray(x));
      }
    }
  }
  return repeatTraces;
}
Program: 16338
Project: 16338
Buggy source:
public HelicalRepeatUnit(Subunits subunits){
  this.subunits=subunits;
}

Fixed version (ground truth):
public HelicalRepeatUnit(QuatSymmetrySubunits subunits){
  this.subunits=subunits;
}
Program: 16339
Project: 16339
Buggy source:
private List<Point3d> calcRepeatUnitCenters(){
  Set<Integer> uniqueModels=new HashSet<Integer>(subunits.getModelNumbers());
  int modelCount=uniqueModels.size();
  List<Integer> folds=this.subunits.getFolds();
  int maxFold=folds.get(folds.size() - 1);
  List<Point3d> repeatCenters=new ArrayList<Point3d>();
  List<Point3d> centers=subunits.getCenters();
  List<Integer> models=subunits.getModelNumbers();
  if (maxFold % modelCount == 0 && modelCount > 1 && subunits.getSubunitCount() > 3) {
    for (int i=0; i < modelCount; i++) {
      List<Integer> subunitIndices=new ArrayList<Integer>();
      Point3d p=new Point3d();
      int count=0;
      for (int j=0; j < models.size(); j++) {
        if (models.get(j) == i) {
          p.add(centers.get(j));
          subunitIndices.add(j);
          count++;
        }
      }
      p.scale(1.0 / count);
      repeatCenters.add(p);
      repeatUnitIndices.add(subunitIndices);
    }
  }
 else {
    List<Integer> sequenceClusterIds=subunits.getSequenceClusterIds();
    for (int i=0; i < subunits.getSubunitCount(); i++) {
      List<Integer> subunitIndices=new ArrayList<Integer>(1);
      if (sequenceClusterIds.get(i) == 0) {
        repeatCenters.add(new Point3d(centers.get(i)));
        subunitIndices.add(i);
        repeatUnitIndices.add(subunitIndices);
      }
    }
  }
  if (repeatCenters.size() < 3) {
    repeatCenters.clear();
  }
  return repeatCenters;
}

Fixed version (ground truth):
private List<Point3d> calcRepeatUnitCenters(){
  Set<Integer> uniqueModels=new HashSet<Integer>(subunits.getModelNumbers());
  int modelCount=uniqueModels.size();
  List<Integer> folds=this.subunits.getFolds();
  int maxFold=folds.get(folds.size() - 1);
  List<Point3d> repeatCenters=new ArrayList<Point3d>();
  List<Point3d> centers=subunits.getCenters();
  List<Integer> models=subunits.getModelNumbers();
  if (maxFold % modelCount == 0 && modelCount > 1 && subunits.getSubunitCount() > 3) {
    for (int i=0; i < modelCount; i++) {
      List<Integer> subunitIndices=new ArrayList<Integer>();
      Point3d p=new Point3d();
      int count=0;
      for (int j=0; j < models.size(); j++) {
        if (models.get(j) == i) {
          p.add(centers.get(j));
          subunitIndices.add(j);
          count++;
        }
      }
      p.scale(1.0 / count);
      repeatCenters.add(p);
      repeatUnitIndices.add(subunitIndices);
    }
  }
 else {
    List<Integer> sequenceClusterIds=subunits.getClusterIds();
    for (int i=0; i < subunits.getSubunitCount(); i++) {
      List<Integer> subunitIndices=new ArrayList<Integer>(1);
      if (sequenceClusterIds.get(i) == 0) {
        repeatCenters.add(new Point3d(centers.get(i)));
        subunitIndices.add(i);
        repeatUnitIndices.add(subunitIndices);
      }
    }
  }
  if (repeatCenters.size() < 3) {
    repeatCenters.clear();
  }
  return repeatCenters;
}
Program: 16340
Project: 16340
Buggy source:
public HelixExtender(Subunits subunits,Helix helix){
  this.subunits=subunits;
  this.helix=helix;
}

Fixed version (ground truth):
public HelixExtender(QuatSymmetrySubunits subunits,Helix helix){
  this.subunits=subunits;
  this.helix=helix;
}
Program: 16341
Project: 16341
Buggy source:
/** 
 * Returns a permutation of subunit indices for the given helix transformation. An index of -1 is used to indicate subunits that do not superpose onto any other subunit.
 * @param transformation
 * @return
 */
private List<Integer> getPermutation(Matrix4d transformation){
  double rmsdThresholdSq=Math.pow(this.parameters.getRmsdThreshold(),2);
  List<Point3d> centers=subunits.getOriginalCenters();
  List<Integer> seqClusterId=subunits.getSequenceClusterIds();
  List<Integer> permutations=new ArrayList<Integer>(centers.size());
  double[] dSqs=new double[centers.size()];
  boolean[] used=new boolean[centers.size()];
  Arrays.fill(used,false);
  for (int i=0; i < centers.size(); i++) {
    Point3d tCenter=new Point3d(centers.get(i));
    transformation.transform(tCenter);
    int permutation=-1;
    double minDistSq=Double.MAX_VALUE;
    for (int j=0; j < centers.size(); j++) {
      if (seqClusterId.get(i) == seqClusterId.get(j)) {
        if (!used[j]) {
          double dSq=tCenter.distanceSquared(centers.get(j));
          if (dSq < minDistSq && dSq <= rmsdThresholdSq) {
            minDistSq=dSq;
            permutation=j;
            dSqs[j]=dSq;
          }
        }
      }
    }
    if (permutations.size() == permutation) {
      permutation=-1;
    }
    if (permutation != -1) {
      used[permutation]=true;
    }
    permutations.add(permutation);
  }
  return permutations;
}

Fixed version (ground truth):
/** 
 * Returns a permutation of subunit indices for the given helix transformation. An index of -1 is used to indicate subunits that do not superpose onto any other subunit.
 * @param transformation
 * @return
 */
private List<Integer> getPermutation(Matrix4d transformation){
  double rmsdThresholdSq=Math.pow(this.parameters.getRmsdThreshold(),2);
  List<Point3d> centers=subunits.getOriginalCenters();
  List<Integer> seqClusterId=subunits.getClusterIds();
  List<Integer> permutations=new ArrayList<Integer>(centers.size());
  double[] dSqs=new double[centers.size()];
  boolean[] used=new boolean[centers.size()];
  Arrays.fill(used,false);
  for (int i=0; i < centers.size(); i++) {
    Point3d tCenter=new Point3d(centers.get(i));
    transformation.transform(tCenter);
    int permutation=-1;
    double minDistSq=Double.MAX_VALUE;
    for (int j=0; j < centers.size(); j++) {
      if (seqClusterId.get(i) == seqClusterId.get(j)) {
        if (!used[j]) {
          double dSq=tCenter.distanceSquared(centers.get(j));
          if (dSq < minDistSq && dSq <= rmsdThresholdSq) {
            minDistSq=dSq;
            permutation=j;
            dSqs[j]=dSq;
          }
        }
      }
    }
    if (permutations.size() == permutation) {
      permutation=-1;
    }
    if (permutation != -1) {
      used[permutation]=true;
    }
    permutations.add(permutation);
  }
  return permutations;
}
Program: 16342
Project: 16342
Buggy source:
public HelixSolver(Subunits subunits,int fold,QuatSymmetryParameters parameters){
  this.subunits=subunits;
  this.fold=fold;
  this.parameters=parameters;
}

Fixed version (ground truth):
public HelixSolver(QuatSymmetrySubunits subunits,int fold,QuatSymmetryParameters parameters){
  this.subunits=subunits;
  this.fold=fold;
  this.parameters=parameters;
}
Program: 16345
Project: 16345
Buggy source:
private static void calcIntrasubunitScores(Subunits subunits,Matrix4d transformation,List<Integer> permutation,QuatSymmetryScores scores){
  double totalSumTm=0;
  double totalSumDsq=0;
  double totalLength=0;
  List<Point3d[]> traces=subunits.getTraces();
  for (int i=0; i < traces.size(); i++) {
    if (permutation.get(i) == -1) {
      continue;
    }
    Point3d[] orig=traces.get(i);
    totalLength+=orig.length;
    Point3d[] perm=traces.get(permutation.get(i));
    int tmLen=Math.max(orig.length,17);
    double d0=1.24 * Math.cbrt(tmLen - 15.0) - 1.8;
    double d0Sq=d0 * d0;
    double sumTm=0;
    double sumDsq=0;
    Point3d[] trans=new Point3d[orig.length];
    for (int j=0; j < orig.length; j++) {
      trans[j]=new Point3d(perm[j]);
    }
    SuperPosition.superposeWithTranslation(trans,orig);
    for (int j=0; j < orig.length; j++) {
      double dSq=orig[j].distanceSquared(trans[j]);
      sumTm+=1.0 / (1.0 + dSq / d0Sq);
      sumDsq+=dSq;
    }
    totalSumTm+=sumTm;
    totalSumDsq+=sumDsq;
  }
  scores.setRmsdIntra(Math.sqrt(totalSumDsq / totalLength));
  scores.setTmIntra(totalSumTm / totalLength);
}

Fixed version (ground truth):
private static void calcIntrasubunitScores(QuatSymmetrySubunits subunits,Matrix4d transformation,List<Integer> permutation,QuatSymmetryScores scores){
  double totalSumTm=0;
  double totalSumDsq=0;
  double totalLength=0;
  List<Point3d[]> traces=subunits.getTraces();
  for (int i=0; i < traces.size(); i++) {
    if (permutation.get(i) == -1) {
      continue;
    }
    Point3d[] orig=traces.get(i);
    totalLength+=orig.length;
    Point3d[] perm=traces.get(permutation.get(i));
    int tmLen=Math.max(orig.length,17);
    double d0=1.24 * Math.cbrt(tmLen - 15.0) - 1.8;
    double d0Sq=d0 * d0;
    double sumTm=0;
    double sumDsq=0;
    Point3d[] trans=new Point3d[orig.length];
    for (int j=0; j < orig.length; j++) {
      trans[j]=new Point3d(perm[j]);
    }
    SuperPosition.superposeWithTranslation(trans,orig);
    for (int j=0; j < orig.length; j++) {
      double dSq=orig[j].distanceSquared(trans[j]);
      sumTm+=1.0 / (1.0 + dSq / d0Sq);
      sumDsq+=dSq;
    }
    totalSumTm+=sumTm;
    totalSumDsq+=sumDsq;
  }
  scores.setRmsdIntra(Math.sqrt(totalSumDsq / totalLength));
  scores.setTmIntra(totalSumTm / totalLength);
}
Program: 16346
Project: 16346
Buggy source:
/** 
 * This method is provisional and should only be used for coloring Subunits. A new coloring schema has to be implemented to allow the coloring of Subunits, without implying one Subunit = one Chain.
 * @return A List of the Chain Ids of each Subunit
 */
public List<String> getChainIds(){
  return clusters.stream().map(c -> c.getSubunits().get(0).getRepresentativeAtoms()[0].getGroup().getChainId()).collect(Collectors.toList());
}

Fixed version (ground truth):
/** 
 * This method is provisional and should only be used for coloring Subunits. A new coloring schema has to be implemented to allow the coloring of Subunits, without implying one Subunit = one Chain.
 * @return A List of the Chain Ids of each Subunit
 */
public List<String> getChainIds(){
  List<String> chains=new ArrayList<String>(getSubunitCount());
  for (int c=0; c < clusters.size(); c++) {
    for (int s=0; s < clusters.get(c).size(); s++)     chains.add(clusters.get(c).getSubunits().get(s).getName());
  }
  return chains;
}
Program: 16347
Project: 16347
Buggy source:
/** 
 * This method is provisional and should only be used for coloring Subunits. A new coloring schema has to be implemented to allow the coloring of Subunits, without implying one Subunit = one Chain.
 * @return A List of the Model number of each Subunit
 */
public List<Integer> getModelNumbers(){
  List<Integer> models=new ArrayList<Integer>(clusterIds.size());
  for (int c=0; c < clusters.size(); c++) {
    for (int s=0; s < clusters.get(c).size(); s++) {
      Atom[] atoms=clusters.get(c).getAlignedAtomsSubunit(s);
      Chain chain=atoms[0].getGroup().getChain();
      int model=0;
      for (int m=0; m < chain.getStructure().nrModels(); m++) {
        if (chain.getStructure().getModel(m).contains(chain)) {
          model=m;
          break;
        }
      }
      models.add(model);
    }
  }
  return models;
}

Fixed version (ground truth):
/** 
 * This method is provisional and should only be used for coloring Subunits. A new coloring schema has to be implemented to allow the coloring of Subunits, without implying one Subunit = one Chain.
 * @return A List of the Model number of each Subunit
 */
public List<Integer> getModelNumbers(){
  List<Integer> models=new ArrayList<Integer>(getSubunitCount());
  for (int c=0; c < clusters.size(); c++) {
    for (int s=0; s < clusters.get(c).size(); s++) {
      Atom[] atoms=clusters.get(c).getAlignedAtomsSubunit(s);
      Chain chain=atoms[0].getGroup().getChain();
      int model=0;
      for (int m=0; m < chain.getStructure().nrModels(); m++) {
        if (chain.getStructure().getModel(m).contains(chain)) {
          model=m;
          break;
        }
      }
      models.add(model);
    }
  }
  return models;
}
Program: 16348
Project: 16348
Buggy source:
@Override protected void initCoords(){
  try {
    if (ca1 == null || ca2 == null) {
      if (structure != null)       setStructure(structure);
 else {
        return;
      }
    }
    Structure artificial=DisplayAFP.getAlignedStructure(ca1,ca2);
    PDBHeader header=new PDBHeader();
    String title=afpChain.getAlgorithmName() + "String_Node_Str" + afpChain.getVersion()+ "String_Node_Str"+ afpChain.getName1()+ "String_Node_Str"+ afpChain.getName2();
    header.setTitle(title);
    artificial.setPDBHeader(header);
    setStructure(artificial);
  }
 catch (  StructureException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override protected void initCoords(){
  try {
    if (ca1 == null || ca2 == null) {
      if (structure != null)       setStructure(structure);
 else {
        return;
      }
    }
    Structure artificial=AlignmentTools.getAlignedStructure(ca1,ca2);
    PDBHeader header=new PDBHeader();
    String title=afpChain.getAlgorithmName() + "String_Node_Str" + afpChain.getVersion()+ "String_Node_Str"+ afpChain.getName1()+ "String_Node_Str"+ afpChain.getName2();
    header.setTitle(title);
    artificial.setPDBHeader(header);
    setStructure(artificial);
  }
 catch (  StructureException e) {
    e.printStackTrace();
  }
}
Program: 16349
Project: 16349
Buggy source:
/** 
 * Recursive helper
 * @param symmAxes output list
 * @param prior transformation aligning the first repeat of this axis with the first overall
 * @param level current level
 */
private void getSymmetryAxes(List<Axis> symmAxes,Matrix4d prior,int level,int firstRepeat){
  if (level >= getNumLevels()) {
    return;
  }
  Axis elem=axes.get(level);
  Matrix4d elemOp=elem.getOperator();
  Matrix4d currAxisOp=new Matrix4d(prior);
  currAxisOp.invert();
  currAxisOp.mul(elemOp);
  currAxisOp.mul(prior);
  Axis currAxis=new Axis(currAxisOp,elem.getOrder(),elem.getSymmType(),level,firstRepeat);
  symmAxes.add(currAxis);
  getSymmetryAxes(symmAxes,prior,level + 1,0);
  Matrix4d newPrior=new Matrix4d(elemOp);
  newPrior.mul(prior);
  int childSize=getNumRepeats(level + 1);
  getSymmetryAxes(symmAxes,newPrior,level + 1,childSize);
  for (int d=2; d < elem.getOrder(); d++) {
    newPrior.mul(elemOp,newPrior);
    getSymmetryAxes(symmAxes,newPrior,level + 1,childSize * d);
  }
}

Fixed version (ground truth):
/** 
 * Recursive helper
 * @param symmAxes output list
 * @param prior transformation aligning the first repeat of this axis with the first overall
 * @param level current level
 */
private void getSymmetryAxes(List<Axis> symmAxes,Matrix4d prior,int level,int firstRepeat){
  if (level >= getNumLevels()) {
    return;
  }
  Axis elem=axes.get(level);
  Matrix4d elemOp=elem.getOperator();
  Matrix4d currAxisOp=new Matrix4d(prior);
  currAxisOp.invert();
  currAxisOp.mul(elemOp);
  currAxisOp.mul(prior);
  Axis currAxis=new Axis(currAxisOp,elem.getOrder(),elem.getSymmType(),level,firstRepeat);
  symmAxes.add(currAxis);
  getSymmetryAxes(symmAxes,prior,level + 1,firstRepeat,concat(priorCounts,0));
  Matrix4d newPrior=new Matrix4d(elemOp);
  newPrior.mul(prior);
  int childSize=getNumRepeats(level + 1);
  getSymmetryAxes(symmAxes,newPrior,level + 1,firstRepeat + childSize,concat(priorCounts,1));
  for (int d=2; d < elem.getOrder(); d++) {
    newPrior.mul(elemOp,newPrior);
    getSymmetryAxes(symmAxes,newPrior,level + 1,firstRepeat + childSize * d,concat(priorCounts,d));
  }
}
Program: 16352
Project: 16352
Buggy source:
private void recordUnidentifiableModifiedResidues(List<ModifiedCompound> modComps){
  Set<StructureGroup> identifiedComps=new HashSet<StructureGroup>();
  for (  ModifiedCompound mc : modComps) {
    identifiedComps.addAll(mc.getGroups(true));
  }
  for (  Group group : residues) {
    if (group.getType().equals(GroupType.HETATM)) {
      StructureGroup strucGroup=StructureUtil.getStructureGroup(group,true);
      if (!identifiedComps.contains(strucGroup)) {
        unidentifiableModifiedResidues.add(strucGroup);
      }
    }
  }
}

Fixed version (ground truth):
private void recordUnidentifiableModifiedResidues(List<ModifiedCompound> modComps){
  Set<StructureGroup> identifiedComps=new HashSet<StructureGroup>();
  for (  ModifiedCompound mc : modComps) {
    identifiedComps.addAll(mc.getGroups(true));
  }
  for (  Group group : residues) {
    if (group.getType().equals(GroupType.HETATM)) {
      StructureGroup strucGroup=StructureUtil.getStructureGroup(group,true);
      strucGroup.setChainId(group.getChainId());
      if (!identifiedComps.contains(strucGroup)) {
        unidentifiableModifiedResidues.add(strucGroup);
      }
    }
  }
}
Program: 16354
Project: 16354
Buggy source:
/** 
 * @param recordUnidentifiableAtomLinkages true if choosing to record unidentifiableatoms; false, otherwise.
 * @see #getRecordUnidentifiableCompounds
 * @see #getUnidentifiableModifiedResidues
 * @see #getUnidentifiableAtomLinkages
 */
public void setRecordUnidentifiableCompounds(boolean recordUnidentifiableModifiedCompounds){
  this.recordUnidentifiableModifiedCompounds=recordUnidentifiableModifiedCompounds;
}

Fixed version (ground truth):
/** 
 * @param recordUnidentifiableModifiedCompounds true if choosing to record unidentifiableatoms; false, otherwise.
 * @see #getRecordUnidentifiableCompounds
 * @see #getUnidentifiableModifiedResidues
 * @see #getUnidentifiableAtomLinkages
 */
public void setRecordUnidentifiableCompounds(boolean recordUnidentifiableModifiedCompounds){
  this.recordUnidentifiableModifiedCompounds=recordUnidentifiableModifiedCompounds;
}
Program: 16355
Project: 16355
Buggy source:
/** 
 * @param atom a {@link Atom} in structure.
 * @param isParentAminoAcid true if the containing group is an amino acid.
 * @return the {@link StructureAtom} of the atom.
 */
public static StructureAtom getStructureAtom(Atom atom,boolean isParentAminoAcid){
  StructureGroup strucGroup=getStructureGroup(atom.getGroup(),isParentAminoAcid);
  return new StructureAtom(strucGroup,atom.getName());
}

Fixed version (ground truth):
/** 
 * @param atom a {@link Atom} in structure.
 * @param isParentAminoAcid true if the containing group is an amino acid.
 * @return the {@link StructureAtom} of the atom.
 */
public static StructureAtom getStructureAtom(Atom atom,boolean isParentAminoAcid){
  Group g=atom.getGroup();
  String chainId=g.getChainId();
  StructureGroup strucGroup=getStructureGroup(g,isParentAminoAcid);
  strucGroup.setChainId(chainId);
  return new StructureAtom(strucGroup,atom.getName());
}
Program: 16356
Project: 16356
Buggy source:
/** 
 * Find a linkage between two groups within tolerance of bond length.
 * @param group1 the first {@link Group}.
 * @param group2 the second {@link Group}.
 * @param nameOfAtomOnGroup1 atom name of the first group.
 * @param nameOfAtomOnGroup2 atom name of the second group.
 * @param bondLengthTolerance bond length error tolerance.
 * @return an array of two Atoms that form bond between each otherif found; null, otherwise.
 */
public static Atom[] findLinkage(final Group group1,final Group group2,String nameOfAtomOnGroup1,String nameOfAtomOnGroup2,double bondLengthTolerance){
  Atom[] ret=new Atom[2];
  double distance;
  ret[0]=group1.getAtom(nameOfAtomOnGroup1);
  ret[1]=group2.getAtom(nameOfAtomOnGroup2);
  if (ret[0] == null || ret[1] == null) {
    return null;
  }
  distance=Calc.getDistance(ret[0],ret[1]);
  float radiusOfAtom1=ret[0].getElement().getCovalentRadius();
  float radiusOfAtom2=ret[1].getElement().getCovalentRadius();
  if (Math.abs(distance - radiusOfAtom1 - radiusOfAtom2) > bondLengthTolerance) {
    return null;
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Find a linkage between two groups within tolerance of bond length.
 * @param group1 the first {@link Group}.
 * @param group2 the second {@link Group}.
 * @param nameOfAtomOnGroup1 atom name of the first group.
 * @param nameOfAtomOnGroup2 atom name of the second group.
 * @param bondLengthTolerance bond length error tolerance.
 * @return an array of two Atoms that form bond between each otherif found; null, otherwise.
 */
public static Atom[] findLinkage(final Group group1,final Group group2,String nameOfAtomOnGroup1,String nameOfAtomOnGroup2,double bondLengthTolerance){
  Atom[] ret=new Atom[2];
  ret[0]=group1.getAtom(nameOfAtomOnGroup1);
  ret[1]=group2.getAtom(nameOfAtomOnGroup2);
  if (ret[0] == null || ret[1] == null) {
    return null;
  }
  Atom a1=ret[0];
  Atom a2=ret[1];
  boolean hasBond=a1.hasBond(a2);
  if (hasBond) {
    return ret;
  }
  double distance=Calc.getDistance(a1,a2);
  float radiusOfAtom1=ret[0].getElement().getCovalentRadius();
  float radiusOfAtom2=ret[1].getElement().getCovalentRadius();
  if (Math.abs(distance - radiusOfAtom1 - radiusOfAtom2) > bondLengthTolerance) {
    return null;
  }
  return ret;
}
Program: 16357
Project: 16357
Buggy source:
public List<ModifiedCompound> testXMLSerialization(String pdbId){
  String xml=null;
  ModifiedCompound currentMC=null;
  List<ModifiedCompound> all=new ArrayList<ModifiedCompound>();
  try {
    Structure struc=TmpAtomCache.cache.getStructure(pdbId);
    ProteinModificationIdentifier parser=new ProteinModificationIdentifier();
    for (    Chain c : struc.getChains()) {
      parser.identify(c,ProteinModificationRegistry.allModifications());
      Set<ModifiedCompound> mcs=parser.getIdentifiedModifiedCompound();
      for (      ModifiedCompound mc : mcs) {
        currentMC=mc;
        xml=doXMLSerialization(mc);
        ModifiedCompound newMC=getModifiedCompoundFromXML(xml);
        String xml2=doXMLSerialization(newMC);
        assertEquals(xml,xml2);
        all.add(mc);
      }
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",pdbId);
    logger.error(currentMC.getDescription());
    logger.error(xml,e);
    fail(e.getMessage());
  }
  xml=null;
  currentMC=null;
  return all;
}

Fixed version (ground truth):
public List<ModifiedCompound> testXMLSerialization(String pdbId){
  String xml=null;
  ModifiedCompound currentMC=null;
  List<ModifiedCompound> all=new ArrayList<ModifiedCompound>();
  try {
    Structure struc=TmpAtomCache.cache.getStructure(pdbId);
    ProteinModificationIdentifier parser=new ProteinModificationIdentifier();
    for (    Chain c : struc.getChains()) {
      parser.identify(c,ProteinModificationRegistry.allModifications());
      Set<ModifiedCompound> mcs=parser.getIdentifiedModifiedCompound();
      for (      ModifiedCompound mc : mcs) {
        currentMC=mc;
        xml=doXMLSerialization(mc);
        ModifiedCompound newMC=getModifiedCompoundFromXML(xml);
        String xml2=doXMLSerialization(newMC);
        assertEquals(xml,xml2);
        all.add(mc);
      }
    }
  }
 catch (  Exception e) {
    logger.error(e.getMessage(),e);
    logger.error("String_Node_Str",pdbId);
    logger.error(currentMC.getDescription());
    logger.error(xml,e);
    fail(e.getMessage());
  }
  xml=null;
  currentMC=null;
  return all;
}
Program: 16359
Project: 16359
Buggy source:
private void printResult(String pdbId,ProteinModificationIdentifier parser,boolean recordUnidentifiable){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append(pdbId);
  sb.append("String_Node_Str");
  Set<ModifiedCompound> mcs=parser.getIdentifiedModifiedCompound();
  int i=0;
  for (  ModifiedCompound mc : mcs) {
    sb.append("String_Node_Str");
    sb.append(++i);
    sb.append("String_Node_Str");
    sb.append(mc);
    sb.append('\n');
  }
  if (recordUnidentifiable) {
    Set<StructureGroup> unidentifiedModifiedResidues=parser.getUnidentifiableModifiedResidues();
    i=0;
    for (    StructureGroup group : unidentifiedModifiedResidues) {
      sb.append("String_Node_Str");
      sb.append(++i);
      sb.append("String_Node_Str");
      sb.append(group);
      sb.append('\n');
    }
    Set<StructureAtomLinkage> unidentifiedLinkages=parser.getUnidentifiableAtomLinkages();
    i=0;
    for (    StructureAtomLinkage link : unidentifiedLinkages) {
      sb.append("String_Node_Str");
      sb.append(++i);
      sb.append("String_Node_Str");
      sb.append(link);
      sb.append('\n');
    }
  }
  logger.info(sb.toString());
}

Fixed version (ground truth):
private void printResult(String pdbId,ProteinModificationIdentifier parser,boolean recordUnidentifiable){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append(pdbId);
  sb.append("String_Node_Str");
  Set<ModifiedCompound> mcs=parser.getIdentifiedModifiedCompound();
  int i=0;
  for (  ModifiedCompound mc : mcs) {
    sb.append("String_Node_Str");
    sb.append(++i);
    sb.append("String_Node_Str");
    sb.append(mc.getAtomLinkages());
    sb.append('\n');
  }
  if (recordUnidentifiable) {
    Set<StructureGroup> unidentifiedModifiedResidues=parser.getUnidentifiableModifiedResidues();
    i=0;
    for (    StructureGroup group : unidentifiedModifiedResidues) {
      sb.append("String_Node_Str");
      sb.append(++i);
      sb.append("String_Node_Str");
      sb.append(group);
      sb.append('\n');
    }
    Set<StructureAtomLinkage> unidentifiedLinkages=parser.getUnidentifiableAtomLinkages();
    i=0;
    for (    StructureAtomLinkage link : unidentifiedLinkages) {
      sb.append("String_Node_Str");
      sb.append(++i);
      sb.append("String_Node_Str");
      sb.append(link);
      sb.append('\n');
    }
  }
  logger.info(sb.toString());
}
Program: 16360
Project: 16360
Buggy source:
public static String[][] setUpShortTest(){
  String[][] strucs=new String[][]{{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str",null}};
  return strucs;
}

Fixed version (ground truth):
public static String[][] setUpShortTest(){
  String[][] strucs=new String[][]{{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str","String_Node_Str"},{"String_Node_Str",null},{"String_Node_Str",null}};
  return strucs;
}
Program: 16361
Project: 16361
Buggy source:
private void parserTest(String pdbId,Set<ProteinModification> mods) throws IOException, StructureException {
  Structure struc=TmpAtomCache.cache.getStructure(pdbId);
  ProteinModificationIdentifier parser=new ProteinModificationIdentifier();
  boolean recordUnidentifiable=false;
  parser.setRecordUnidentifiableCompounds(recordUnidentifiable);
  assertFalse(mods.isEmpty());
  parser.identify(struc,mods);
  if (!parser.getIdentifiedModifiedCompound().isEmpty()) {
    logger.warn("String_Node_Str",pdbId);
  }
  assertFalse("String_Node_Str" + pdbId,parser.getIdentifiedModifiedCompound().isEmpty());
  boolean print=false;
  if (print)   printResult(pdbId,parser,recordUnidentifiable);
}

Fixed version (ground truth):
private void parserTest(String pdbId,Set<ProteinModification> mods) throws IOException, StructureException {
  Structure struc=TmpAtomCache.cache.getStructure(pdbId);
  ProteinModificationIdentifier parser=new ProteinModificationIdentifier();
  boolean recordUnidentifiable=false;
  parser.setRecordUnidentifiableCompounds(recordUnidentifiable);
  assertFalse(mods.isEmpty());
  parser.identify(struc,mods);
  if (parser.getIdentifiedModifiedCompound().isEmpty()) {
    String msg="String_Node_Str" + pdbId;
    logger.warn(msg);
    fail(msg);
  }
  assertFalse("String_Node_Str" + pdbId,parser.getIdentifiedModifiedCompound().isEmpty());
  boolean print=false;
  if (print)   printResult(pdbId,parser,recordUnidentifiable);
}
Program: 16362
Project: 16362
Buggy source:
/** 
 * Recursive helper
 * @param symmAxes output list
 * @param prior transformation aligning the first repeat of this axis with the first overall
 * @param level current level
 */
private void getSymmetryAxes(List<Axis> symmAxes,Matrix4d prior,int level,int firstRepeat){
  if (level >= getNumLevels()) {
    return;
  }
  Axis elem=axes.get(level);
  Matrix4d elemOp=elem.getOperator();
  Matrix4d currAxisOp=new Matrix4d(prior);
  currAxisOp.invert();
  currAxisOp.mul(elemOp);
  currAxisOp.mul(prior);
  Axis currAxis=new Axis(currAxisOp,elem.getOrder(),elem.getSymmType(),level,firstRepeat);
  symmAxes.add(currAxis);
  getSymmetryAxes(symmAxes,prior,level + 1,firstRepeat,concat(priorCounts,0));
  Matrix4d newPrior=new Matrix4d(elemOp);
  newPrior.mul(prior);
  int childSize=getNumRepeats(level + 1);
  getSymmetryAxes(symmAxes,newPrior,level + 1,firstRepeat + childSize,concat(priorCounts,1));
  for (int d=2; d < elem.getOrder(); d++) {
    newPrior.mul(elemOp,newPrior);
    getSymmetryAxes(symmAxes,newPrior,level + 1,firstRepeat + childSize * d,concat(priorCounts,d));
  }
}

Fixed version (ground truth):
/** 
 * Recursive helper
 * @param symmAxes output list
 * @param prior transformation aligning the first repeat of this axis with the first overall
 * @param level current level
 */
private void getSymmetryAxes(List<Axis> symmAxes,Matrix4d prior,int level,int firstRepeat){
  if (level >= getNumLevels()) {
    return;
  }
  Axis elem=axes.get(level);
  Matrix4d elemOp=elem.getOperator();
  Matrix4d currAxisOp=new Matrix4d(prior);
  currAxisOp.invert();
  currAxisOp.mul(elemOp);
  currAxisOp.mul(prior);
  Axis currAxis=new Axis(currAxisOp,elem.getOrder(),elem.getSymmType(),level,firstRepeat);
  symmAxes.add(currAxis);
  getSymmetryAxes(symmAxes,prior,level + 1,firstRepeat);
  Matrix4d newPrior=new Matrix4d(elemOp);
  newPrior.mul(prior);
  int childSize=getNumRepeats(level + 1);
  getSymmetryAxes(symmAxes,newPrior,level + 1,firstRepeat + childSize);
  for (int d=2; d < elem.getOrder(); d++) {
    newPrior.mul(elemOp,newPrior);
    getSymmetryAxes(symmAxes,newPrior,level + 1,firstRepeat + childSize * d);
  }
}
Program: 16365
Project: 16365
Buggy source:
/** 
 * @param recordUnidentifiableAtomLinkages true if choosing to record unidentifiableatoms; false, otherwise.
 * @see #getRecordUnidentifiableCompounds
 * @see #getUnidentifiableModifiedResidues
 * @see #getUnidentifiableAtomLinkages
 */
public void setRecordUnidentifiableCompounds(boolean recordUnidentifiableModifiedCompounds){
  this.recordUnidentifiableModifiedCompounds=recordUnidentifiableModifiedCompounds;
}

Fixed version (ground truth):
/** 
 * @param recordUnidentifiableModifiedCompounds true if choosing to record unidentifiableatoms; false, otherwise.
 * @see #getRecordUnidentifiableCompounds
 * @see #getUnidentifiableModifiedResidues
 * @see #getUnidentifiableAtomLinkages
 */
public void setRecordUnidentifiableCompounds(boolean recordUnidentifiableModifiedCompounds){
  this.recordUnidentifiableModifiedCompounds=recordUnidentifiableModifiedCompounds;
}
Program: 16366
Project: 16366
Buggy source:
/** 
 * @param atom a {@link Atom} in structure.
 * @param isParentAminoAcid true if the containing group is an amino acid.
 * @return the {@link StructureAtom} of the atom.
 */
public static StructureAtom getStructureAtom(Atom atom,boolean isParentAminoAcid){
  StructureGroup strucGroup=getStructureGroup(atom.getGroup(),isParentAminoAcid);
  return new StructureAtom(strucGroup,atom.getName());
}

Fixed version (ground truth):
/** 
 * @param atom a {@link Atom} in structure.
 * @param isParentAminoAcid true if the containing group is an amino acid.
 * @return the {@link StructureAtom} of the atom.
 */
public static StructureAtom getStructureAtom(Atom atom,boolean isParentAminoAcid){
  Group g=atom.getGroup();
  String chainId=g.getChainId();
  StructureGroup strucGroup=getStructureGroup(g,isParentAminoAcid);
  strucGroup.setChainId(chainId);
  return new StructureAtom(strucGroup,atom.getName());
}
Program: 16367
Project: 16367
Buggy source:
/** 
 * Find a linkage between two groups within tolerance of bond length.
 * @param group1 the first {@link Group}.
 * @param group2 the second {@link Group}.
 * @param nameOfAtomOnGroup1 atom name of the first group.
 * @param nameOfAtomOnGroup2 atom name of the second group.
 * @param bondLengthTolerance bond length error tolerance.
 * @return an array of two Atoms that form bond between each otherif found; null, otherwise.
 */
public static Atom[] findLinkage(final Group group1,final Group group2,String nameOfAtomOnGroup1,String nameOfAtomOnGroup2,double bondLengthTolerance){
  Atom[] ret=new Atom[2];
  double distance;
  ret[0]=group1.getAtom(nameOfAtomOnGroup1);
  ret[1]=group2.getAtom(nameOfAtomOnGroup2);
  if (ret[0] == null || ret[1] == null) {
    return null;
  }
  distance=Calc.getDistance(ret[0],ret[1]);
  float radiusOfAtom1=ret[0].getElement().getCovalentRadius();
  float radiusOfAtom2=ret[1].getElement().getCovalentRadius();
  if (Math.abs(distance - radiusOfAtom1 - radiusOfAtom2) > bondLengthTolerance) {
    return null;
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Find a linkage between two groups within tolerance of bond length.
 * @param group1 the first {@link Group}.
 * @param group2 the second {@link Group}.
 * @param nameOfAtomOnGroup1 atom name of the first group.
 * @param nameOfAtomOnGroup2 atom name of the second group.
 * @param bondLengthTolerance bond length error tolerance.
 * @return an array of two Atoms that form bond between each otherif found; null, otherwise.
 */
public static Atom[] findLinkage(final Group group1,final Group group2,String nameOfAtomOnGroup1,String nameOfAtomOnGroup2,double bondLengthTolerance){
  Atom[] ret=new Atom[2];
  ret[0]=group1.getAtom(nameOfAtomOnGroup1);
  ret[1]=group2.getAtom(nameOfAtomOnGroup2);
  if (ret[0] == null || ret[1] == null) {
    return null;
  }
  Atom a1=ret[0];
  Atom a2=ret[1];
  boolean hasBond=a1.hasBond(a2);
  if (hasBond) {
    return ret;
  }
  if (a1.getElement().isMetal() || a2.getElement().isMetal()) {
    MetalBondDistance defined=getMetalDistanceCutoff(a1.getElement().name(),a2.getElement().name());
    if (defined != null) {
      if (hasMetalBond(a1,a2,defined))       return ret;
 else       return null;
    }
  }
  double distance=Calc.getDistance(a1,a2);
  float radiusOfAtom1=ret[0].getElement().getCovalentRadius();
  float radiusOfAtom2=ret[1].getElement().getCovalentRadius();
  if (Math.abs(distance - radiusOfAtom1 - radiusOfAtom2) > bondLengthTolerance) {
    return null;
  }
  return ret;
}
Program: 16368
Project: 16368
Buggy source:
/** 
 * Recursive helper
 * @param symmAxes output list
 * @param prior transformation aligning the first repeat of this axis with the first overall
 * @param level current level
 */
private void getSymmetryAxes(List<Axis> symmAxes,Matrix4d prior,int level,int firstRepeat){
  if (level >= getNumLevels()) {
    return;
  }
  Axis elem=axes.get(level);
  Matrix4d elemOp=elem.getOperator();
  Matrix4d invPrior=new Matrix4d(prior);
  invPrior.invert();
  Matrix4d currAxisOp=new Matrix4d(prior);
  currAxisOp.mul(elemOp);
  Matrix4d newPrior=new Matrix4d(currAxisOp);
  currAxisOp.mul(invPrior);
  Axis currAxis=new Axis(currAxisOp,elem.getOrder(),elem.getSymmType());
  currAxis.setLevel(level);
  currAxis.setFirstRepeat(firstRepeat);
  symmAxes.add(currAxis);
  getSymmetryAxes(symmAxes,prior,level + 1,0);
  int childSize=getNumRepeats(level + 1);
  getSymmetryAxes(symmAxes,newPrior,level + 1,childSize);
  for (int d=2; d < elem.getOrder(); d++) {
    newPrior.mul(elemOp);
    getSymmetryAxes(symmAxes,newPrior,level + 1,childSize * d);
  }
}

Fixed version (ground truth):
/** 
 * Recursive helper
 * @param symmAxes output list
 * @param prior transformation aligning the first repeat of this axis with the first overall
 * @param level current level
 */
private void getSymmetryAxes(List<Axis> symmAxes,Matrix4d prior,int level,int firstRepeat){
  if (level >= getNumLevels()) {
    return;
  }
  Axis elem=axes.get(level);
  Matrix4d elemOp=elem.getOperator();
  Matrix4d currAxisOp=new Matrix4d(prior);
  currAxisOp.invert();
  currAxisOp.mul(elemOp);
  currAxisOp.mul(prior);
  Axis currAxis=new Axis(currAxisOp,elem.getOrder(),elem.getSymmType());
  currAxis.setLevel(level);
  currAxis.setFirstRepeat(firstRepeat);
  symmAxes.add(currAxis);
  getSymmetryAxes(symmAxes,prior,level + 1,0);
  Matrix4d newPrior=new Matrix4d(elemOp);
  newPrior.mul(prior);
  int childSize=getNumRepeats(level + 1);
  getSymmetryAxes(symmAxes,newPrior,level + 1,childSize);
  for (int d=2; d < elem.getOrder(); d++) {
    newPrior.mul(elemOp,newPrior);
    getSymmetryAxes(symmAxes,newPrior,level + 1,childSize * d);
  }
}
Program: 16372
Project: 16372
Buggy source:
/** 
 * Generates a String that displays the symmetry axes of a structure.
 * @param symm CeSymmResult
 * @param allAxes Indicates whether all axes should be displayed or justthe elemenatary ones
 * @return
 * @throws StructureException
 */
public static String printSymmetryAxes(CeSymmResult symm,boolean allAxes) throws StructureException {
  int id=0;
  String script="String_Node_Str";
  SymmetryAxes axes=symm.getAxes();
  List<Atom[]> repeats=SymmetryTools.toRepeatsAlignment(symm).getAtomArrays();
  List<Axis> symmAxes;
  if (allAxes) {
    symmAxes=axes.getSymmetryAxes();
  }
 else {
    symmAxes=axes.getElementaryAxesObjects();
  }
  for (  Axis a : symmAxes) {
    RotationAxis rot=a.getRotationAxis();
    Set<Integer> repIndex=new TreeSet<Integer>(axes.getRepeatRelation(a).get(0));
    repIndex.addAll(axes.getRepeatRelation(a).get(1));
    List<Atom> repAtoms=new ArrayList<Atom>();
    for (    Integer r : repIndex)     repAtoms.addAll(Arrays.asList(repeats.get(r)));
    script+=rot.getJmolScript(repAtoms.toArray(new Atom[repAtoms.size()]),id);
    id++;
  }
  return script;
}

Fixed version (ground truth):
/** 
 * Generates a String that displays the symmetry axes of a structure.
 * @param symm CeSymmResult
 * @param allAxes Indicates whether all axes should be displayed or justthe elemenatary ones
 * @return
 * @throws StructureException
 */
public static String printSymmetryAxes(CeSymmResult symm,boolean allAxes) throws StructureException {
  int id=0;
  String script="String_Node_Str";
  SymmetryAxes axes=symm.getAxes();
  List<Atom[]> repeats=SymmetryTools.toRepeatsAlignment(symm).getAtomArrays();
  List<Axis> symmAxes;
  if (allAxes) {
    symmAxes=axes.getSymmetryAxes();
  }
 else {
    symmAxes=axes.getElementaryAxesObjects();
  }
  for (  Axis a : symmAxes) {
    RotationAxis rot=a.getRotationAxis();
    List<List<Integer>> cyclicForm=axes.getRepeatsCyclicForm(a);
    List<Atom> repAtoms=new ArrayList<Atom>();
    for (    List<Integer> cycle : cyclicForm) {
      for (      Integer repeat : cycle) {
        repAtoms.addAll(Arrays.asList(repeats.get(repeat)));
      }
    }
    script+=rot.getJmolScript(repAtoms.toArray(new Atom[repAtoms.size()]),id);
    id++;
  }
  return script;
}
Program: 16373
Project: 16373
Buggy source:
/** 
 * Adds a new axis of symmetry to the bottom level of the tree
 * @param axis the new axis of symmetry found
 * @param order number of parts that this axis divides the structure in
 * @param type indicates whether the axis has OPEN or CLOSED symmetry
 */
public void addAxis(Matrix4d axis,int order,SymmetryType type){
  axes.add(new Axis(axis,order,type));
}

Fixed version (ground truth):
/** 
 * Adds a new axis of symmetry to the bottom level of the tree
 * @param axis the new axis of symmetry found
 * @param order number of parts that this axis divides the structure in
 * @param type indicates whether the axis has OPEN or CLOSED symmetry
 */
public void addAxis(Matrix4d axis,int order,SymmetryType type){
  axes.add(new Axis(axis,order,type,axes.size(),0));
}
Program: 16374
Project: 16374
Buggy source:
public List<List<Integer>> getRepeatRelation(int level,int firstRepeat){
  Axis axis=axes.get(level);
  int m=getNumRepeats(level + 1);
  int d=axis.getOrder();
  int n=m * d;
  if (axis.getSymmType() == SymmetryType.OPEN) {
    n-=m;
  }
  if (firstRepeat % n != 0) {
    throw new IllegalArgumentException(String.format("String_Node_Str",firstRepeat,level));
  }
  List<Integer> repeats=new ArrayList<>(n);
  List<Integer> equiv=new ArrayList<>(n);
  for (int i=0; i < n; i++) {
    repeats.add(i + firstRepeat);
    equiv.add((i + m) % (m * d) + firstRepeat);
  }
  return Arrays.asList(repeats,equiv);
}

Fixed version (ground truth):
public List<List<Integer>> getRepeatRelation(int level,int firstRepeat){
  Axis axis=axes.get(level);
  int m=getNumRepeats(level + 1);
  int d=axis.getOrder();
  int n=m * d;
  if (firstRepeat % n != 0) {
    throw new IllegalArgumentException(String.format("String_Node_Str",firstRepeat,level));
  }
  if (axis.getSymmType() == SymmetryType.OPEN) {
    n-=m;
  }
  List<Integer> repeats=new ArrayList<>(n);
  List<Integer> equiv=new ArrayList<>(n);
  for (int i=0; i < n; i++) {
    repeats.add(i + firstRepeat);
    equiv.add((i + m) % (m * d) + firstRepeat);
  }
  return Arrays.asList(repeats,equiv);
}