| 1 | /* | 
|---|
| 2 | * FragmentationShortRangeResults.hpp | 
|---|
| 3 | * | 
|---|
| 4 | *  Created on: Mar 7, 2013 | 
|---|
| 5 | *      Author: heber | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef FRAGMENTATIONSHORTRANGERESULTS_HPP_ | 
|---|
| 9 | #define FRAGMENTATIONSHORTRANGERESULTS_HPP_ | 
|---|
| 10 |  | 
|---|
| 11 |  | 
|---|
| 12 | // include config.h | 
|---|
| 13 | #ifdef HAVE_CONFIG_H | 
|---|
| 14 | #include <config.h> | 
|---|
| 15 | #endif | 
|---|
| 16 |  | 
|---|
| 17 | #include <map> | 
|---|
| 18 | #include <vector> | 
|---|
| 19 |  | 
|---|
| 20 | #ifdef HAVE_JOBMARKET | 
|---|
| 21 | #include "JobMarket/types.hpp" | 
|---|
| 22 | #else | 
|---|
| 23 | typedef size_t JobId_t; | 
|---|
| 24 | #endif | 
|---|
| 25 |  | 
|---|
| 26 | #include "Fragmentation/EdgesPerFragment.hpp" | 
|---|
| 27 | #include "Fragmentation/KeySetsContainer.hpp" | 
|---|
| 28 | #include "Fragmentation/Summation/IndexSet.hpp" | 
|---|
| 29 | #include "Fragmentation/Summation/IndexSetContainer.hpp" | 
|---|
| 30 | #include "Fragmentation/Summation/SubsetMap.hpp" | 
|---|
| 31 |  | 
|---|
| 32 | #include "Fragmentation/Summation/Containers/MPQCData.hpp" | 
|---|
| 33 | #include "Fragmentation/Summation/Containers/MPQCDataMap.hpp" | 
|---|
| 34 |  | 
|---|
| 35 | /** FragmentationShortRangeResults contains the summed up results per level resulting | 
|---|
| 36 | * from the fragmentation of the molecular system and clever combination of | 
|---|
| 37 | * fragmentary energies, forces, timings, and so on. | 
|---|
| 38 | * | 
|---|
| 39 | * This structure is mostly a storage wherein the summed up results are | 
|---|
| 40 | * contained for subsequent pretty printing and so on. | 
|---|
| 41 | * | 
|---|
| 42 | */ | 
|---|
| 43 | struct FragmentationShortRangeResults | 
|---|
| 44 | { | 
|---|
| 45 | typedef FragmentationEdges::edges_per_fragment_t edges_per_fragment_t; | 
|---|
| 46 |  | 
|---|
| 47 | /** Constructor for class FragmentationShortRangeResults, based on KeySets. | 
|---|
| 48 | * | 
|---|
| 49 | * @param fragmentData results from short-range fragment calculations | 
|---|
| 50 | * @param _KeySet KeySets of all (non-hydrogen) atoms | 
|---|
| 51 | * @param _ForceKeySet KeySets of all atoms except those added by saturation | 
|---|
| 52 | * @param _edges_per_fragment edges of the bond graph over all fragment jobs | 
|---|
| 53 | * @param _ValueMask masks whether to use a value (true) or not (false), | 
|---|
| 54 | *        default is true for all values | 
|---|
| 55 | */ | 
|---|
| 56 | FragmentationShortRangeResults( | 
|---|
| 57 | const std::map<JobId_t,MPQCData> &fragmentData, | 
|---|
| 58 | const KeySetsContainer& _KeySet, | 
|---|
| 59 | const KeySetsContainer& _ForceKeySet, | 
|---|
| 60 | const edges_per_fragment_t &_edges_per_fragment, | 
|---|
| 61 | std::vector<bool> &_ValueMask); | 
|---|
| 62 |  | 
|---|
| 63 | /** Performs the summation and fills all result vectors. | 
|---|
| 64 | * | 
|---|
| 65 | * @param fragmentData results from short-range fragment calculations | 
|---|
| 66 | */ | 
|---|
| 67 | void operator()( | 
|---|
| 68 | const std::map<JobId_t,MPQCData> &fragmentData); | 
|---|
| 69 |  | 
|---|
| 70 | size_t getMaxLevel() const { | 
|---|
| 71 | return MaxLevel; | 
|---|
| 72 | } | 
|---|
| 73 |  | 
|---|
| 74 | IndexSetContainer::Container_t getContainer() const { | 
|---|
| 75 | return container->getContainer(); | 
|---|
| 76 | } | 
|---|
| 77 |  | 
|---|
| 78 | const KeySetsContainer& getKeySet() const { | 
|---|
| 79 | return KeySet; | 
|---|
| 80 | } | 
|---|
| 81 |  | 
|---|
| 82 | const KeySetsContainer& getForceKeySet() const { | 
|---|
| 83 | return ForceKeySet; | 
|---|
| 84 | } | 
|---|
| 85 |  | 
|---|
| 86 | const edges_per_fragment_t& getEdgesPerFragment() const { | 
|---|
| 87 | return edges_per_fragment; | 
|---|
| 88 | } | 
|---|
| 89 |  | 
|---|
| 90 | typedef std::map<IndexSet::ptr, std::pair<MPQCData,MPQCData> > summedshortrange_t; | 
|---|
| 91 | const summedshortrange_t getSummedShortRangeResults() const; | 
|---|
| 92 |  | 
|---|
| 93 | private: | 
|---|
| 94 | void initLookups( | 
|---|
| 95 | const std::map<JobId_t,MPQCData> &fragmentData, | 
|---|
| 96 | std::vector<bool> &_ValueMask); | 
|---|
| 97 |  | 
|---|
| 98 | private: | 
|---|
| 99 | std::map< JobId_t, size_t > MPQCMatrixNrLookup; | 
|---|
| 100 | KeySetsContainer KeySet; | 
|---|
| 101 | KeySetsContainer ForceKeySet; | 
|---|
| 102 | edges_per_fragment_t edges_per_fragment; | 
|---|
| 103 | IndexSetContainer::ptr container; | 
|---|
| 104 | SubsetMap::ptr subsetmap; | 
|---|
| 105 |  | 
|---|
| 106 | public: | 
|---|
| 107 | //!> results per level of summed up energy | 
|---|
| 108 | std::vector<MPQCDataEnergyMap_t> Result_Energy_fused; | 
|---|
| 109 | //!> results per level of summed up fragment positions and charges | 
|---|
| 110 | std::vector<MPQCDataFragmentMap_t> Result_Fragment_fused; | 
|---|
| 111 | //!> results per level of summed up times | 
|---|
| 112 | std::vector<MPQCDataTimeMap_t> Result_Time_fused; | 
|---|
| 113 | //!> results per level of summed up forces | 
|---|
| 114 | std::vector<MPQCDataForceMap_t> Result_Force_fused; | 
|---|
| 115 |  | 
|---|
| 116 | //!> results per IndexSet of summed up energy | 
|---|
| 117 | std::map<IndexSet::ptr, std::pair<MPQCDataEnergyMap_t,MPQCDataEnergyMap_t> > Result_perIndexSet_Energy; | 
|---|
| 118 | //!> results per IndexSet of summed up fragment positions and charges | 
|---|
| 119 | std::map<IndexSet::ptr, std::pair<MPQCDataFragmentMap_t,MPQCDataFragmentMap_t> > Result_perIndexSet_Fragment; | 
|---|
| 120 | //!> results per IndexSet of summed up times | 
|---|
| 121 | std::map<IndexSet::ptr, std::pair<MPQCDataTimeMap_t,MPQCDataTimeMap_t> > Result_perIndexSet_Time; | 
|---|
| 122 | //!> results per IndexSet of summed up forces | 
|---|
| 123 | std::map<IndexSet::ptr, std::pair<MPQCDataForceMap_t, MPQCDataForceMap_t> > Result_perIndexSet_Force; | 
|---|
| 124 | // we don't need the map pendant for Result_LongRangeIntegrated_fused, as this | 
|---|
| 125 | // quantity makes sense only level-wise | 
|---|
| 126 |  | 
|---|
| 127 | private: | 
|---|
| 128 | //!> maximum level of summation | 
|---|
| 129 | size_t MaxLevel; | 
|---|
| 130 | }; | 
|---|
| 131 |  | 
|---|
| 132 |  | 
|---|
| 133 | #endif /* FRAGMENTATIONSHORTRANGERESULTS_HPP_ */ | 
|---|