source: src/Fragmentation/Summation/Containers/MPQCData.hpp@ 11edf0

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator 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_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects 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 PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 11edf0 was 2ebfd7, checked in by Frederik Heber <heber@…>, 9 years ago

MPQCData::assignWithDownsampledGrid() uses downsample().

  • in order to avoid any unnecessary copying of the grids we implemented an additional assignment-like function that copies all values but the grid which is first cut down to a desired level size. We use full weight restriction as is used in vmg's stencils.hpp.
  • Property mode set to 100644
File size: 4.3 KB
Line 
1/*
2 * MPQCData.hpp
3 *
4 * Created on: Feb 08, 2012
5 * Author: heber
6 */
7
8#ifndef MPQCDATA_HPP_
9#define MPQCDATA_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/vector.hpp>
18#include <boost/serialization/version.hpp>
19
20#include <iosfwd>
21#include <vector>
22
23#include "Fragmentation/Summation/SetValues/SamplingGrid.hpp"
24#include "Fragmentation/Summation/SetValues/FragmentForces.hpp"
25
26class MPQCCommandJob;
27class MPQCCommandJobTest;
28class MPQCDataTest;
29
30/** Internal class that holds the data and can be serialized.
31 *
32 */
33class MPQCData {
34 //!> allow MPQCCommandJob access to member variables directly
35 friend class MPQCCommandJob;
36 //!> grant MPQCCommandJob's unit test access
37 friend class MPQCCommandJobTest;
38 //!> grant unit test access
39 friend class MPQCDataTest;
40 //!> grant access to output stream operator
41 friend std::ostream & operator<<(std::ostream &ost, const MPQCData &data);
42public:
43 /** Constructor for class MPQCData with full sampling information.
44 *
45 * \param _props properties of the grid
46 */
47 MPQCData(const SamplingGridProperties &_props);
48
49 /** Default Constructor for class MPQCData.
50 *
51 */
52 MPQCData();
53
54 bool operator==(const MPQCData &other) const;
55
56 bool operator!=(const MPQCData &other) const {
57 return !(*this == other);
58 }
59
60 /** Assignment operator with a downsampled grid.
61 *
62 * All values are taken over (with self-assignment check), but the grid
63 * is sampled down to the desired \a _level (left untouched if larger
64 * than grid level contained in \a other).
65 *
66 * \param instance instance to assign, containing desired grid and level
67 * \param other instance to get values and grid from
68 */
69 static void assignWithDownsampledGrid(
70 MPQCData &instance,
71 const MPQCData &other);
72
73 /// Energie structure
74 struct energy_t {
75 /** Constructor for struct energy_t, sets all to zero.
76 *
77 */
78 energy_t();
79
80 double total;
81 double nuclear_repulsion;
82 double electron_coulomb;
83 double electron_exchange;
84 double correlation;
85 double overlap;
86 double kinetic;
87 double hcore;
88
89 std::vector<double> eigenvalues;
90 } energies;
91
92 /// Forces
93 FragmentForces forces;
94
95 //!> whether to actually sample the density
96 enum DoLongrange_t {
97 DontSampleDensity=0,
98 DoSampleDensity=1
99 };
100 DoLongrange_t DoLongrange;
101
102 //!> whether to sample just the valence or the total electron and nuclei density
103 enum DoValenceOnly_t {
104 DontSampleValenceOnly=0,
105 DoSampleValenceOnly=1
106 };
107 DoValenceOnly_t DoValenceOnly;
108
109 /// Density
110 SamplingGrid sampled_grid;
111
112 // nuclei positions and charges
113 std::vector< std::vector<double> > positions;
114 std::vector<double> charges;
115
116 /// Timing structure
117 struct times_t {
118 /** Constructor for struct times_t, sets all to zero.
119 *
120 */
121 times_t();
122
123 double total_walltime;
124 double total_cputime;
125 double total_flops;
126 double gather_walltime;
127 double gather_cputime;
128 double gather_flops;
129 } times;
130
131 //!> reached (relative) accuracy
132 double accuracy;
133 //!> desired accuracy
134 double desired_accuracy;
135
136private:
137 friend class boost::serialization::access;
138 // serialization
139 template <typename Archive>
140 void serialize(Archive& ar, const unsigned int version)
141 {
142 ar & energies.total;
143 ar & energies.nuclear_repulsion;
144 ar & energies.electron_coulomb;
145 ar & energies.electron_exchange;
146 ar & energies.correlation;
147 ar & energies.overlap;
148 ar & energies.kinetic;
149 ar & energies.hcore;
150 ar & energies.eigenvalues;
151 if (version < 2) {
152 FragmentForces::forces_t justforces(forces);
153 ar & justforces;
154 dynamic_cast<FragmentForces::forces_t &>(forces) = justforces;
155 } else
156 ar & forces;
157 ar & sampled_grid;
158 ar & DoLongrange;
159 if (version > 0)
160 ar & DoValenceOnly;
161 ar & positions;
162 ar & charges;
163 ar & times.total_walltime;
164 ar & times.total_cputime;
165 ar & times.total_flops;
166 ar & times.gather_walltime;
167 ar & times.gather_cputime;
168 ar & times.gather_flops;
169 if (version > 2) {
170 ar & accuracy;
171 ar & desired_accuracy;
172 }
173 }
174};
175
176BOOST_CLASS_VERSION(MPQCData, 3)
177
178std::ostream & operator<<(std::ostream &ost, const MPQCData &data);
179
180#endif /* MPQCDATA_HPP_ */
Note: See TracBrowser for help on using the repository browser.