Changeset e138de for src/parser.cpp


Ignore:
Timestamp:
Nov 4, 2009, 7:56:04 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, Candidate_v1.7.0, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
1614174, e5ad5c
Parents:
7326b2
Message:

Huge change from ofstream * (const) out --> Log().

  • first shift was done via regular expressions
  • then via error messages from the code
  • note that class atom, class element and class molecule kept in parts their output stream, was they print to file.
  • make check runs fine
  • MISSING: Verbosity is not fixed for everything (i.e. if no endl; is present and next has Verbose(0) ...)

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/parser.cpp

    r7326b2 re138de  
    3030  if (input == NULL) {
    3131    if (!test)
    32       cout << endl << "Unable to open " << filename << ", is the directory correct?" << endl;
     32      Log() << Verbose(0) << endl << "Unable to open " << filename << ", is the directory correct?" << endl;
    3333    return false;
    3434  }
     
    107107bool MatrixContainer::InitialiseIndices(class MatrixContainer *Matrix)
    108108{
    109   cout << "Initialising indices";
     109  Log() << Verbose(0) << "Initialising indices";
    110110  if (Matrix == NULL) {
    111     cout << " with trivial mapping." << endl;
     111    Log() << Verbose(0) << " with trivial mapping." << endl;
    112112    Indices = Malloc<int*>(MatrixCounter + 1, "MatrixContainer::InitialiseIndices: **Indices");
    113113    for(int i=MatrixCounter+1;i--;) {
     
    117117    }
    118118  } else {
    119     cout << " from other MatrixContainer." << endl;
     119    Log() << Verbose(0) << " from other MatrixContainer." << endl;
    120120    if (MatrixCounter != Matrix->MatrixCounter)
    121121      return false;
     
    127127      for(int j=Matrix->RowCounter[i];j--;) {
    128128        Indices[i][j] = Matrix->Indices[i][j];
    129         //cout << Indices[i][j] << "\t";
     129        //Log() << Verbose(0) << Indices[i][j] << "\t";
    130130      }
    131       //cout << endl;
     131      //Log() << Verbose(0) << endl;
    132132    }
    133133  }
     
    156156
    157157  input.open(name, ios::in);
    158   //cout << "Opening " << name << " ... "  << input << endl;
     158  //Log() << Verbose(0) << "Opening " << name << " ... "  << input << endl;
    159159  if (input == NULL) {
    160     cerr << endl << "Unable to open " << name << ", is the directory correct?" << endl;
     160    eLog() << Verbose(0) << endl << "Unable to open " << name << ", is the directory correct?" << endl;
    161161    return false;
    162162  }
     
    171171  for(int k=skipcolumns;k--;)
    172172    line >> Header[MatrixNr];
    173   //cout << line.str() << endl;
     173  //Log() << Verbose(0) << line.str() << endl;
    174174  ColumnCounter[MatrixNr]=0;
    175175  while ( getline(line,token, '\t') ) {
     
    177177      ColumnCounter[MatrixNr]++;
    178178  }
    179   //cout << line.str() << endl;
    180   //cout << "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << "." << endl;
     179  //Log() << Verbose(0) << line.str() << endl;
     180  //Log() << Verbose(0) << "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << "." << endl;
    181181  if (ColumnCounter[MatrixNr] == 0)
    182     cerr << "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl;
     182    eLog() << Verbose(0) << "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl;
    183183 
    184184  // scan rest for number of rows/lines
     
    186186  while (!input.eof()) {
    187187    input.getline(filename, 1023);
    188     //cout << "Comparing: " << strncmp(filename,"MeanForce",9) << endl;
     188    //Log() << Verbose(0) << "Comparing: " << strncmp(filename,"MeanForce",9) << endl;
    189189    RowCounter[MatrixNr]++; // then line was not last MeanForce
    190190    if (strncmp(filename,"MeanForce", 9) == 0) {
     
    192192    }
    193193  }
    194   //cout << "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from file " << name << "." << endl;
     194  //Log() << Verbose(0) << "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from file " << name << "." << endl;
    195195  if (RowCounter[MatrixNr] == 0)
    196     cerr << "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl;
     196    eLog() << Verbose(0) << "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl;
    197197
    198198  // allocate matrix if it's not zero dimension in one direction
     
    213213      input.getline(filename, 1023);
    214214      stringstream lines(filename);
    215       //cout << "Matrix at level " << j << ":";// << filename << endl;
     215      //Log() << Verbose(0) << "Matrix at level " << j << ":";// << filename << endl;
    216216      for(int k=skipcolumns;k--;)
    217217        lines >> filename;
    218218      for(int k=0;(k<ColumnCounter[MatrixNr]) && (!lines.eof());k++) {
    219219        lines >> Matrix[MatrixNr][j][k];
    220         //cout << " " << setprecision(2) << Matrix[MatrixNr][j][k];;
     220        //Log() << Verbose(0) << " " << setprecision(2) << Matrix[MatrixNr][j][k];;
    221221      }
    222       //cout << endl;
     222      //Log() << Verbose(0) << endl;
    223223      Matrix[MatrixNr][ RowCounter[MatrixNr] ] = Malloc<double>(ColumnCounter[MatrixNr], "MatrixContainer::ParseMatrix: *Matrix[RowCounter[MatrixNr]][]");
    224224      for(int j=ColumnCounter[MatrixNr];j--;)
     
    226226    }
    227227  } else {
    228     cerr << "ERROR: Matrix nr. " << MatrixNr << " has column and row count of (" << ColumnCounter[MatrixNr] << "," << RowCounter[MatrixNr] << "), could not allocate nor parse!" << endl;
     228    eLog() << Verbose(0) << "ERROR: Matrix nr. " << MatrixNr << " has column and row count of (" << ColumnCounter[MatrixNr] << "," << RowCounter[MatrixNr] << "), could not allocate nor parse!" << endl;
    229229  }
    230230  input.close();
     
    263263  input.open(file.str().c_str(), ios::in);
    264264  if (input == NULL) {
    265     cout << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;
     265    Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;
    266266    return false;
    267267  }
     
    272272  }
    273273  input.close();
    274   cout << "Determined " << MatrixCounter << " fragments." << endl;
    275 
    276   cout << "Parsing through each fragment and retrieving " << prefix << suffix << "." << endl;
     274  Log() << Verbose(0) << "Determined " << MatrixCounter << " fragments." << endl;
     275
     276  Log() << Verbose(0) << "Parsing through each fragment and retrieving " << prefix << suffix << "." << endl;
    277277  Header = ReAlloc<char*>(Header, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: **Header"); // one more each for the total molecule
    278278  Matrix = ReAlloc<double**>(Matrix, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: ***Matrix"); // one more each for the total molecule
     
    407407  // go through each order
    408408  for (int CurrentFragment=0;CurrentFragment<KeySets.FragmentsPerOrder[Order];CurrentFragment++) {
    409     //cout << "Current Fragment is " << CurrentFragment << "/" << KeySets.OrderSet[Order][CurrentFragment] << "." << endl;
     409    //Log() << Verbose(0) << "Current Fragment is " << CurrentFragment << "/" << KeySets.OrderSet[Order][CurrentFragment] << "." << endl;
    410410    // then go per order through each suborder and pick together all the terms that contain this fragment
    411411    for(int SubOrder=0;SubOrder<=Order;SubOrder++) { // go through all suborders up to the desired order
    412412      for (int j=0;j<KeySets.FragmentsPerOrder[SubOrder];j++) { // go through all possible fragments of size suborder
    413413        if (KeySets.Contains(KeySets.OrderSet[Order][CurrentFragment], KeySets.OrderSet[SubOrder][j])) {
    414           //cout << "Current other fragment is " << j << "/" << KeySets.OrderSet[SubOrder][j] << "." << endl;
     414          //Log() << Verbose(0) << "Current other fragment is " << j << "/" << KeySets.OrderSet[SubOrder][j] << "." << endl;
    415415          // if the fragment's indices are all in the current fragment
    416416          for(int k=0;k<RowCounter[ KeySets.OrderSet[SubOrder][j] ];k++) { // go through all atoms in this fragment
    417417            int m = MatrixValues.Indices[ KeySets.OrderSet[SubOrder][j] ][k];
    418             //cout << "Current index is " << k << "/" << m << "." << endl;
     418            //Log() << Verbose(0) << "Current index is " << k << "/" << m << "." << endl;
    419419            if (m != -1) { // if it's not an added hydrogen
    420420              for (int l=0;l<RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ];l++) { // look for the corresponding index in the current fragment
    421                 //cout << "Comparing " << m << " with " << MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][l] << "." << endl;
     421                //Log() << Verbose(0) << "Comparing " << m << " with " << MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][l] << "." << endl;
    422422                if (m == MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][l]) {
    423423                  m = l;
     
    425425                }
    426426              }
    427               //cout << "Corresponding index in CurrentFragment is " << m << "." << endl;
     427              //Log() << Verbose(0) << "Corresponding index in CurrentFragment is " << m << "." << endl;
    428428              if (m > RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) {
    429                 cerr << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current force index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl;
     429                eLog() << Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current force index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl;
    430430                return false;
    431431              }
     
    439439            }
    440440            //if ((ColumnCounter[ KeySets.OrderSet[SubOrder][j] ]>1) && (RowCounter[0]-1 >= 1))
    441              //cout << "Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << RowCounter[0]-1 << "][" << 1 << "] = " <<  Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][RowCounter[0]-1][1] << endl;
     441             //Log() << Verbose(0) << "Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << RowCounter[0]-1 << "][" << 1 << "] = " <<  Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][RowCounter[0]-1][1] << endl;
    442442          }
    443443        } else {
    444           //cout << "Fragment " << KeySets.OrderSet[SubOrder][j] << " is not contained in fragment " << KeySets.OrderSet[Order][CurrentFragment] << "." << endl;
     444          //Log() << Verbose(0) << "Fragment " << KeySets.OrderSet[SubOrder][j] << " is not contained in fragment " << KeySets.OrderSet[Order][CurrentFragment] << "." << endl;
    445445        }
    446446      }
    447447    }
    448    //cout << "Final Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << KeySets.AtomCounter[0]-1 << "][" << 1 << "] = " <<  Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][KeySets.AtomCounter[0]-1][1] << endl;
     448   //Log() << Verbose(0) << "Final Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << KeySets.AtomCounter[0]-1 << "][" << 1 << "] = " <<  Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][KeySets.AtomCounter[0]-1][1] << endl;
    449449  }
    450450
     
    462462  char *FragmentNumber = NULL;
    463463
    464   cout << "Writing fragment files." << endl;
     464  Log() << Verbose(0) << "Writing fragment files." << endl;
    465465  for(int i=0;i<MatrixCounter;i++) {
    466466    stringstream line;
     
    470470    output.open(line.str().c_str(), ios::out);
    471471    if (output == NULL) {
    472       cerr << "Unable to open output energy file " << line.str() << "!" << endl;
     472      eLog() << Verbose(0) << "Unable to open output energy file " << line.str() << "!" << endl;
    473473      return false;
    474474    }
     
    495495  stringstream line;
    496496
    497   cout << "Writing matrix values of " << suffix << "." << endl;
     497  Log() << Verbose(0) << "Writing matrix values of " << suffix << "." << endl;
    498498  line << name << prefix << suffix;
    499499  output.open(line.str().c_str(), ios::out);
    500500  if (output == NULL) {
    501     cerr << "Unable to open output matrix file " << line.str() << "!" << endl;
     501    eLog() << Verbose(0) << "Unable to open output matrix file " << line.str() << "!" << endl;
    502502    return false;
    503503  }
     
    520520bool EnergyMatrix::ParseIndices()
    521521{
    522   cout << "Parsing energy indices." << endl;
     522  Log() << Verbose(0) << "Parsing energy indices." << endl;
    523523  Indices = Malloc<int*>(MatrixCounter + 1, "EnergyMatrix::ParseIndices: **Indices");
    524524  for(int i=MatrixCounter+1;i--;) {
     
    579579    }
    580580    // allocate last plus one matrix
    581     cout << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;
     581    Log() << Verbose(0) << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;
    582582    Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
    583583    for(int j=0;j<=RowCounter[MatrixCounter];j++)
     
    606606  stringstream line;
    607607
    608   cout << "Parsing force indices for " << MatrixCounter << " matrices." << endl;
     608  Log() << Verbose(0) << "Parsing force indices for " << MatrixCounter << " matrices." << endl;
    609609  Indices = Malloc<int*>(MatrixCounter + 1, "ForceMatrix::ParseIndices: **Indices");
    610610  line << name << FRAGMENTPREFIX << FORCESFILE;
    611611  input.open(line.str().c_str(), ios::in);
    612   //cout << "Opening " << line.str() << " ... "  << input << endl;
     612  //Log() << Verbose(0) << "Opening " << line.str() << " ... "  << input << endl;
    613613  if (input == NULL) {
    614     cout << endl << "Unable to open " << line.str() << ", is the directory correct?" << endl;
     614    Log() << Verbose(0) << endl << "Unable to open " << line.str() << ", is the directory correct?" << endl;
    615615    return false;
    616616  }
     
    622622    Indices[i] = Malloc<int>(RowCounter[i], "ForceMatrix::ParseIndices: *Indices[]");
    623623    FragmentNumber = FixedDigitNumber(MatrixCounter, i);
    624     //cout << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:";
     624    //Log() << Verbose(0) << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:";
    625625    Free(&FragmentNumber);
    626626    for(int j=0;(j<RowCounter[i]) && (!line.eof());j++) {
    627627      line >> Indices[i][j];
    628       //cout << " " << Indices[i][j];
    629     }
    630     //cout << endl;
     628      //Log() << Verbose(0) << " " << Indices[i][j];
     629    }
     630    //Log() << Verbose(0) << endl;
    631631  }
    632632  Indices[MatrixCounter] = Malloc<int>(RowCounter[MatrixCounter], "ForceMatrix::ParseIndices: *Indices[]");
     
    655655      int j = Indices[ FragmentNr ][l];
    656656      if (j > RowCounter[MatrixCounter]) {
    657         cerr << "Current force index " << j << " is greater than " << RowCounter[MatrixCounter] << "!" << endl;
     657        eLog() << Verbose(0) << "Current force index " << j << " is greater than " << RowCounter[MatrixCounter] << "!" << endl;
    658658        return false;
    659659      }
    660660      if (j != -1) {
    661         //if (j == 0) cout << "Summing onto ion 0, type 0 from fragment " << FragmentNr << ", ion " << l << "." << endl;
     661        //if (j == 0) Log() << Verbose(0) << "Summing onto ion 0, type 0 from fragment " << FragmentNr << ", ion " << l << "." << endl;
    662662        for(int k=2;k<ColumnCounter[MatrixCounter];k++)
    663663          Matrix[MatrixCounter][j][k] += sign*Fragments.Matrix[ FragmentNr ][l][k];
     
    690690    input.open(file.str().c_str(), ios::in);
    691691    if (input == NULL) {
    692       cout << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;
     692      Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;
    693693      return false;
    694694    }
     
    699699      while (!zeile.eof()) {
    700700        zeile >> nr;
    701         //cout << "Current index: " << nr << "." << endl;
     701        //Log() << Verbose(0) << "Current index: " << nr << "." << endl;
    702702        if (nr > RowCounter[MatrixCounter])
    703703          RowCounter[MatrixCounter] = nr;
     
    714714 
    715715    // allocate last plus one matrix
    716     cout << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;
     716    Log() << Verbose(0) << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;
    717717    Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
    718718    for(int j=0;j<=RowCounter[MatrixCounter];j++)
     
    743743  stringstream line;
    744744 
    745   cout << "Parsing hessian indices for " << MatrixCounter << " matrices." << endl;
     745  Log() << Verbose(0) << "Parsing hessian indices for " << MatrixCounter << " matrices." << endl;
    746746  Indices = Malloc<int*>(MatrixCounter + 1, "HessianMatrix::ParseIndices: **Indices");
    747747  line << name << FRAGMENTPREFIX << FORCESFILE;
    748748  input.open(line.str().c_str(), ios::in);
    749   //cout << "Opening " << line.str() << " ... "  << input << endl;
     749  //Log() << Verbose(0) << "Opening " << line.str() << " ... "  << input << endl;
    750750  if (input == NULL) {
    751     cout << endl << "Unable to open " << line.str() << ", is the directory correct?" << endl;
     751    Log() << Verbose(0) << endl << "Unable to open " << line.str() << ", is the directory correct?" << endl;
    752752    return false;
    753753  }
     
    759759    Indices[i] = Malloc<int>(RowCounter[i], "HessianMatrix::ParseIndices: *Indices[]");
    760760    FragmentNumber = FixedDigitNumber(MatrixCounter, i);
    761     //cout << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:";
     761    //Log() << Verbose(0) << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:";
    762762    Free(&FragmentNumber);
    763763    for(int j=0;(j<RowCounter[i]) && (!line.eof());j++) {
    764764      line >> Indices[i][j];
    765       //cout << " " << Indices[i][j];
    766     }
    767     //cout << endl;
     765      //Log() << Verbose(0) << " " << Indices[i][j];
     766    }
     767    //Log() << Verbose(0) << endl;
    768768  }
    769769  Indices[MatrixCounter] = Malloc<int>(RowCounter[MatrixCounter], "HessianMatrix::ParseIndices: *Indices[]");
     
    792792      int j = Indices[ FragmentNr ][l];
    793793      if (j > RowCounter[MatrixCounter]) {
    794         cerr << "Current hessian index " << j << " is greater than " << RowCounter[MatrixCounter] << ", where i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl;
     794        eLog() << Verbose(0) << "Current hessian index " << j << " is greater than " << RowCounter[MatrixCounter] << ", where i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl;
    795795        return false;
    796796      }
     
    799799          int k = Indices[ FragmentNr ][m];
    800800          if (k > ColumnCounter[MatrixCounter]) {
    801             cerr << "Current hessian index " << k << " is greater than " << ColumnCounter[MatrixCounter] << ", where m=" << m << ", j=" << j << ", i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl;
     801            eLog() << Verbose(0) << "Current hessian index " << k << " is greater than " << ColumnCounter[MatrixCounter] << ", where m=" << m << ", j=" << j << ", i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl;
    802802            return false;
    803803          }
    804804          if (k != -1) {
    805             //cout << "Adding " << sign*Fragments.Matrix[ FragmentNr ][l][m] << " from [" << l << "][" << m << "] onto [" << j << "][" << k << "]." << endl;
     805            //Log() << Verbose(0) << "Adding " << sign*Fragments.Matrix[ FragmentNr ][l][m] << " from [" << l << "][" << m << "] onto [" << j << "][" << k << "]." << endl;
    806806            Matrix[MatrixCounter][j][k] += sign*Fragments.Matrix[ FragmentNr ][l][m];
    807807          }
     
    831831  // go through each order
    832832  for (int CurrentFragment=0;CurrentFragment<KeySets.FragmentsPerOrder[Order];CurrentFragment++) {
    833     //cout << "Current Fragment is " << CurrentFragment << "/" << KeySets.OrderSet[Order][CurrentFragment] << "." << endl;
     833    //Log() << Verbose(0) << "Current Fragment is " << CurrentFragment << "/" << KeySets.OrderSet[Order][CurrentFragment] << "." << endl;
    834834    // then go per order through each suborder and pick together all the terms that contain this fragment
    835835    for(int SubOrder=0;SubOrder<=Order;SubOrder++) { // go through all suborders up to the desired order
    836836      for (int j=0;j<KeySets.FragmentsPerOrder[SubOrder];j++) { // go through all possible fragments of size suborder
    837837        if (KeySets.Contains(KeySets.OrderSet[Order][CurrentFragment], KeySets.OrderSet[SubOrder][j])) {
    838           //cout << "Current other fragment is " << j << "/" << KeySets.OrderSet[SubOrder][j] << "." << endl;
     838          //Log() << Verbose(0) << "Current other fragment is " << j << "/" << KeySets.OrderSet[SubOrder][j] << "." << endl;
    839839          // if the fragment's indices are all in the current fragment
    840840          for(int k=0;k<RowCounter[ KeySets.OrderSet[SubOrder][j] ];k++) { // go through all atoms in this fragment
    841841            int m = MatrixValues.Indices[ KeySets.OrderSet[SubOrder][j] ][k];
    842             //cout << "Current row index is " << k << "/" << m << "." << endl;
     842            //Log() << Verbose(0) << "Current row index is " << k << "/" << m << "." << endl;
    843843            if (m != -1) { // if it's not an added hydrogen
    844844              for (int l=0;l<RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ];l++) { // look for the corresponding index in the current fragment
    845                 //cout << "Comparing " << m << " with " << MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][l] << "." << endl;
     845                //Log() << Verbose(0) << "Comparing " << m << " with " << MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][l] << "." << endl;
    846846                if (m == MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][l]) {
    847847                  m = l;
     
    849849                }
    850850              }
    851               //cout << "Corresponding row index for " << k << " in CurrentFragment is " << m << "." << endl;
     851              //Log() << Verbose(0) << "Corresponding row index for " << k << " in CurrentFragment is " << m << "." << endl;
    852852              if (m > RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) {
    853                 cerr << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current row index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl;
     853                eLog() << Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current row index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl;
    854854                return false;
    855855              }
     
    857857              for(int l=0;l<ColumnCounter[ KeySets.OrderSet[SubOrder][j] ];l++) {
    858858                int n = MatrixValues.Indices[ KeySets.OrderSet[SubOrder][j] ][l];
    859                 //cout << "Current column index is " << l << "/" << n << "." << endl;
     859                //Log() << Verbose(0) << "Current column index is " << l << "/" << n << "." << endl;
    860860                if (n != -1) { // if it's not an added hydrogen
    861861                  for (int p=0;p<ColumnCounter[ KeySets.OrderSet[Order][CurrentFragment] ];p++) { // look for the corresponding index in the current fragment
    862                     //cout << "Comparing " << n << " with " << MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][p] << "." << endl;
     862                    //Log() << Verbose(0) << "Comparing " << n << " with " << MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][p] << "." << endl;
    863863                    if (n == MatrixValues.Indices[ KeySets.OrderSet[Order][CurrentFragment] ][p]) {
    864864                      n = p;
     
    866866                    }
    867867                  }
    868                   //cout << "Corresponding column index for " << l << " in CurrentFragment is " << n << "." << endl;
     868                  //Log() << Verbose(0) << "Corresponding column index for " << l << " in CurrentFragment is " << n << "." << endl;
    869869                  if (n > ColumnCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) {
    870                     cerr << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current column index " << n << " is greater than " << ColumnCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl;
     870                    eLog() << Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current column index " << n << " is greater than " << ColumnCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl;
    871871                    return false;
    872872                  }
    873873                  if (Order == SubOrder) { // equal order is always copy from Energies
    874                     //cout << "Adding " << MatrixValues.Matrix[ KeySets.OrderSet[SubOrder][j] ][k][l] << " from [" << k << "][" << l << "] onto [" << m << "][" << n << "]." << endl;
     874                    //Log() << Verbose(0) << "Adding " << MatrixValues.Matrix[ KeySets.OrderSet[SubOrder][j] ][k][l] << " from [" << k << "][" << l << "] onto [" << m << "][" << n << "]." << endl;
    875875                    Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][m][n] += MatrixValues.Matrix[ KeySets.OrderSet[SubOrder][j] ][k][l];
    876876                  } else {
    877                     //cout << "Subtracting " << Matrix[ KeySets.OrderSet[SubOrder][j] ][k][l] << " from [" << k << "][" << l << "] onto [" << m << "][" << n << "]." << endl;
     877                    //Log() << Verbose(0) << "Subtracting " << Matrix[ KeySets.OrderSet[SubOrder][j] ][k][l] << " from [" << k << "][" << l << "] onto [" << m << "][" << n << "]." << endl;
    878878                    Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][m][n] -= Matrix[ KeySets.OrderSet[SubOrder][j] ][k][l];
    879879                  }
     
    882882            }
    883883            //if ((ColumnCounter[ KeySets.OrderSet[SubOrder][j] ]>1) && (RowCounter[0]-1 >= 1))
    884              //cout << "Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << RowCounter[0]-1 << "][" << 1 << "] = " <<  Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][RowCounter[0]-1][1] << endl;
     884             //Log() << Verbose(0) << "Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << RowCounter[0]-1 << "][" << 1 << "] = " <<  Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][RowCounter[0]-1][1] << endl;
    885885          }
    886886        } else {
    887           //cout << "Fragment " << KeySets.OrderSet[SubOrder][j] << " is not contained in fragment " << KeySets.OrderSet[Order][CurrentFragment] << "." << endl;
     887          //Log() << Verbose(0) << "Fragment " << KeySets.OrderSet[SubOrder][j] << " is not contained in fragment " << KeySets.OrderSet[Order][CurrentFragment] << "." << endl;
    888888        }
    889889      }
    890890    }
    891    //cout << "Final Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << KeySets.AtomCounter[0]-1 << "][" << 1 << "] = " <<  Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][KeySets.AtomCounter[0]-1][1] << endl;
     891   //Log() << Verbose(0) << "Final Fragments[ KeySets.OrderSet[" << Order << "][" << CurrentFragment << "]=" << KeySets.OrderSet[Order][CurrentFragment] << " ][" << KeySets.AtomCounter[0]-1 << "][" << 1 << "] = " <<  Matrix[ KeySets.OrderSet[Order][CurrentFragment] ][KeySets.AtomCounter[0]-1][1] << endl;
    892892  }
    893893 
     
    916916    input.open(file.str().c_str(), ios::in);
    917917    if (input == NULL) {
    918       cout << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;
     918      Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;
    919919      return false;
    920920    }
     
    926926      while (!zeile.eof()) {
    927927        zeile >> nr;
    928         //cout << "Current index: " << nr << "." << endl;
     928        //Log() << Verbose(0) << "Current index: " << nr << "." << endl;
    929929        if (nr > RowCounter[MatrixCounter]) {
    930930          RowCounter[MatrixCounter] = nr;
     
    938938 
    939939    // allocate last plus one matrix
    940     cout << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;
     940    Log() << Verbose(0) << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;
    941941    Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
    942942    for(int j=0;j<=RowCounter[MatrixCounter];j++)
     
    993993
    994994  FragmentCounter = FCounter;
    995   cout << "Parsing key sets." << endl;
     995  Log() << Verbose(0) << "Parsing key sets." << endl;
    996996  KeySets = Malloc<int*>(FragmentCounter, "KeySetsContainer::ParseKeySets: **KeySets");
    997997  for(int i=FragmentCounter;i--;)
     
    10001000  input.open(file.str().c_str(), ios::in);
    10011001  if (input == NULL) {
    1002     cout << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;
     1002    Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl;
    10031003    return false;
    10041004  }
     
    10131013      KeySets[i][j] = -1;
    10141014    FragmentNumber = FixedDigitNumber(FragmentCounter, i);
    1015     //cout << FRAGMENTPREFIX << FragmentNumber << "[" << AtomCounter[i] << "]:";
     1015    //Log() << Verbose(0) << FRAGMENTPREFIX << FragmentNumber << "[" << AtomCounter[i] << "]:";
    10161016    Free(&FragmentNumber);
    10171017    input.getline(filename, 1023);
     
    10191019    for(int j=0;(j<AtomCounter[i]) && (!line.eof());j++) {
    10201020      line >> KeySets[i][j];
    1021       //cout << " " << KeySets[i][j];
    1022     }
    1023     //cout << endl;
     1021      //Log() << Verbose(0) << " " << KeySets[i][j];
     1022    }
     1023    //Log() << Verbose(0) << endl;
    10241024  }
    10251025  input.close();
     
    10341034  int Counter;
    10351035
    1036   cout << "Creating Fragment terms." << endl;
     1036  Log() << Verbose(0) << "Creating Fragment terms." << endl;
    10371037  // scan through all to determine maximum order
    10381038  Order=0;
     
    10451045      Order = Counter;
    10461046  }
    1047   cout << "Found Order is " << Order << "." << endl;
     1047  Log() << Verbose(0) << "Found Order is " << Order << "." << endl;
    10481048
    10491049  // scan through all to determine fragments per order
     
    10591059  }
    10601060  for(int i=0;i<Order;i++)
    1061     cout << "Found No. of Fragments of Order " << i+1 << " is " << FragmentsPerOrder[i] << "." << endl;
     1061    Log() << Verbose(0) << "Found No. of Fragments of Order " << i+1 << " is " << FragmentsPerOrder[i] << "." << endl;
    10621062
    10631063  // scan through all to gather indices to each order set
     
    10751075    FragmentsPerOrder[Counter-1]++;
    10761076  }
    1077   cout << "Printing OrderSet." << endl;
     1077  Log() << Verbose(0) << "Printing OrderSet." << endl;
    10781078  for(int i=0;i<Order;i++) {
    10791079    for (int j=0;j<FragmentsPerOrder[i];j++) {
    1080       cout << " " << OrderSet[i][j];
    1081     }
    1082     cout << endl;
    1083   }
    1084   cout << endl;
     1080      Log() << Verbose(0) << " " << OrderSet[i][j];
     1081    }
     1082    Log() << Verbose(0) << endl;
     1083  }
     1084  Log() << Verbose(0) << endl;
    10851085
    10861086
Note: See TracChangeset for help on using the changeset viewer.