Program: 37787
Project: 37787
Buggy source:
public void finishGen(Generation g){
  GAParameters params=GAParameters.getParams();
  int verbosity=params.getVerbosity();
  GAUtils.writeStringToFile("String_Node_Str" + Integer.toString(currentGenNum) + "String_Node_Str"+ g.getNumOrganisms()+ newline,outFile,true);
  for (  Organism o : g) {
    StructureOrg s=(StructureOrg)(o);
    s.getCell().writeCIF(makeCIFPath(s));
    File outFindSym=new File(makeFindSymPath(s));
    GAUtils.writeStringToFile(Isotropy.getFindsymOutput(s.getCell()),outFindSym,false);
  }
  List<Integer> energyList=new LinkedList<Integer>();
  for (int k=0; k < g.getNumOrganisms(); k++) {
    double lowest=Double.POSITIVE_INFINITY;
    int index=0;
    for (    Organism r : g) {
      double thisEnergy=r.getValue();
      if (thisEnergy < lowest && !energyList.contains(r.getID())) {
        index=r.getID();
        lowest=thisEnergy;
      }
    }
    energyList.add(k,index);
  }
  for (  Integer p : energyList) {
    Organism m=g.getOrgByID(p);
    StructureOrg s=(StructureOrg)(m);
    StringBuilder info=new StringBuilder();
    info.append(Integer.toString(s.getID()) + "String_Node_Str");
    info.append(Double.toString(s.getValue()) + "String_Node_Str");
    info.append(makeCIFPath(s) + newline);
    GAUtils.writeStringToFile(info.toString(),outFile,true);
  }
  int nAdapt=params.getNumDenAdapt();
  double weight=params.getWeightDenAdapt();
  double avgDen=0;
  for (int j=1; j <= nAdapt; j++) {
    Cell currentStruct=((StructureOrg)g.getNthBestOrganism(j)).getCell();
    avgDen+=currentStruct.getVolume() / currentStruct.getNumSites();
  }
  avgDen/=nAdapt;
  if (getRecord().getGenNum() == 0)   bestDenEstimate=avgDen;
 else {
    bestDenEstimate*=(1 - weight);
    bestDenEstimate+=weight * avgDen;
  }
  updateInEndgame(g);
  if (params.doingPDRun()) {
    String pdbuilder_out_fname=outDirName + "String_Node_Str" + currentGenNum+ "String_Node_Str";
    for (    Organism o : g.organisms)     if (!params.getPDBuilder().containsEntry((StructureOrg)o))     params.getPDBuilder().addEntry((StructureOrg)o);
    Utility.writeSerializable((params.getPDBuilder().getPDData()),pdbuilder_out_fname);
  }
  if (verbosity >= 1)   System.out.println(getGenSummary(g));
  currentGenNum++;
  currentGen=g;
  if (params.getSaveStateEachIter()) {
    GAParameters.getParams().getInitialOrgCreators().clear();
    String save_out_fname=outDirName + "String_Node_Str" + currentGenNum+ "String_Node_Str";
    Utility.writeSerializable(params,save_out_fname);
    if (verbosity >= 3)     System.out.println("String_Node_Str" + save_out_fname);
  }
}

Fixed version (ground truth):
public void finishGen(Generation g){
  GAParameters params=GAParameters.getParams();
  int verbosity=params.getVerbosity();
  GAUtils.writeStringToFile("String_Node_Str" + Integer.toString(currentGenNum) + "String_Node_Str"+ g.getNumOrganisms()+ newline,outFile,true);
  for (  Organism o : g) {
    StructureOrg s=(StructureOrg)(o);
    s.getCell().writeCIF(makeCIFPath(s));
    File outFindSym=new File(makeFindSymPath(s));
    GAUtils.writeStringToFile(Isotropy.getFindsymOutput(s.getCell()),outFindSym,false);
  }
  for (  Organism o : g.getOrganismsSorted()) {
    StructureOrg s=(StructureOrg)o;
    StringBuilder info=new StringBuilder();
    info.append(Integer.toString(s.getID()) + "String_Node_Str");
    info.append(Double.toString(s.getValue()) + "String_Node_Str");
    info.append(makeCIFPath(s) + newline);
    GAUtils.writeStringToFile(info.toString(),outFile,true);
  }
  int nAdapt=params.getNumDenAdapt();
  double weight=params.getWeightDenAdapt();
  double avgDen=0;
  for (int j=1; j <= nAdapt; j++) {
    Cell currentStruct=((StructureOrg)g.getNthBestOrganism(j)).getCell();
    avgDen+=currentStruct.getVolume() / currentStruct.getNumSites();
  }
  avgDen/=nAdapt;
  if (getRecord().getGenNum() == 0)   bestDenEstimate=avgDen;
 else {
    bestDenEstimate*=(1 - weight);
    bestDenEstimate+=weight * avgDen;
  }
  updateInEndgame(g);
  if (params.doingPDRun()) {
    String pdbuilder_out_fname=outDirName + "String_Node_Str" + currentGenNum+ "String_Node_Str";
    for (    Organism o : g.organisms)     if (!params.getPDBuilder().containsEntry((StructureOrg)o))     params.getPDBuilder().addEntry((StructureOrg)o);
    Utility.writeSerializable((params.getPDBuilder().getPDData()),pdbuilder_out_fname);
  }
  if (verbosity >= 1)   System.out.println(getGenSummary(g));
  currentGenNum++;
  currentGen=g;
  if (params.getSaveStateEachIter()) {
    GAParameters.getParams().getInitialOrgCreators().clear();
    String save_out_fname=outDirName + "String_Node_Str" + currentGenNum+ "String_Node_Str";
    Utility.writeSerializable(params,save_out_fname);
    if (verbosity >= 3)     System.out.println("String_Node_Str" + save_out_fname);
  }
}