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 |
|
---|
26 | class MPQCCommandJob;
|
---|
27 | class MPQCCommandJobTest;
|
---|
28 | class MPQCDataTest;
|
---|
29 |
|
---|
30 | /** Internal class that holds the data and can be serialized.
|
---|
31 | *
|
---|
32 | */
|
---|
33 | class 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);
|
---|
42 | public:
|
---|
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 | /// Energie structure
|
---|
61 | struct energy_t {
|
---|
62 | /** Constructor for struct energy_t, sets all to zero.
|
---|
63 | *
|
---|
64 | */
|
---|
65 | energy_t();
|
---|
66 |
|
---|
67 | double total;
|
---|
68 | double nuclear_repulsion;
|
---|
69 | double electron_coulomb;
|
---|
70 | double electron_exchange;
|
---|
71 | double correlation;
|
---|
72 | double overlap;
|
---|
73 | double kinetic;
|
---|
74 | double hcore;
|
---|
75 |
|
---|
76 | std::vector<double> eigenvalues;
|
---|
77 | } energies;
|
---|
78 |
|
---|
79 | /// Forces
|
---|
80 | FragmentForces forces;
|
---|
81 |
|
---|
82 | //!> whether to actually sample the density
|
---|
83 | enum DoLongrange_t {
|
---|
84 | DontSampleDensity=0,
|
---|
85 | DoSampleDensity=1
|
---|
86 | };
|
---|
87 | DoLongrange_t DoLongrange;
|
---|
88 |
|
---|
89 | //!> whether to sample just the valence or the total electron and nuclei density
|
---|
90 | enum DoValenceOnly_t {
|
---|
91 | DontSampleValenceOnly=0,
|
---|
92 | DoSampleValenceOnly=1
|
---|
93 | };
|
---|
94 | DoValenceOnly_t DoValenceOnly;
|
---|
95 |
|
---|
96 | /// Density
|
---|
97 | SamplingGrid sampled_grid;
|
---|
98 |
|
---|
99 | // nuclei positions and charges
|
---|
100 | std::vector< std::vector<double> > positions;
|
---|
101 | std::vector<double> charges;
|
---|
102 |
|
---|
103 | /// Timing structure
|
---|
104 | struct times_t {
|
---|
105 | /** Constructor for struct times_t, sets all to zero.
|
---|
106 | *
|
---|
107 | */
|
---|
108 | times_t();
|
---|
109 |
|
---|
110 | double total_walltime;
|
---|
111 | double total_cputime;
|
---|
112 | double total_flops;
|
---|
113 | double gather_walltime;
|
---|
114 | double gather_cputime;
|
---|
115 | double gather_flops;
|
---|
116 | } times;
|
---|
117 |
|
---|
118 | //!> reached (relative) accuracy
|
---|
119 | double accuracy;
|
---|
120 | //!> desired accuracy
|
---|
121 | double desired_accuracy;
|
---|
122 |
|
---|
123 | private:
|
---|
124 | friend class boost::serialization::access;
|
---|
125 | // serialization
|
---|
126 | template <typename Archive>
|
---|
127 | void serialize(Archive& ar, const unsigned int version)
|
---|
128 | {
|
---|
129 | ar & energies.total;
|
---|
130 | ar & energies.nuclear_repulsion;
|
---|
131 | ar & energies.electron_coulomb;
|
---|
132 | ar & energies.electron_exchange;
|
---|
133 | ar & energies.correlation;
|
---|
134 | ar & energies.overlap;
|
---|
135 | ar & energies.kinetic;
|
---|
136 | ar & energies.hcore;
|
---|
137 | ar & energies.eigenvalues;
|
---|
138 | if (version < 2) {
|
---|
139 | FragmentForces::forces_t justforces(forces);
|
---|
140 | ar & justforces;
|
---|
141 | dynamic_cast<FragmentForces::forces_t &>(forces) = justforces;
|
---|
142 | } else
|
---|
143 | ar & forces;
|
---|
144 | ar & sampled_grid;
|
---|
145 | ar & DoLongrange;
|
---|
146 | if (version > 0)
|
---|
147 | ar & DoValenceOnly;
|
---|
148 | ar & positions;
|
---|
149 | ar & charges;
|
---|
150 | ar & times.total_walltime;
|
---|
151 | ar & times.total_cputime;
|
---|
152 | ar & times.total_flops;
|
---|
153 | ar & times.gather_walltime;
|
---|
154 | ar & times.gather_cputime;
|
---|
155 | ar & times.gather_flops;
|
---|
156 | if (version > 2) {
|
---|
157 | ar & accuracy;
|
---|
158 | ar & desired_accuracy;
|
---|
159 | }
|
---|
160 | }
|
---|
161 | };
|
---|
162 |
|
---|
163 | BOOST_CLASS_VERSION(MPQCData, 3)
|
---|
164 |
|
---|
165 | std::ostream & operator<<(std::ostream &ost, const MPQCData &data);
|
---|
166 |
|
---|
167 | #endif /* MPQCDATA_HPP_ */
|
---|