Ignore:
Timestamp:
Sep 14, 2016, 6:42:53 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:
f856ec
Parents:
52a789
git-author:
Frederik Heber <heber@…> (06/07/16 08:00:51)
git-committer:
Frederik Heber <heber@…> (09/14/16 18:42:53)
Message:

FragmentationLongRangeResults::operator() does not need to calculate potential difference on full grid.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Summation/Containers/FragmentationLongRangeResults.cpp

    r52a789 r760fa22  
    172172      // first we obtain the full e-e energy as potential times charge on the
    173173      // respective level.
    174       const SamplingGrid &charge_weight =
    175           boost::fusion::at_key<MPQCDataFused::sampled_grid>(Result_Grid_fused[level-1]);
     174      const SamplingGrid &charge_weight = full_sample[level-1];
    176175      SamplingGrid full_sample_solution = fullsolutionData[level-1].sampled_potential;
    177176      full_sample_solution *= charge_weight;
     
    183182          boost::fusion::at_key<VMGDataFused::sampled_potential>(Result_GridLongRange_fused[level-1]);
    184183      double electron_short_range_energy = short_range_correction.integral();
    185       full_sample_solution -= short_range_correction;
    186184      electron_solution_energy -= electron_short_range_energy;
    187       ASSERT( fabs(electron_solution_energy - full_sample_solution.integral()) < 1e-7,
    188           "FragmentationLongRangeResults::operator() - integral and energy are not exchangeable.");
     185#ifndef NDEBUG
     186      {
     187        static const double round_offset(
     188            (std::numeric_limits<size_t>::round_style == std::round_toward_zero) ?
     189                0.5 : 0.); // need offset to get to round_toward_nearest behavior
     190        // we can only check equivalence if both have same level, otherwise
     191        // short_range_correction.integral() has higher precision because of finger grid
     192        const int surplus_level = full_sample_solution.getSurplusLevel(short_range_correction)+round_offset;
     193        if (full_sample_solution.level == short_range_correction.level+surplus_level) {
     194          SamplingGrid check_difference_full_solution = full_sample_solution;
     195          check_difference_full_solution -= short_range_correction;
     196          ASSERT( fabs(electron_solution_energy - check_difference_full_solution.integral()) < 1e-7,
     197              "FragmentationLongRangeResults::operator() - integral and energy are not exchangeable.");
     198        }
     199      }
     200#endif
    189201
    190202      // then, we obtain the e-n+n-n full solution in the same way
Note: See TracChangeset for help on using the changeset viewer.