Changeset a1eeb3


Ignore:
Timestamp:
Jun 9, 2016, 6:32:25 PM (9 years ago)
Author:
Frederik Heber <heber@…>
Parents:
e2fd2c
git-author:
Frederik Heber <heber@…> (06/07/16 08:00:51)
git-committer:
Frederik Heber <heber@…> (06/09/16 18:32:25)
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

    re2fd2c ra1eeb3  
    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.