source: src/Fragmentation/Summation/Containers/FragmentationResultContainer.hpp@ e0ae58d

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 e0ae58d was adb51ab, checked in by Frederik Heber <heber@…>, 11 years ago

FragmentationAction stores cycles to file and in FragmentationResultContainer.

  • added FragmentationResultContainer::addCycles() to add cycle keysets to the present cycle-specific KeySetsContainer. These must be given as KeySetsContainer to avoid dependencing on libMolecuilderFragmentation.so which vector<KeySet> would trigger.
  • added CYCLEKEYSETFILE with default file name
  • Property mode set to 100644
File size: 4.5 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/Containers/MPQCData.hpp"
32#ifdef HAVE_VMG
33#include "Fragmentation/Summation/Containers/VMGData.hpp"
34#endif
35
36/** This class stores results from lengthy fragmentation calculations, e.g.
37 * coming out of FragmentationAutomationAction.
38 *
39 * The idea is that we can play around with results without having to recalculate
40 * results in between. Hence, we place results into this container which we may
41 * full serialize.
42 */
43class FragmentationResultContainer :
44 public Singleton<FragmentationResultContainer>,
45 public Observable
46{
47 //!> Singleton patterns needs access to private cstor/dtor.
48 friend class Singleton<FragmentationResultContainer>;
49private:
50 FragmentationResultContainer() :
51 Observable("FragmentationResultContainer"),
52 ResultsType(BothRanges)
53 {}
54 ~FragmentationResultContainer() {}
55
56public:
57 //!> typedef for short range data container
58 typedef std::map<JobId_t, MPQCData> shortrangedata_t;
59#ifdef HAVE_VMG
60 //!> typedef for long range data container
61 typedef std::map<JobId_t, VMGData> longrangedata_t;
62#endif
63
64#ifdef HAVE_VMG
65 /** Adds a a set of both short and long range results.
66 *
67 * Adds all the containers to the ones present in this instance.
68 *
69 * \param _keysets
70 * \param _forcekeysetskeysets
71 * \param _shortrangedata
72 * \param _longrangedata
73 */
74 void addFullResults(
75 const KeySetsContainer &_keysets,
76 const KeySetsContainer &_forcekeysets,
77 const shortrangedata_t &_shortrangedata,
78 const longrangedata_t &_longrangedata
79 );
80#endif
81
82 /** Adds a a set of short range results only.
83 *
84 * Adds all the containers to the ones present in this instance.
85 *
86 * \param _keysets
87 * \param _forcekeysets
88 * \param _shortrangedata
89 */
90 void addShortRangeResults(
91 const KeySetsContainer &_keysets,
92 const KeySetsContainer &_forcekeysets,
93 const shortrangedata_t &_shortrangedata
94 );
95
96 /** Adds given cycles to internal keyset list.
97 *
98 * \param _cycles keysets of cycles to add
99 */
100 void addCycles(const KeySetsContainer &_cycles)
101 { cycles.insert(_cycles); }
102
103 /** Clears all internal containers.
104 *
105 * \note Also resets ResultsType.
106 */
107 void clear()
108 {
109 OBSERVE;
110 keysets.clear();
111 forcekeysets.clear();
112 shortrangedata.clear();
113#ifdef HAVE_VMG
114 longrangedata.clear();
115#endif
116 ResultsType = BothRanges;
117 }
118
119 const KeySetsContainer &getKeySets() const { return keysets; }
120 const KeySetsContainer &getCycles() const { return cycles; }
121 const KeySetsContainer &getForceKeySets() const { return forcekeysets; }
122 const shortrangedata_t& getShortRangeResults() const { return shortrangedata; }
123#ifdef HAVE_VMG
124 const longrangedata_t& getLongRangeResults() const;
125#endif
126 bool areFullRangeResultsPresent() const { return (ResultsType == BothRanges); }
127
128private:
129 //!> indicates whether we contain short range only or both results
130 enum ResultsType_t {
131 ShortRangeOnly,
132 BothRanges,
133 } ResultsType;
134
135 //!> container for all KeySet's without hydrogens to the jobs
136 KeySetsContainer keysets;
137 //!> container for all KeySet's with all except saturation hydrogen to the jobs
138 KeySetsContainer forcekeysets;
139 //!> container for all short-range results
140 std::map<JobId_t, MPQCData> shortrangedata;
141 //! container of all cycle keysets
142 KeySetsContainer cycles;
143
144#ifdef HAVE_VMG
145 //!> container for all long-range results
146 std::map<JobId_t, VMGData> longrangedata;
147#endif
148
149 friend class boost::serialization::access;
150 // serialization
151 template <typename Archive>
152 void serialize(Archive& ar, const unsigned int version)
153 {
154 ar & ResultsType;
155 ar & keysets;
156 ar & forcekeysets;
157 ar & shortrangedata;
158 if (version > 0)
159 ar & cycles;
160#ifdef HAVE_VMG
161 ar & longrangedata;
162#endif
163 }
164};
165
166// version for serialized information associated to FragmentationResultContainer
167BOOST_CLASS_VERSION(FragmentationResultContainer, 1)
168
169#endif /* FRAGMENTATIONRESULTCONTAINER_HPP_ */
Note: See TracBrowser for help on using the repository browser.