Ignore:
Timestamp:
Nov 3, 2011, 7:44:01 PM (13 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, 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/Tesselation/ellipsoid.cpp

    r50e4e5 r47d041  
    5555  double psi,theta,phi; // euler angles in ZX'Z'' convention
    5656
    57   //Log() << Verbose(3) << "Begin of SquaredDistanceToEllipsoid" << endl;
     57  //LOG(3, "Begin of SquaredDistanceToEllipsoid");
    5858
    5959  for(int i=0;i<3;i++)
     
    6262  // 1. translate coordinate system so that ellipsoid center is in origin
    6363  RefPoint = helper = x - EllipsoidCenter;
    64   //Log() << Verbose(4) << "Translated given point is at " << RefPoint << "." << endl;
     64  //LOG(4, "Translated given point is at " << RefPoint << ".");
    6565
    6666  // 2. transform coordinate system by inverse of rotation matrix and of diagonal matrix
     
    7979  helper *= Matrix;
    8080  helper.ScaleAll(InverseLength);
    81   //Log() << Verbose(4) << "Transformed RefPoint is at " << helper << "." << endl;
     81  //LOG(4, "Transformed RefPoint is at " << helper << ".");
    8282
    8383  // 3. construct intersection point with unit sphere and ray between origin and x
    8484  helper.Normalize(); // is simply normalizes vector in distance direction
    85   //Log() << Verbose(4) << "Transformed intersection is at " << helper << "." << endl;
     85  //LOG(4, "Transformed intersection is at " << helper << ".");
    8686
    8787  // 4. transform back the constructed intersection point
     
    100100  Matrix.set(2,2, cos(theta));
    101101  helper *= Matrix;
    102   //Log() << Verbose(4) << "Intersection is at " << helper << "." << endl;
     102  //LOG(4, "Intersection is at " << helper << ".");
    103103
    104104  // 5. determine distance between backtransformed point and x
    105105  distance = RefPoint.DistanceSquared(helper);
    106   //Log() << Verbose(4) << "Squared distance between intersection and RefPoint is " << distance << "." << endl;
     106  //LOG(4, "Squared distance between intersection and RefPoint is " << distance << ".");
    107107
    108108  return distance;
    109   //Log() << Verbose(3) << "End of SquaredDistanceToEllipsoid" << endl;
     109  //LOG(3, "End of SquaredDistanceToEllipsoid");
    110110};
    111111
     
    149149  }
    150150
    151   //Log() << Verbose(0) << "Current summed distance is " << SumDistance << "." << endl;
     151  //LOG(0, "Current summed distance is " << SumDistance << ".");
    152152  return SumDistance;
    153153};
     
    163163{
    164164  int status = GSL_SUCCESS;
    165   DoLog(2) && (Log() << Verbose(2) << "Begin of FitPointSetToEllipsoid " << endl);
     165  LOG(2, "Begin of FitPointSetToEllipsoid ");
    166166  if (N >= 3) { // check that enough points are given (9 d.o.f.)
    167167    struct EllipsoidMinimisation par;
     
    216216          EllipsoidAngle[i] = gsl_vector_get (s->x, i+6);
    217217        }
    218         DoLog(4) && (Log() << Verbose(4) << setprecision(3) << "Converged fit at: " << *EllipsoidCenter << ", lengths " << EllipsoidLength[0] << ", " << EllipsoidLength[1] << ", " << EllipsoidLength[2] << ", angles " << EllipsoidAngle[0] << ", " << EllipsoidAngle[1] << ", " << EllipsoidAngle[2] << " with summed distance " << s->fval << "." << endl);
     218        LOG(4, setprecision(3) << "Converged fit at: " << *EllipsoidCenter << ", lengths " << EllipsoidLength[0] << ", " << EllipsoidLength[1] << ", " << EllipsoidLength[2] << ", angles " << EllipsoidAngle[0] << ", " << EllipsoidAngle[1] << ", " << EllipsoidAngle[2] << " with summed distance " << s->fval << ".");
    219219      }
    220220
     
    226226
    227227  } else {
    228     DoLog(3) && (Log() << Verbose(3) << "Not enough points provided for fit to ellipsoid." << endl);
     228    LOG(3, "Not enough points provided for fit to ellipsoid.");
    229229    return false;
    230230  }
    231   DoLog(2) && (Log() << Verbose(2) << "End of FitPointSetToEllipsoid" << endl);
     231  LOG(2, "End of FitPointSetToEllipsoid");
    232232  if (status == GSL_SUCCESS)
    233233    return true;
     
    252252  int index;
    253253  TesselPoint *Candidate = NULL;
    254   DoLog(2) && (Log() << Verbose(2) << "Begin of PickRandomPointSet" << endl);
     254  LOG(2, "Begin of PickRandomPointSet");
    255255
    256256  // allocate array
     
    258258    x = new Vector[PointsToPick];
    259259  } else {
    260     DoeLog(2) && (eLog()<< Verbose(2) << "Given pointer to vector array seems already allocated." << endl);
     260    ELOG(2, "Given pointer to vector array seems already allocated.");
    261261  }
    262262
     
    282282    for(int i=0;i<NDIM;i++) // pick three random indices
    283283      LC->n[i] = ((int)random() % LC->N[i]);
    284     DoLog(2) && (Log() << Verbose(2) << "INFO: Center cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " ... ");
     284    LOG(2, "INFO: Center cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << ".");
    285285    // get random cell
    286286    const TesselPointSTLList *List = LC->GetCurrentCell();
     
    288288      continue;
    289289    }
    290     DoLog(2) && (Log() << Verbose(2) << "with No. " << LC->index << "." << endl);
    291 
    292     DoLog(2) && (Log() << Verbose(2) << "LC Intervals:");
     290    LOG(2, "INFO: Cell index is No. " << LC->index << ".");
     291
     292    if (DoLog(2)) {
     293      std::stringstream output;
     294      output << "LC Intervals:";
     295      for (int i=0;i<NDIM;i++)
     296        output << " [" << Nlower[i] << "," << Nupper[i] << "] ";
     297      LOG(2, output.str());
     298    }
     299
    293300    for (int i=0;i<NDIM;i++) {
    294301      Nlower[i] = ((LC->n[i]-1) >= 0) ? LC->n[i]-1 : 0;
    295302      Nupper[i] = ((LC->n[i]+1) < LC->N[i]) ? LC->n[i]+1 : LC->N[i]-1;
    296       DoLog(0) && (Log() << Verbose(0) << " [" << Nlower[i] << "," << Nupper[i] << "] ");
    297     }
    298     DoLog(0) && (Log() << Verbose(0) << endl);
     303    }
    299304
    300305    // count whether there are sufficient atoms in this cell+neighbors
     
    306311          PointsLeft += List->size();
    307312        }
    308     DoLog(2) && (Log() << Verbose(2) << "There are " << PointsLeft << " atoms in this neighbourhood." << endl);
     313    LOG(2, "There are " << PointsLeft << " atoms in this neighbourhood.");
    309314    if (PointsLeft < PointsToPick) {  // ensure that we can pick enough points in its neighbourhood at all.
    310315      continue;
     
    317322      current = PickedAtomNrs.find(index);  // not present?
    318323      if (current == PickedAtomNrs.end()) {
    319         //Log() << Verbose(2) << "Picking atom Nr. " << index << "." << endl;
     324        //LOG(2, "Picking atom Nr. " << index << ".");
    320325        PickedAtomNrs.insert(index);
    321326      }
     
    329334        for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    330335          const TesselPointSTLList *List = LC->GetCurrentCell();
    331 //          Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl;
     336//          LOG(2, "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points.");
    332337          if (List != NULL) {
    333338//            if (List->begin() != List->end())
    334 //              Log() << Verbose(2) << "Going through candidates ... " << endl;
     339//              LOG(2, "Going through candidates ... ");
    335340//            else
    336 //              Log() << Verbose(2) << "Cell is empty ... " << endl;
     341//              LOG(2, "Cell is empty ... ");
    337342            for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    338343              if ((current != PickedAtomNrs.end()) && (*current == index)) {
    339344                Candidate = (*Runner);
    340                 DoLog(2) && (Log() << Verbose(2) << "Current picked node is " << (*Runner)->getName() << " with index " << index << "." << endl);
     345                LOG(2, "Current picked node is " << (*Runner)->getName() << " with index " << index << ".");
    341346                x[PointsPicked++] = Candidate->getPosition();    // we have one more atom picked
    342347                current++;    // next pre-picked atom
     
    345350            }
    346351//          } else {
    347 //            Log() << Verbose(2) << "List for this index not allocated!" << endl;
     352//            LOG(2, "List for this index not allocated!");
    348353          }
    349354        }
    350     DoLog(2) && (Log() << Verbose(2) << "The following points were picked: " << endl);
     355    LOG(2, "The following points were picked: ");
    351356    for (size_t i=0;i<PointsPicked;i++)
    352       DoLog(2) && (Log() << Verbose(2) << x[i] << endl);
     357      LOG(2, x[i]);
    353358    if (PointsPicked == PointsToPick)  // break out of loop if we have all
    354359      break;
    355360  } while(1);
    356361
    357   DoLog(2) && (Log() << Verbose(2) << "End of PickRandomPointSet" << endl);
     362  LOG(2, "End of PickRandomPointSet");
    358363};
    359364
     
    370375  double value, threshold;
    371376  PointMap *List = &T->PointsOnBoundary;
    372   DoLog(2) && (Log() << Verbose(2) << "Begin of PickRandomPointSet" << endl);
     377  LOG(2, "Begin of PickRandomPointSet");
    373378
    374379  // allocate array
     
    376381    x = new Vector[PointsToPick];
    377382  } else {
    378     DoeLog(2) && (eLog()<< Verbose(2) << "Given pointer to vector array seems already allocated." << endl);
     383    ELOG(2, "Given pointer to vector array seems already allocated.");
    379384  }
    380385
     
    386391      threshold = 1. - (double)(PointsToPick - PointsPicked)/(double)PointsLeft;
    387392      value = (double)random()/(double)(rng_max-rng_min);
    388       //Log() << Verbose(3) << "Current node is " << *Runner->second->node << " with " << value << " ... " << threshold << ": ";
    389393      if (value > threshold) {
    390394        x[PointsPicked] = (Runner->second->node->getPosition());
    391395        PointsPicked++;
    392         //Log() << Verbose(0) << "IN." << endl;
     396        //LOG(3, "Current node is " << *Runner->second->node << " with " << value << " ... " << threshold << ": IN.");
    393397      } else {
    394         //Log() << Verbose(0) << "OUT." << endl;
     398        //LOG(3, "Current node is " << *Runner->second->node << " with " << value << " ... " << threshold << ": OUT.");
    395399      }
    396400      PointsLeft--;
    397401    }
    398   DoLog(2) && (Log() << Verbose(2) << "The following points were picked: " << endl);
     402  LOG(2, "The following points were picked: ");
    399403  for (size_t i=0;i<PointsPicked;i++)
    400     DoLog(3) && (Log() << Verbose(3) << x[i] << endl);
    401 
    402   DoLog(2) && (Log() << Verbose(2) << "End of PickRandomPointSet" << endl);
     404    LOG(3, x[i]);
     405
     406  LOG(2, "End of PickRandomPointSet");
    403407};
    404408
     
    420424  double EllipsoidAngle[3];
    421425  double distance, MaxDistance, MinDistance;
    422   DoLog(0) && (Log() << Verbose(0) << "Begin of FindDistributionOfEllipsoids" << endl);
     426  LOG(0, "Begin of FindDistributionOfEllipsoids");
    423427
    424428  // construct center of gravity of boundary point set for initial ellipsoid center
     
    427431    Center += (Runner->second->node->getPosition());
    428432  Center.Scale(1./T->PointsOnBoundaryCount);
    429   DoLog(1) && (Log() << Verbose(1) << "Center is at " << Center << "." << endl);
     433  LOG(1, "Center is at " << Center << ".");
    430434
    431435  // Output header
     
    435439  // loop over desired number of parameter sets
    436440  for (;number >0;number--) {
    437     DoLog(1) && (Log() << Verbose(1) << "Determining data set " << number << " ... " << endl);
     441    LOG(1, "Determining data set " << number << " ... ");
    438442    // pick the point set
    439443    x = NULL;
     
    451455        MinDistance = distance;
    452456    }
    453     //Log() << Verbose(2) << "MinDistance " << MinDistance << ", MaxDistance " << MaxDistance << "." << endl;
     457    //LOG(2, "MinDistance " << MinDistance << ", MaxDistance " << MaxDistance << ".");
    454458    EllipsoidCenter = Center;  // use Center of Gravity as initial center of ellipsoid
    455459    for (int i=0;i<3;i++)
     
    461465    // fit the parameters
    462466    if (FitPointSetToEllipsoid(x, N, &EllipsoidCenter, &EllipsoidLength[0], &EllipsoidAngle[0])) {
    463       DoLog(1) && (Log() << Verbose(1) << "Picking succeeded!" << endl);
     467      LOG(1, "Picking succeeded!");
    464468      // output obtained parameter set
    465469      output << number << "\t";
     
    472476      output << endl;
    473477    } else { // increase N to pick one more
    474       DoLog(1) && (Log() << Verbose(1) << "Picking failed!" << endl);
     478      LOG(1, "Picking failed!");
    475479      number++;
    476480    }
     
    480484  output.close();
    481485
    482   DoLog(0) && (Log() << Verbose(0) << "End of FindDistributionOfEllipsoids" << endl);
    483 };
     486  LOG(0, "End of FindDistributionOfEllipsoids");
     487};
Note: See TracChangeset for help on using the changeset viewer.