Ignore:
Timestamp:
Apr 22, 2010, 2:00:03 PM (15 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:
299554
Parents:
6613ec
Message:

Huge change: Log() << Verbose(.) --> DoLog(.) && (Log() << Verbose(.) << ...);

Most of the files are affected, but this is necessary as if DoLog() says verbosity is not enough, all the stream operators won"t get executed which saves substantial amount of computation time.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule_dynamics.cpp

    r6613ec ra67d19  
    207207    doubles++;
    208208  if (doubles >0)
    209     Log() << Verbose(2) << "Found " << doubles << " Doubles." << endl;
     209    DoLog(2) && (Log() << Verbose(2) << "Found " << doubles << " Doubles." << endl);
    210210  Free(&DoubleList);
    211211//  Log() << Verbose(2) << zeile1.str() << endl << zeile2.str() << endl;
     
    249249    Params.DoubleList[Params.DistanceList[Walker->nr]->begin()->second->nr]++;            // increase this target's source count (>1? not injective)
    250250    Params.DistanceIterators[Walker->nr] = Params.DistanceList[Walker->nr]->begin();    // and remember which one we picked
    251     Log() << Verbose(2) << *Walker << " starts with distance " << Params.DistanceList[Walker->nr]->begin()->first << "." << endl;
     251    DoLog(2) && (Log() << Verbose(2) << *Walker << " starts with distance " << Params.DistanceList[Walker->nr]->begin()->first << "." << endl);
    252252  }
    253253};
     
    277277      Params.DistanceIterators[Walker->nr] = NewBase;
    278278      OldPotential = Potential;
    279       Log() << Verbose(3) << "Found a new permutation, new potential is " << OldPotential << "." << endl;
     279      DoLog(3) && (Log() << Verbose(3) << "Found a new permutation, new potential is " << OldPotential << "." << endl);
    280280    }
    281281  }
     
    309309      performCriticalExit();
    310310    }
    311   Log() << Verbose(1) << "done." << endl;
     311  DoLog(1) && (Log() << Verbose(1) << "done." << endl);
    312312};
    313313
     
    358358  Params.PenaltyConstants[2] = 1e+7;    // just a huge penalty
    359359  // generate the distance list
    360   Log() << Verbose(1) << "Allocating, initializting and filling the distance list ... " << endl;
     360  DoLog(1) && (Log() << Verbose(1) << "Allocating, initializting and filling the distance list ... " << endl);
    361361  FillDistanceList(this, Params);
    362362
     
    365365
    366366  // make the PermutationMap injective by checking whether we have a non-zero constants[2] term in it
    367   Log() << Verbose(1) << "Making the PermutationMap injective ... " << endl;
     367  DoLog(1) && (Log() << Verbose(1) << "Making the PermutationMap injective ... " << endl);
    368368  MakeInjectivePermutation(this, Params);
    369369  Free(&Params.DoubleList);
    370370
    371371  // argument minimise the constrained potential in this injective PermutationMap
    372   Log() << Verbose(1) << "Argument minimising the PermutationMap." << endl;
     372  DoLog(1) && (Log() << Verbose(1) << "Argument minimising the PermutationMap." << endl);
    373373  OldPotential = 1e+10;
    374374  round = 0;
    375375  do {
    376     Log() << Verbose(2) << "Starting round " << ++round << ", at current potential " << OldPotential << " ... " << endl;
     376    DoLog(2) && (Log() << Verbose(2) << "Starting round " << ++round << ", at current potential " << OldPotential << " ... " << endl);
    377377    OlderPotential = OldPotential;
    378378    do {
     
    424424            } else {
    425425              Params.DistanceIterators[Runner->nr] = Rider;  // if successful also move the pointer in the iterator list
    426               Log() << Verbose(3) << "Found a better permutation, new potential is " << Potential << " vs." << OldPotential << "." << endl;
     426              DoLog(3) && (Log() << Verbose(3) << "Found a better permutation, new potential is " << Potential << " vs." << OldPotential << "." << endl);
    427427              OldPotential = Potential;
    428428            }
     
    443443    } while (Walker->next != end);
    444444  } while ((OlderPotential - OldPotential) > 1e-3);
    445   Log() << Verbose(1) << "done." << endl;
     445  DoLog(1) && (Log() << Verbose(1) << "done." << endl);
    446446
    447447
     
    466466{
    467467  /// evaluate forces (only the distance to target dependent part) with the final PermutationMap
    468   Log() << Verbose(1) << "Calculating forces and adding onto ForceMatrix ... " << endl;
     468  DoLog(1) && (Log() << Verbose(1) << "Calculating forces and adding onto ForceMatrix ... " << endl);
    469469  ActOnAllAtoms( &atom::EvaluateConstrainedForce, startstep, endstep, PermutationMap, Force );
    470   Log() << Verbose(1) << "done." << endl;
     470  DoLog(1) && (Log() << Verbose(1) << "done." << endl);
    471471};
    472472
     
    503503
    504504  // go through all steps and add the molecular configuration to the list and to the Trajectories of \a this molecule
    505   Log() << Verbose(1) << "Filling intermediate " << MaxSteps << " steps with MDSteps of " << MDSteps << "." << endl;
     505  DoLog(1) && (Log() << Verbose(1) << "Filling intermediate " << MaxSteps << " steps with MDSteps of " << MDSteps << "." << endl);
    506506  for (int step = 0; step <= MaxSteps; step++) {
    507507    mol = new molecule(elemente);
     
    652652  switch(Thermostat) {
    653653     case None:
    654       Log() << Verbose(2) <<  "Applying no thermostat..." << endl;
     654      DoLog(2) && (Log() << Verbose(2) <<  "Applying no thermostat..." << endl);
    655655      break;
    656656     case Woodcock:
    657657      if ((configuration.ScaleTempStep > 0) && ((MDSteps-1) % configuration.ScaleTempStep == 0)) {
    658         Log() << Verbose(2) <<  "Applying Woodcock thermostat..." << endl;
     658        DoLog(2) && (Log() << Verbose(2) <<  "Applying Woodcock thermostat..." << endl);
    659659        ActOnAllAtoms( &atom::Thermostat_Woodcock, sqrt(ScaleTempFactor), MDSteps, &ekin );
    660660      }
    661661      break;
    662662     case Gaussian:
    663       Log() << Verbose(2) <<  "Applying Gaussian thermostat..." << endl;
     663      DoLog(2) && (Log() << Verbose(2) <<  "Applying Gaussian thermostat..." << endl);
    664664      ActOnAllAtoms( &atom::Thermostat_Gaussian_init, MDSteps, &G, &E );
    665665
    666       Log() << Verbose(1) << "Gaussian Least Constraint constant is " << G/E << "." << endl;
     666      DoLog(1) && (Log() << Verbose(1) << "Gaussian Least Constraint constant is " << G/E << "." << endl);
    667667      ActOnAllAtoms( &atom::Thermostat_Gaussian_least_constraint, MDSteps, G/E, &ekin, &configuration);
    668668
    669669      break;
    670670     case Langevin:
    671       Log() << Verbose(2) <<  "Applying Langevin thermostat..." << endl;
     671      DoLog(2) && (Log() << Verbose(2) <<  "Applying Langevin thermostat..." << endl);
    672672      // init random number generator
    673673      gsl_rng_env_setup();
     
    679679
    680680     case Berendsen:
    681       Log() << Verbose(2) <<  "Applying Berendsen-VanGunsteren thermostat..." << endl;
     681      DoLog(2) && (Log() << Verbose(2) <<  "Applying Berendsen-VanGunsteren thermostat..." << endl);
    682682      ActOnAllAtoms( &atom::Thermostat_Berendsen, MDSteps, ScaleTempFactor, &ekin, &configuration );
    683683      break;
    684684
    685685     case NoseHoover:
    686       Log() << Verbose(2) <<  "Applying Nose-Hoover thermostat..." << endl;
     686      DoLog(2) && (Log() << Verbose(2) <<  "Applying Nose-Hoover thermostat..." << endl);
    687687      // dynamically evolve alpha (the additional degree of freedom)
    688688      delta_alpha = 0.;
     
    690690      delta_alpha = (delta_alpha - (3.*AtomCount+1.) * configuration.TargetTemp)/(configuration.HooverMass*Units2Electronmass);
    691691      configuration.alpha += delta_alpha*configuration.Deltat;
    692       Log() << Verbose(3) << "alpha = " << delta_alpha << " * " << configuration.Deltat << " = " << configuration.alpha << "." << endl;
     692      DoLog(3) && (Log() << Verbose(3) << "alpha = " << delta_alpha << " * " << configuration.Deltat << " = " << configuration.alpha << "." << endl);
    693693      // apply updated alpha as additional force
    694694      ActOnAllAtoms( &atom::Thermostat_NoseHoover_scale, MDSteps, &ekin, &configuration );
    695695      break;
    696696  }
    697   Log() << Verbose(1) << "Kinetic energy is " << ekin << "." << endl;
    698 };
     697  DoLog(1) && (Log() << Verbose(1) << "Kinetic energy is " << ekin << "." << endl);
     698};
Note: See TracChangeset for help on using the changeset viewer.