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, 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/analysis_correlation.cpp

    r7326b2 re138de  
    1010#include "analysis_correlation.hpp"
    1111#include "element.hpp"
     12#include "log.hpp"
    1213#include "molecule.hpp"
    1314#include "tesselation.hpp"
     
    2526 * \return Map of doubles with values the pair of the two atoms.
    2627 */
    27 PairCorrelationMap *PairCorrelation( ofstream * const out, MoleculeListClass * const &molecules, const element * const type1, const element * const type2 )
     28PairCorrelationMap *PairCorrelation(MoleculeListClass * const &molecules, const element * const type1, const element * const type2 )
    2829{
    2930  PairCorrelationMap *outmap = NULL;
     
    3132
    3233  if (molecules->ListOfMolecules.empty()) {
    33     cerr << Verbose(1) <<"No molecule given." << endl;
     34    eLog() << Verbose(1) <<"No molecule given." << endl;
    3435    return outmap;
    3536  }
     
    3738  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    3839    if ((*MolWalker)->ActiveFlag) {
    39       cerr << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    40       atom *Walker = (*MolWalker)->start;
    41       while (Walker->next != (*MolWalker)->end) {
    42         Walker = Walker->next;
    43         *out << Verbose(3) << "Current atom is " << *Walker << "." << endl;
     40      eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
     41      atom *Walker = (*MolWalker)->start;
     42      while (Walker->next != (*MolWalker)->end) {
     43        Walker = Walker->next;
     44        Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
    4445        if ((type1 == NULL) || (Walker->type == type1)) {
    4546          for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++)
    4647            if ((*MolOtherWalker)->ActiveFlag) {
    47               *out << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl;
     48              Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl;
    4849              atom *OtherWalker = (*MolOtherWalker)->start;
    4950              while (OtherWalker->next != (*MolOtherWalker)->end) { // only go up to Walker
    5051                OtherWalker = OtherWalker->next;
    51                 *out << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl;
     52                Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl;
    5253                if (Walker->nr < OtherWalker->nr)
    5354                  if ((type2 == NULL) || (OtherWalker->type == type2)) {
    5455                    distance = Walker->node->PeriodicDistance(OtherWalker->node, (*MolWalker)->cell_size);
    55                     //*out << Verbose(1) <<"Inserting " << *Walker << " and " << *OtherWalker << endl;
     56                    //Log() << Verbose(1) <<"Inserting " << *Walker << " and " << *OtherWalker << endl;
    5657                    outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> (Walker, OtherWalker) ) );
    5758                  }
     
    7475 * \return Map of doubles with values the pair of the two atoms.
    7576 */
    76 PairCorrelationMap *PeriodicPairCorrelation( ofstream * const out, MoleculeListClass * const &molecules, const element * const type1, const element * const type2, const int ranges[NDIM] )
     77PairCorrelationMap *PeriodicPairCorrelation(MoleculeListClass * const &molecules, const element * const type1, const element * const type2, const int ranges[NDIM] )
    7778{
    7879  PairCorrelationMap *outmap = NULL;
     
    8687
    8788  if (molecules->ListOfMolecules.empty()) {
    88     cerr << Verbose(1) <<"No molecule given." << endl;
     89    eLog() << Verbose(1) <<"No molecule given." << endl;
    8990    return outmap;
    9091  }
     
    9495      const double * const FullMatrix = ReturnFullMatrixforSymmetric((*MolWalker)->cell_size);
    9596      const double * const FullInverseMatrix = InverseMatrix(FullMatrix);
    96       cerr << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    97       atom *Walker = (*MolWalker)->start;
    98       while (Walker->next != (*MolWalker)->end) {
    99         Walker = Walker->next;
    100         *out << Verbose(3) << "Current atom is " << *Walker << "." << endl;
     97      eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
     98      atom *Walker = (*MolWalker)->start;
     99      while (Walker->next != (*MolWalker)->end) {
     100        Walker = Walker->next;
     101        Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
    101102        if ((type1 == NULL) || (Walker->type == type1)) {
    102103          periodicX.CopyVector(Walker->node);
     
    111112                for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++)
    112113                  if ((*MolOtherWalker)->ActiveFlag) {
    113                     *out << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl;
     114                    Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl;
    114115                    atom *OtherWalker = (*MolOtherWalker)->start;
    115116                    while (OtherWalker->next != (*MolOtherWalker)->end) { // only go up to Walker
    116117                      OtherWalker = OtherWalker->next;
    117                       *out << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl;
     118                      Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl;
    118119                      if (Walker->nr < OtherWalker->nr)
    119120                        if ((type2 == NULL) || (OtherWalker->type == type2)) {
     
    128129                                checkOtherX.MatrixMultiplication(FullMatrix);
    129130                                distance = checkX.Distance(&checkOtherX);
    130                                 //*out << Verbose(1) <<"Inserting " << *Walker << " and " << *OtherWalker << endl;
     131                                //Log() << Verbose(1) <<"Inserting " << *Walker << " and " << *OtherWalker << endl;
    131132                                outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> (Walker, OtherWalker) ) );
    132133                              }
     
    149150 * \return Map of dobules with values as pairs of atom and the vector
    150151 */
    151 CorrelationToPointMap *CorrelationToPoint(  ofstream * const out, MoleculeListClass * const &molecules, const element * const type, const Vector *point )
     152CorrelationToPointMap *CorrelationToPoint(MoleculeListClass * const &molecules, const element * const type, const Vector *point )
    152153{
    153154  CorrelationToPointMap *outmap = NULL;
     
    155156
    156157  if (molecules->ListOfMolecules.empty()) {
    157     *out << Verbose(1) <<"No molecule given." << endl;
     158    Log() << Verbose(1) <<"No molecule given." << endl;
    158159    return outmap;
    159160  }
     
    161162  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    162163    if ((*MolWalker)->ActiveFlag) {
    163       *out << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    164       atom *Walker = (*MolWalker)->start;
    165       while (Walker->next != (*MolWalker)->end) {
    166         Walker = Walker->next;
    167         *out << Verbose(3) << "Current atom is " << *Walker << "." << endl;
     164      Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
     165      atom *Walker = (*MolWalker)->start;
     166      while (Walker->next != (*MolWalker)->end) {
     167        Walker = Walker->next;
     168        Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
    168169        if ((type == NULL) || (Walker->type == type)) {
    169170          distance = Walker->node->PeriodicDistance(point, (*MolWalker)->cell_size);
    170           *out << Verbose(4) << "Current distance is " << distance << "." << endl;
     171          Log() << Verbose(4) << "Current distance is " << distance << "." << endl;
    171172          outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (Walker, point) ) );
    172173        }
     
    185186 * \return Map of dobules with values as pairs of atom and the vector
    186187 */
    187 CorrelationToPointMap *PeriodicCorrelationToPoint(  ofstream * const out, MoleculeListClass * const &molecules, const element * const type, const Vector *point, const int ranges[NDIM] )
     188CorrelationToPointMap *PeriodicCorrelationToPoint(MoleculeListClass * const &molecules, const element * const type, const Vector *point, const int ranges[NDIM] )
    188189{
    189190  CorrelationToPointMap *outmap = NULL;
     
    194195
    195196  if (molecules->ListOfMolecules.empty()) {
    196     *out << Verbose(1) <<"No molecule given." << endl;
     197    Log() << Verbose(1) <<"No molecule given." << endl;
    197198    return outmap;
    198199  }
     
    202203      const double * const FullMatrix = ReturnFullMatrixforSymmetric((*MolWalker)->cell_size);
    203204      const double * const FullInverseMatrix = InverseMatrix(FullMatrix);
    204       *out << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    205       atom *Walker = (*MolWalker)->start;
    206       while (Walker->next != (*MolWalker)->end) {
    207         Walker = Walker->next;
    208         *out << Verbose(3) << "Current atom is " << *Walker << "." << endl;
     205      Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
     206      atom *Walker = (*MolWalker)->start;
     207      while (Walker->next != (*MolWalker)->end) {
     208        Walker = Walker->next;
     209        Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
    209210        if ((type == NULL) || (Walker->type == type)) {
    210211          periodicX.CopyVector(Walker->node);
     
    218219                checkX.MatrixMultiplication(FullMatrix);
    219220                distance = checkX.Distance(point);
    220                 *out << Verbose(4) << "Current distance is " << distance << "." << endl;
     221                Log() << Verbose(4) << "Current distance is " << distance << "." << endl;
    221222                outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (Walker, point) ) );
    222223              }
     
    236237 * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest
    237238 */
    238 CorrelationToSurfaceMap *CorrelationToSurface( ofstream * const out, MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC )
     239CorrelationToSurfaceMap *CorrelationToSurface(MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC )
    239240{
    240241  CorrelationToSurfaceMap *outmap = NULL;
     
    244245
    245246  if ((Surface == NULL) || (LC == NULL) || (molecules->ListOfMolecules.empty())) {
    246     *out << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl;
     247    Log() << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl;
    247248    return outmap;
    248249  }
     
    250251  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    251252    if ((*MolWalker)->ActiveFlag) {
    252       *out << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    253       atom *Walker = (*MolWalker)->start;
    254       while (Walker->next != (*MolWalker)->end) {
    255         Walker = Walker->next;
    256         *out << Verbose(3) << "Current atom is " << *Walker << "." << endl;
     253      Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
     254      atom *Walker = (*MolWalker)->start;
     255      while (Walker->next != (*MolWalker)->end) {
     256        Walker = Walker->next;
     257        Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
    257258        if ((type == NULL) || (Walker->type == type)) {
    258           triangle = Surface->FindClosestTriangleToPoint(out, Walker->node, LC );
     259          triangle = Surface->FindClosestTriangleToPoint(Walker->node, LC );
    259260          if (triangle != NULL) {
    260             distance = DistanceToTrianglePlane(out, Walker->node, triangle);
     261            distance = DistanceToTrianglePlane(Walker->node, triangle);
    261262            outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> (Walker, triangle) ) );
    262263          }
     
    281282 * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest
    282283 */
    283 CorrelationToSurfaceMap *PeriodicCorrelationToSurface( ofstream * const out, MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] )
     284CorrelationToSurfaceMap *PeriodicCorrelationToSurface(MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] )
    284285{
    285286  CorrelationToSurfaceMap *outmap = NULL;
     
    292293
    293294  if ((Surface == NULL) || (LC == NULL) || (molecules->ListOfMolecules.empty())) {
    294     *out << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl;
     295    Log() << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl;
    295296    return outmap;
    296297  }
     
    300301      const double * const FullMatrix = ReturnFullMatrixforSymmetric((*MolWalker)->cell_size);
    301302      const double * const FullInverseMatrix = InverseMatrix(FullMatrix);
    302       *out << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    303       atom *Walker = (*MolWalker)->start;
    304       while (Walker->next != (*MolWalker)->end) {
    305         Walker = Walker->next;
    306         *out << Verbose(3) << "Current atom is " << *Walker << "." << endl;
     303      Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
     304      atom *Walker = (*MolWalker)->start;
     305      while (Walker->next != (*MolWalker)->end) {
     306        Walker = Walker->next;
     307        Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
    307308        if ((type == NULL) || (Walker->type == type)) {
    308309          periodicX.CopyVector(Walker->node);
     
    315316                checkX.AddVector(&periodicX);
    316317                checkX.MatrixMultiplication(FullMatrix);
    317                 triangle = Surface->FindClosestTriangleToPoint(out, &checkX, LC );
     318                triangle = Surface->FindClosestTriangleToPoint(&checkX, LC );
    318319                if (triangle != NULL) {
    319                   distance = DistanceToTrianglePlane(out, &checkX, triangle);
     320                  distance = DistanceToTrianglePlane(&checkX, triangle);
    320321                  outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> (Walker, triangle) ) );
    321322                }
Note: See TracChangeset for help on using the changeset viewer.