source: src/Fragmentation/Summation/Converter/DataConverter.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 e355b31, checked in by Frederik Heber <heber@…>, 11 years ago

Added both_sampled_potential to VMGData, analogous to nuclei_longrange.

  • AnalyseFragmentationResultsAction sets both both_sampled_potential and nuclei_longrange from second set of longrange calculations.
  • we require the combined potential for fitting partial nuclei charges
  • fixed typo in testsuite-fragmentation-analyse-fragment-results.at
  • Property mode set to 100644
File size: 7.7 KB
Line 
1/*
2 * DataConverter.hpp
3 *
4 * Created on: Aug 27, 2012
5 * Author: heber
6 */
7
8#ifndef DATACONVERTER_HPP_
9#define DATACONVERTER_HPP_
10
11
12// include config.h
13#ifdef HAVE_CONFIG_H
14#include <config.h>
15#endif
16
17#include <map>
18#include <boost/fusion/sequence.hpp>
19
20#include "CodePatterns/Assert.hpp"
21
22#ifdef HAVE_JOBMARKET
23#include "JobMarket/types.hpp"
24#else
25typedef size_t JobId_t;
26#endif
27
28#include "Fragmentation/KeySetsContainer.hpp"
29#include "Fragmentation/Summation/SetValues/Eigenvalues.hpp"
30#include "Fragmentation/Summation/SetValues/Histogram.hpp"
31#include "Fragmentation/Summation/SetValues/Fragment.hpp"
32#include "Fragmentation/Summation/SetValues/IndexedVectors.hpp"
33
34#include "Fragmentation/Summation/Containers/MPQCData.hpp"
35#include "Fragmentation/Summation/Containers/MPQCDataFused.hpp"
36#include "Fragmentation/Summation/Containers/MPQCDataMap.hpp"
37#ifdef HAVE_VMG
38#include "Fragmentation/Summation/Containers/VMGData.hpp"
39#include "Fragmentation/Summation/Containers/VMGDataFused.hpp"
40#include "Fragmentation/Summation/Containers/VMGDataMap.hpp"
41#endif
42
43template <typename source, typename dest>
44inline void convertDataTo(
45 const std::map<JobId_t, source> &fragmentData,
46 std::map<JobId_t, dest> &MPQCData_fused)
47{
48 MPQCData_fused.clear();
49}
50
51template <>
52inline void convertDataTo<MPQCData, MPQCDataEnergyMap_t>(
53 const std::map<JobId_t, MPQCData> &fragmentData,
54 std::map<JobId_t, MPQCDataEnergyMap_t> &MPQCData_Energy_fused)
55{
56 // energy_t
57 MPQCData_Energy_fused.clear();
58 for(std::map<JobId_t, MPQCData>::const_iterator dataiter = fragmentData.begin();
59 dataiter != fragmentData.end(); ++dataiter) {
60 const MPQCData &extractedData = dataiter->second;
61 LOG(4, "DEBUG: Current extracted Data is " << extractedData << ".");
62 MPQCDataEnergyMap_t instance;
63 boost::fusion::at_key<MPQCDataFused::energy_total>(instance) = extractedData.energies.total;
64 boost::fusion::at_key<MPQCDataFused::energy_nuclear_repulsion>(instance) = extractedData.energies.nuclear_repulsion;
65 boost::fusion::at_key<MPQCDataFused::energy_electron_coulomb>(instance) = extractedData.energies.electron_coulomb;
66 boost::fusion::at_key<MPQCDataFused::energy_electron_exchange>(instance) = extractedData.energies.electron_exchange;
67 boost::fusion::at_key<MPQCDataFused::energy_correlation>(instance) = extractedData.energies.correlation;
68 boost::fusion::at_key<MPQCDataFused::energy_overlap>(instance) = extractedData.energies.overlap;
69 boost::fusion::at_key<MPQCDataFused::energy_kinetic>(instance) = extractedData.energies.kinetic;
70 boost::fusion::at_key<MPQCDataFused::energy_hcore>(instance) = extractedData.energies.hcore;
71 boost::fusion::at_key<MPQCDataFused::energy_eigenvalues>(instance) = extractedData.energies.eigenvalues;
72 boost::fusion::at_key<MPQCDataFused::energy_eigenhistogram>(instance) = extractedData.energies.eigenvalues;
73 MPQCData_Energy_fused.insert( std::make_pair(dataiter->first, instance) );
74 }
75}
76
77#ifdef HAVE_VMG
78template <>
79inline void convertDataTo<VMGData, VMGDataMap_t>(
80 const std::map<JobId_t, VMGData> &longrangeData,
81 std::map<JobId_t, VMGDataMap_t> &VMGData_fused)
82{
83 // energy_t
84 VMGData_fused.clear();
85 for(std::map<JobId_t, VMGData>::const_iterator dataiter = longrangeData.begin();
86 dataiter != longrangeData.end(); ++dataiter) {
87 const VMGData &extractedData = dataiter->second;
88 LOG(4, "DEBUG: Current extracted Data is " << extractedData << ".");
89 VMGDataMap_t instance;
90 boost::fusion::at_key<VMGDataFused::sampled_potential>(instance) = extractedData.sampled_potential;
91 boost::fusion::at_key<VMGDataFused::both_sampled_potential>(instance) = extractedData.both_sampled_potential;
92 boost::fusion::at_key<VMGDataFused::nuclei_long>(instance) = extractedData.nuclei_long;
93 boost::fusion::at_key<VMGDataFused::electron_long>(instance) = extractedData.electron_long;
94 VMGData_fused.insert( std::make_pair(dataiter->first, instance) );
95 }
96}
97#endif
98
99inline void convertMPQCDatatoForceMap(
100 const std::map<JobId_t, MPQCData> &fragmentData,
101 const KeySetsContainer &ForceKeySet,
102 std::map<JobId_t, MPQCDataForceMap_t> &MPQCData_Force_fused)
103{
104 // forces
105 ASSERT( ForceKeySet.KeySets.size() == fragmentData.size(),
106 "FragmentationAutomationAction::performCall() - indices and fragmentData differ in size.");
107 MPQCData_Force_fused.clear();
108 std::map<JobId_t, MPQCData>::const_iterator dataiter = fragmentData.begin();
109 KeySetsContainer::ArrayOfIntVectors::const_iterator arrayiter = ForceKeySet.KeySets.begin();
110 for(;dataiter != fragmentData.end(); ++dataiter, ++arrayiter) {
111 const MPQCData &extractedData = dataiter->second;
112 LOG(4, "DEBUG: Current extracted Data is " << extractedData << ".");
113 MPQCDataForceMap_t instance;
114 // must convert int to index_t
115 IndexedVectors::indices_t indices(arrayiter->begin(), arrayiter->end());
116 boost::fusion::at_key<MPQCDataFused::forces>(instance) =
117 IndexedVectors(indices, extractedData.forces);
118 MPQCData_Force_fused.insert( std::make_pair(dataiter->first, instance) );
119 }
120}
121
122template <>
123inline void convertDataTo<MPQCData, MPQCDataGridMap_t>(
124 const std::map<JobId_t, MPQCData> &fragmentData,
125 std::map<JobId_t, MPQCDataGridMap_t> &MPQCData_Grid_fused)
126{
127 // sampled_grid
128 MPQCData_Grid_fused.clear();
129 for(std::map<JobId_t, MPQCData>::const_iterator dataiter = fragmentData.begin();
130 dataiter != fragmentData.end(); ++dataiter) {
131 const MPQCData &extractedData = dataiter->second;
132 LOG(4, "DEBUG: Current extracted Data is " << extractedData << ".");
133 MPQCDataGridMap_t instance;
134 boost::fusion::at_key<MPQCDataFused::sampled_grid>(instance) = extractedData.sampled_grid;
135 MPQCData_Grid_fused.insert( std::make_pair(dataiter->first, instance) );
136 }
137}
138
139template <>
140inline void convertDataTo<MPQCData, MPQCDataFragmentMap_t>(
141 const std::map<JobId_t, MPQCData> &fragmentData,
142 std::map<JobId_t, MPQCDataFragmentMap_t> &MPQCData_Fragment_fused)
143{
144 // fragment
145 MPQCData_Fragment_fused.clear();
146 for(std::map<JobId_t, MPQCData>::const_iterator dataiter = fragmentData.begin();
147 dataiter != fragmentData.end(); ++dataiter) {
148 const MPQCData &extractedData = dataiter->second;
149 LOG(4, "DEBUG: Current extracted Data is " << extractedData << ".");
150 MPQCDataFragmentMap_t instance;
151 boost::fusion::at_key<MPQCDataFused::fragment>(instance) =
152 Fragment(extractedData.positions, extractedData.charges);
153 MPQCData_Fragment_fused.insert( std::make_pair(dataiter->first, instance) );
154 }
155}
156
157template <>
158inline void convertDataTo<MPQCData, MPQCDataTimeMap_t>(
159 const std::map<JobId_t, MPQCData> &fragmentData,
160 std::map<JobId_t, MPQCDataTimeMap_t> &MPQCData_Time_fused)
161{
162 // times
163 MPQCData_Time_fused.clear();
164 for(std::map<JobId_t, MPQCData>::const_iterator dataiter = fragmentData.begin();
165 dataiter != fragmentData.end(); ++dataiter) {
166 const MPQCData &extractedData = dataiter->second;
167 LOG(4, "DEBUG: Current extracted Data is " << extractedData << ".");
168 MPQCDataTimeMap_t instance;
169 boost::fusion::at_key<MPQCDataFused::times_total_walltime>(instance) = extractedData.times.total_walltime;
170 boost::fusion::at_key<MPQCDataFused::times_total_cputime>(instance) = extractedData.times.total_cputime;
171 boost::fusion::at_key<MPQCDataFused::times_total_flops>(instance) = extractedData.times.total_flops;
172 boost::fusion::at_key<MPQCDataFused::times_gather_walltime>(instance) = extractedData.times.gather_walltime;
173 boost::fusion::at_key<MPQCDataFused::times_gather_cputime>(instance) = extractedData.times.gather_cputime;
174 boost::fusion::at_key<MPQCDataFused::times_gather_flops>(instance) = extractedData.times.gather_flops;
175 MPQCData_Time_fused.insert( std::make_pair(dataiter->first, instance) );
176 }
177}
178
179
180#endif /* DATACONVERTER_HPP_ */
Note: See TracBrowser for help on using the repository browser.