source: src/Fragmentation/Summation/Containers/FragmentationResultContainer.hpp@ 16893f

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments 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_BoundInBox_CenterInBox_MoleculeActions 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 FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation 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 16893f was c8d13f5, checked in by Frederik Heber <heber@…>, 11 years ago

Summed up results are now handed-over to FragmentationResultContainer by AnalyseFragmentationResultsAction.

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