source: src/Fragmentation/Summation/Containers/FragmentationResultContainer.hpp@ 8eafd6

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests 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_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 FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes 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 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
Last change on this file since 8eafd6 was 18ed8c, checked in by Frederik Heber <heber@…>, 10 years ago

All HAVE_VMG also check for HAVE_JOBMARKET.

  • Property mode set to 100644
File size: 6.0 KB
Line 
1/*
2 * FragmentationResultContainer.hpp
3 *
4 * Created on: Mar 8, 2013
5 * Author: heber
6 */
7
8#ifndef FRAGMENTATIONRESULTCONTAINER_HPP_
9#define FRAGMENTATIONRESULTCONTAINER_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include <boost/serialization/access.hpp>
17#include <boost/serialization/map.hpp>
18#include <boost/serialization/split_member.hpp>
19#include <boost/serialization/version.hpp>
20#include "CodePatterns/Singleton.hpp"
21
22#include <boost/filesystem/path.hpp>
23#include <map>
24
25#include "CodePatterns/Observer/Observable.hpp"
26
27#ifdef HAVE_JOBMARKET
28#include "JobMarket/types.hpp"
29#else
30typedef size_t JobId_t;
31#endif
32
33#include "Fragmentation/KeySetsContainer.hpp"
34#include "Fragmentation/Summation/IndexSet.hpp"
35#include "Fragmentation/Summation/Containers/FragmentationShortRangeResults.hpp"
36#include "Fragmentation/Summation/Containers/MPQCData.hpp"
37#include "Fragmentation/Summation/Containers/MPQCDataMap.hpp"
38#if defined(HAVE_JOBMARKET) && defined(HAVE_VMG)
39#include "Fragmentation/Summation/Containers/VMGData.hpp"
40#endif
41
42/** This class stores results from lengthy fragmentation calculations, e.g.
43 * coming out of FragmentationAutomationAction.
44 *
45 * The idea is that we can play around with results without having to recalculate
46 * results in between. Hence, we place results into this container which we may
47 * full serialize.
48 */
49class FragmentationResultContainer :
50 public Singleton<FragmentationResultContainer>,
51 public Observable
52{
53 //!> Singleton patterns needs access to private cstor/dtor.
54 friend class Singleton<FragmentationResultContainer>;
55private:
56 FragmentationResultContainer() :
57 Observable("FragmentationResultContainer"),
58 ResultsType(BothRanges)
59 {}
60 ~FragmentationResultContainer() {}
61
62public:
63 //!> typedef for short range data container
64 typedef std::map<JobId_t, MPQCData> shortrangedata_t;
65#if defined(HAVE_JOBMARKET) && defined(HAVE_VMG)
66 //!> typedef for long range data container
67 typedef std::map<JobId_t, VMGData> longrangedata_t;
68#endif
69
70#if defined(HAVE_JOBMARKET) && defined(HAVE_VMG)
71 /** Adds a a set of both short and long range results.
72 *
73 * Adds all the containers to the ones present in this instance.
74 *
75 * \param _keysets
76 * \param _forcekeysetskeysets
77 * \param _shortrangedata
78 * \param _longrangedata
79 */
80 void addFullResults(
81 const KeySetsContainer &_keysets,
82 const KeySetsContainer &_forcekeysets,
83 const shortrangedata_t &_shortrangedata,
84 const longrangedata_t &_longrangedata
85 );
86#endif
87
88 /** Adds a a set of short range results only.
89 *
90 * Adds all the containers to the ones present in this instance.
91 *
92 * \param _keysets
93 * \param _forcekeysets
94 * \param _shortrangedata
95 */
96 void addShortRangeResults(
97 const KeySetsContainer &_keysets,
98 const KeySetsContainer &_forcekeysets,
99 const shortrangedata_t &_shortrangedata
100 );
101
102 /** Adds a a set of summed short range results.
103 *
104 * Adds all the containers to the ones present in this instance.
105 *
106 * \param _summedshortrange energy results per index set
107 */
108 void addShortRangeSummedResults(
109 const FragmentationShortRangeResults::summedshortrange_t &_summedshortrange
110 );
111
112 /** Adds given cycles to internal keyset list.
113 *
114 * \param _cycles keysets of cycles to add
115 */
116 void addCycles(const KeySetsContainer &_cycles)
117 { cycles.insert(_cycles); }
118
119 /** Clears all internal containers.
120 *
121 * \note Also resets ResultsType.
122 */
123 void clear()
124 {
125 OBSERVE;
126 keysets.clear();
127 forcekeysets.clear();
128 shortrangedata.clear();
129 summedshortrange.clear();
130#if defined(HAVE_JOBMARKET) && defined(HAVE_VMG)
131 longrangedata.clear();
132#endif
133 ResultsType = BothRanges;
134 }
135
136 const KeySetsContainer &getKeySets() const { return keysets; }
137 const KeySetsContainer &getCycles() const { return cycles; }
138 const KeySetsContainer &getForceKeySets() const { return forcekeysets; }
139 const shortrangedata_t& getShortRangeResults() const { return shortrangedata; }
140 const FragmentationShortRangeResults::summedshortrange_t& getShortRangeSummedResults() const { return summedshortrange; }
141#if defined(HAVE_JOBMARKET) && defined(HAVE_VMG)
142 const longrangedata_t& getLongRangeResults() const;
143#endif
144 bool areFullRangeResultsPresent() const { return (ResultsType == BothRanges); }
145
146private:
147 //!> indicates whether we contain short range only or both results
148 enum ResultsType_t {
149 ShortRangeOnly,
150 BothRanges,
151 } ResultsType;
152
153 //!> container for all KeySet's without hydrogens to the jobs
154 KeySetsContainer keysets;
155 //!> container for all KeySet's with all except saturation hydrogen to the jobs
156 KeySetsContainer forcekeysets;
157 //!> container for all short-range results
158 std::map<JobId_t, MPQCData> shortrangedata;
159 //! container of all cycle keysets
160 KeySetsContainer cycles;
161 //!> container for summed up results per index set
162 FragmentationShortRangeResults::summedshortrange_t summedshortrange;
163
164#if defined(HAVE_JOBMARKET) && defined(HAVE_VMG)
165 //!> container for all long-range results
166 std::map<JobId_t, VMGData> longrangedata;
167#endif
168
169 friend class boost::serialization::access;
170 // serialization
171 template <typename Archive>
172 void load(Archive& ar, const unsigned int version)
173 {
174 OBSERVE;
175 ar & ResultsType;
176 ar & keysets;
177 ar & forcekeysets;
178 ar & shortrangedata;
179 if (version > 0)
180 ar & cycles;
181 if (version > 1)
182 ar & summedshortrange;
183#if defined(HAVE_JOBMARKET) && defined(HAVE_VMG)
184 ar & longrangedata;
185#endif
186 }
187 template <typename Archive>
188 void save(Archive& ar, const unsigned int version) const
189 {
190 ar & ResultsType;
191 ar & keysets;
192 ar & forcekeysets;
193 ar & shortrangedata;
194 if (version > 0)
195 ar & cycles;
196 if (version > 1)
197 ar & summedshortrange;
198#if defined(HAVE_JOBMARKET) && defined(HAVE_VMG)
199 ar & longrangedata;
200#endif
201 }
202 BOOST_SERIALIZATION_SPLIT_MEMBER()
203};
204
205// version for serialized information associated to FragmentationResultContainer
206BOOST_CLASS_VERSION(FragmentationResultContainer, 2)
207
208#endif /* FRAGMENTATIONRESULTCONTAINER_HPP_ */
Note: See TracBrowser for help on using the repository browser.