Ignore:
Timestamp:
Nov 3, 2011, 7:44:01 PM (14 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, Candidate_v1.7.1, 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:
41a467
Parents:
50e4e5
git-author:
Frederik Heber <heber@…> (10/27/11 11:53:58)
git-committer:
Frederik Heber <heber@…> (11/03/11 19:44:01)
Message:

HUGE: Removed all calls to Log(), eLog(), replaced by LOG() and ELOG().

  • Replaced DoLog(.) && (Log() << Verbose(.) << ... << std::endl) by Log(., ...).
  • Replaced Log() << Verbose(.) << .. << by Log(., ...)
  • on multiline used stringstream to generate and message which was finally used in LOG(., output.str())
  • there should be no more occurence of Log(). LOG() and ELOG() must be used instead.
  • Eventually, this will allow for storing all errors and re-printing them on program exit which would be very helpful to ascertain error-free runs for the user.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/moleculelist.cpp

    r50e4e5 r47d041  
    5656MoleculeListClass::~MoleculeListClass()
    5757{
    58   DoLog(4) && (Log() << Verbose(4) << "Clearing ListOfMolecules." << endl);
     58  LOG(4, "Clearing ListOfMolecules.");
    5959  for(MoleculeList::iterator MolRunner = ListOfMolecules.begin(); MolRunner != ListOfMolecules.end(); ++MolRunner)
    6060    (*MolRunner)->signOff(this);
     
    111111
    112112  // sort each atom list and put the numbers into a list, then go through
    113   //Log() << Verbose(0) << "Comparing fragment no. " << *(molecule **)a << " to " << *(molecule **)b << "." << endl;
     113  //LOG(0, "Comparing fragment no. " << *(molecule **)a << " to " << *(molecule **)b << ".");
    114114  // Yes those types are awkward... but check it for yourself it checks out this way
    115115  molecule *const *mol1_ptr= static_cast<molecule *const *>(a);
     
    238238void MoleculeListClass::Output(std::ostream *out)
    239239{
    240   DoLog(1) && (Log() << Verbose(1) << "MoleculeList: ");
    241   for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++)
    242     DoLog(0) && (Log() << Verbose(0) << *ListRunner << "\t");
    243   DoLog(0) && (Log() << Verbose(0) << endl);
     240  if (DoLog(1)) {
     241    std::stringstream output;
     242    output << "MoleculeList: ";
     243    for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++)
     244      output << *ListRunner << "\t";
     245      LOG(1, output.str());
     246  }
    244247};
    245248
     
    257260    number = (int)floor(((double)number / 10.));
    258261    order++;
    259     //Log() << Verbose(0) << "Number is " << number << ", order is " << order << "." << endl;
     262    //LOG(0, "Number is " << number << ", order is " << order << ".");
    260263  }
    261264  // allocate string
     
    268271    number = (int)floor(((double)number / 10.));
    269272  }
    270   //Log() << Verbose(0) << returnstring << endl;
     273  //LOG(0, returnstring);
    271274  return returnstring;
    272275};
     
    292295  char *FragmentNumber = NULL;
    293296
    294   DoLog(1) && (Log() << Verbose(1) << "Saving hydrogen saturation correction ... ");
     297  LOG(1, "Saving hydrogen saturation correction ... ");
    295298  // 0. parse in fit constant files that should have the same dimension as the final energy files
    296299  // 0a. find dimension of matrices with constants
     
    300303  input.open(line.c_str());
    301304  if (input.fail()) {
    302     DoLog(1) && (Log() << Verbose(1) << endl << "Unable to open " << line << ", is the directory correct?" << endl);
     305    LOG(1, endl << "Unable to open " << line << ", is the directory correct?");
    303306    return false;
    304307  }
     
    317320    b++;
    318321  }
    319   DoLog(0) && (Log() << Verbose(0) << "I recognized " << a << " columns and " << b << " rows, ");
     322  LOG(0, "I recognized " << a << " columns and " << b << " rows, ");
    320323  input.close();
    321324
     
    341344    input.open(line.c_str());
    342345    if (input.fail()) {
    343       DoeLog(0) && (eLog()<< Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" << endl);
     346      ELOG(0, endl << "Unable to open " << line << ", is the directory correct?");
    344347      performCriticalExit();
    345348      return false;
     
    348351    while ((!input.eof()) && (k < b)) {
    349352      input.getline(ParsedLine, 1023);
    350       //Log() << Verbose(0) << "Current Line: " << ParsedLine << endl;
     353      //LOG(1, "INFO: Current Line: " << ParsedLine);
    351354      zeile.str(ParsedLine);
    352355      zeile.clear();
    353356      l = 0;
     357      //std::stringstream output;
    354358      while ((!zeile.eof()) && (l < a)) {
    355359        zeile >> FitConstant[i][l][k];
    356         //Log() << Verbose(0) << FitConstant[i][l][k] << "\t";
     360        //output << FitConstant[i][l][k] << "\t";
    357361        l++;
    358362      }
    359       //Log() << Verbose(0) << endl;
     363      //LOG(1, "INFO: fit constant are " << output.str());
    360364      k++;
    361365    }
    362366    input.close();
    363367  }
    364   for (int k = 0; k < 3; k++) {
    365     DoLog(0) && (Log() << Verbose(0) << "Constants " << k << ":" << endl);
    366     for (int j = 0; j < b; j++) {
    367       for (int i = 0; i < a; i++) {
    368         DoLog(0) && (Log() << Verbose(0) << FitConstant[k][i][j] << "\t");
    369       }
    370       DoLog(0) && (Log() << Verbose(0) << endl);
    371     }
    372     DoLog(0) && (Log() << Verbose(0) << endl);
     368  if (DoLog(1)) {
     369    for (int k = 0; k < 3; k++) {
     370      std::stringstream output;
     371      output << "Constants " << k << ": ";
     372      for (int j = 0; j < b; j++) {
     373        for (int i = 0; i < a; i++) {
     374          output << FitConstant[k][i][j] << "\t";
     375        }
     376        output << std::endl;
     377      }
     378      LOG(0, output.str());
     379    }
    373380  }
    374381
     
    386393    // 2. take every hydrogen that is a saturated one
    387394    for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {
    388       //Log() << Verbose(1) << "(*iter): " << *(*iter) << " with first bond " << *((*iter)->getListOfBonds().begin()) << "." << endl;
     395      //LOG(1, "(*iter): " << *(*iter) << " with first bond " << *((*iter)->getListOfBonds().begin()) << ".");
    389396      if (((*iter)->getType()->getAtomicNumber() == 1) && (((*iter)->father == NULL)
    390397          || ((*iter)->father->getType()->getAtomicNumber() != 1))) { // if it's a hydrogen
    391398        for (molecule::const_iterator runner = (*ListRunner)->begin(); runner != (*ListRunner)->end(); ++runner) {
    392           //Log() << Verbose(2) << "Runner: " << *(*runner) << " with first bond " << *((*iter)->getListOfBonds().begin()) << "." << endl;
     399          //LOG(2, "Runner: " << *(*runner) << " with first bond " << *((*iter)->getListOfBonds().begin()) << ".");
    393400          // 3. take every other hydrogen that is the not the first and not bound to same bonding partner
    394401          const BondList &bondlist = (*runner)->getListOfBonds();
     
    397404            // 4. evaluate the morse potential for each matrix component and add up
    398405            distance = (*runner)->distance(*(*iter));
    399             //Log() << Verbose(0) << "Fragment " << (*ListRunner)->name << ": " << *(*runner) << "<= " << distance << "=>" << *(*iter) << ":" << endl;
     406            //std::stringstream output;
     407            //output << "Fragment " << (*ListRunner)->name << ": " << *(*runner) << "<= " << distance << "=>" << *(*iter) << ":";
    400408            for (int k = 0; k < a; k++) {
    401409              for (int j = 0; j < b; j++) {
     
    408416                  default:
    409417                    tmp = FitConstant[0][k][j] * pow(distance, FitConstant[1][k][j]) + FitConstant[2][k][j];
     418                    break;
    410419                };
    411420                correction[k][j] -= tmp; // ground state is actually lower (disturbed by additional interaction)
    412                 //Log() << Verbose(0) << tmp << "\t";
     421                //output << tmp << "\t";
    413422              }
    414               //Log() << Verbose(0) << endl;
     423              //output << endl;
    415424            }
    416             //Log() << Verbose(0) << endl;
     425            //LOG(0, output.str());
    417426          }
    418427        }
     
    459468  }
    460469  delete[](FitConstant);
    461   DoLog(0) && (Log() << Verbose(0) << "done." << endl);
     470  LOG(0, "done.");
    462471  return true;
    463472};
     
    477486
    478487  // open file for the force factors
    479   DoLog(1) && (Log() << Verbose(1) << "Saving  force factors ... ");
     488  LOG(1, "Saving  force factors ... ");
    480489  if (!ForcesFile.fail()) {
    481     //Log() << Verbose(1) << "Final AtomicForcesList: ";
    482490    //output << prefix << "Forces" << endl;
    483491    for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
     
    488496            if ((*atomIter)->getType()->getNumber() == (*elemIter).first) {
    489497              if (((*atomIter)->GetTrueFather() != NULL) && ((*atomIter)->GetTrueFather() != (*atomIter))) {// if there is a rea
    490                 //Log() << Verbose(0) << "Walker is " << *Walker << " with true father " << *( Walker->GetTrueFather()) << ", it
    491498                ForcesFile << SortIndex[(*atomIter)->GetTrueFather()->getNr()] << "\t";
    492499              } else
     
    500507    }
    501508    ForcesFile.close();
    502     DoLog(1) && (Log() << Verbose(1) << "done." << endl);
     509    LOG(1, "done.");
    503510  } else {
    504511    status = false;
    505     DoLog(1) && (Log() << Verbose(1) << "failed to open file " << filename << "." << endl);
     512    LOG(1, "failed to open file " << filename << ".");
    506513  }
    507514  ForcesFile.close();
     
    640647  Vector center;
    641648  char filename[MAXSTRINGSIZE];
    642   Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
     649  std::cout << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
    643650  mol = World::getInstance().createMolecule();
    644651  do {
    645     Log() << Verbose(0) << "Enter file name: ";
     652    std::cout << "Enter file name: ";
    646653    cin >> filename;
    647654  } while (!mol->AddXYZFile(filename));
     
    661668  molecule *mol = NULL;
    662669  do {
    663     Log() << Verbose(0) << "Enter index of molecule: ";
     670    std::cout << "Enter index of molecule: ";
    664671    cin >> nr;
    665672    mol = ReturnIndex(nr);
    666673  } while (mol == NULL);
    667   Log() << Verbose(0) << "Enter name: ";
     674  std::cout << "Enter name: ";
    668675  cin >> filename;
    669676  mol->SetNameFromFilename(filename);
     
    676683  mol = NULL;
    677684  do {
    678    Log() << Verbose(0) << "Enter index of molecule: ";
     685    std::cout << "Enter index of molecule: ";
    679686   cin >> nr;
    680687   mol = ReturnIndex(nr);
    681688  } while (mol == NULL);
    682   Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
     689  std::cout << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
    683690  do {
    684    Log() << Verbose(0) << "Enter file name: ";
     691    std::cout << "Enter file name: ";
    685692   cin >> filename;
    686693  } while (!mol->AddXYZFile(filename));
     
    691698  int nr;
    692699  molecule *mol = NULL;
    693   Log() << Verbose(0) << "Enter index of molecule: ";
     700  std::cout << "Enter index of molecule: ";
    694701  cin >> nr;
    695702  for(MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++)
Note: See TracChangeset for help on using the changeset viewer.