Changeset 23409a for molecuilder/src


Ignore:
Timestamp:
Apr 28, 2008, 7:16:42 AM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
bd8439
Parents:
1f7265
Message:

OutputConfigForListOfFragments(): various ofstream gathered into a single one: output

Preparation for adding "AdjacencyFile" next

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/moleculelist.cpp

    r1f7265 r23409a  
    313313  char *FragmentNumber;
    314314  int FragmentCounter = 0;
    315   ofstream TEFile;
    316   ofstream ForcesFile;
    317   ofstream KeySetFile;
     315  ofstream output;
    318316  element *runner = NULL;
    319317 
     
    388386  // open file for the total energy factor
    389387  sprintf(TEFilename, "%s/%s%s", PathBackup, prefix, "TE-Factors.dat");
    390   TEFile.open(TEFilename, ios::out);
     388  output.open(TEFilename, ios::out);
    391389  // output TEList (later to file AtomicTEList.dat)
    392390  cout << Verbose(2) << "Saving " << prefix << " energy factors ...";
    393391  //cout << Verbose(1) << "Final ATEList: ";
    394   //less TEFile << prefix << "TE\t";
     392  //less output << prefix << "TE\t";
    395393  for(int i=0;i<NumberOfMolecules;i++) {
    396394    //cout << TEList[i] << "\t";
    397395    //if (TEList[i] != 0)
    398       TEFile << TEList[i] << "\t";
     396      output << TEList[i] << "\t";
    399397  }
    400398  //cout << endl;
    401   TEFile << endl;
    402   TEFile.close();
     399  output << endl;
     400  output.close();
    403401  cout << " done." << endl;
    404402 
    405403  // open file for the force factors
    406404  sprintf(TEFilename, "%s/%s%s", PathBackup, prefix, "Forces-Factors.dat");
    407   ForcesFile.open(TEFilename, ios::out);
     405  output.open(TEFilename, ios::out);
    408406  //cout << Verbose(1) << "Final AtomicForcesList: ";
    409407  cout << Verbose(2) << "Saving " << prefix << " force factors ...";
    410   //ForcesFile << prefix << "Forces" << endl;
     408  //output << prefix << "Forces" << endl;
    411409  for(int j=0;j<NumberOfMolecules;j++) {
    412410    //if (TEList[j] != 0) {
     
    421419            if ((Walker->GetTrueFather() != NULL) && (Walker->GetTrueFather() != Walker)) {// if there is a real father, prints its index
    422420              cerr << "Walker is " << *Walker << " with true father " << *( Walker->GetTrueFather()) << ", its number " << Walker->GetTrueFather()->nr << " and index " << SortIndex[Walker->GetTrueFather()->nr] << "." << endl; 
    423               ForcesFile <<  SortIndex[Walker->GetTrueFather()->nr] << "\t";
     421              output <<  SortIndex[Walker->GetTrueFather()->nr] << "\t";
    424422            } else  // otherwise a -1 to indicate an added saturation hydrogen
    425               ForcesFile << "-1\t";
     423              output << "-1\t";
    426424          }
    427425        }
     
    429427    }
    430428    //cout << endl << endl;
    431     ForcesFile << endl;
    432   }
    433   ForcesFile.close();
     429    output << endl;
     430  }
     431  output.close();
    434432  cout << " done." << endl;
    435433
    436434  // open KeySet file
    437435  sprintf(TEFilename, "%s/%s%s", PathBackup, prefix, "KeySets.dat");
    438   KeySetFile.open(TEFilename, ios::out);
     436  output.open(TEFilename, ios::out);
    439437  cout << Verbose(2) << "Saving " << prefix << " key sets of each subgraph ...";
    440438  for(int j=0;j<NumberOfMolecules;j++) {
     
    448446        if ((Walker->GetTrueFather() != NULL)) // if there is a real father, prints its index
    449447#endif
    450           KeySetFile <<  Walker->GetTrueFather()->nr << "\t";
     448          output <<  Walker->GetTrueFather()->nr << "\t";
    451449#ifdef ADDHYDROGEN
    452450        else  // otherwise a -1 to indicate an added saturation hydrogen
    453           KeySetFile << "-1\t";
     451          output << "-1\t";
    454452#endif
    455453      }
    456454      //cout << endl << endl;
    457       KeySetFile << endl;
    458     }
    459   KeySetFile.close();
     455      output << endl;
     456    }
     457  output.close();
    460458  cout << " done." << endl;
    461459 
Note: See TracChangeset for help on using the changeset viewer.