Ignore:
Timestamp:
Sep 14, 2016, 6:42:52 PM (8 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, 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_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
Children:
c6da5e
Parents:
e51f2c
git-author:
Frederik Heber <heber@…> (05/27/16 18:33:31)
git-committer:
Frederik Heber <heber@…> (09/14/16 18:42:52)
Message:

FIX: Made getGridPointsPerAxis() not use pow() in every call.

Location:
src/Fragmentation/Summation/SetValues
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Summation/SetValues/SamplingGrid.cpp

    re51f2c r978234  
    436436    size_t *total) const
    437437{
    438   const size_t gridpoints_axis = getGridPointsPerAxis();
    439438  const double round_offset =
    440439      (std::numeric_limits<size_t>::round_style == std::round_toward_zero) ?
     
    445444      // the grids have to be compatible (equal level), should always be on
    446445      // discrete grid point locations.
    447       const double delta = (double)gridpoints_axis/(end[index] - begin[index]);
     446      const double delta = getDeltaPerAxis(index);
    448447      // delta is conversion factor from box length to discrete length, i.e. number of points
    449       pre_offset[index] = delta*(smaller_wbegin[index] - larger_wbegin[index])+round_offset;
    450       length[index] = delta*(smaller_wend[index] - smaller_wbegin[index])+round_offset;
    451       post_offset[index] = delta*(larger_wend[index] - smaller_wend[index])+round_offset;
    452       total[index] = delta*(larger_wend[index] - larger_wbegin[index])+round_offset;
     448      pre_offset[index] = (smaller_wbegin[index] - larger_wbegin[index])/delta+round_offset;
     449      length[index] = (smaller_wend[index] - smaller_wbegin[index])/delta+round_offset;
     450      post_offset[index] = (larger_wend[index] - smaller_wend[index])/delta+round_offset;
     451      total[index] = (larger_wend[index] - larger_wbegin[index])/delta+round_offset;
    453452    } else {
    454453      pre_offset[index] = 0;
  • src/Fragmentation/Summation/SetValues/SamplingGridProperties_inline.hpp

    re51f2c r978234  
    4242const size_t SamplingGridProperties::getGridPointsPerAxis() const
    4343{
    44   return pow(2, level);
     44  static size_t s_gridpoints = 1;
     45  static int s_level = 0;
     46  if (s_level != level) {
     47    s_gridpoints = 1 << level;
     48    s_level = level;
     49  }
     50  return s_gridpoints;
    4551}
    4652
Note: See TracChangeset for help on using the changeset viewer.