source: src/Fragmentation/Summation/Containers/MPQCData.hpp@ fba720

Candidate_v1.6.1 ChemicalSpaceEvaluator TremoloParser_IncreasedPrecision
Last change on this file since fba720 was 6829d2, checked in by Frederik Heber <heber@…>, 8 years ago

MPQCData additionally stores the atomic number per nuclei.

  • in case of DoSampleValenceOnly the charge does not represent the atomic number and moreover it is no longer unique. However, we need this unique association for fitting potentials to the fragment results.
  • TESTFIX: set all tests to XFAIL that parse either fragmentation results or homologies.
  • TESTFIX: needed to adapt HomologyContainerUnitTest which uses FragmentStub.
  • TESTFIX: needed to adapt FragmentUnitTest.
  • Property mode set to 100644
File size: 4.4 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, atomic numbers and charges
113 std::vector< std::vector<double> > positions;
114 std::vector< unsigned int > atomicnumbers;
115 std::vector<double> charges;
116
117 /// Timing structure
118 struct times_t {
119 /** Constructor for struct times_t, sets all to zero.
120 *
121 */
122 times_t();
123
124 double total_walltime;
125 double total_cputime;
126 double total_flops;
127 double gather_walltime;
128 double gather_cputime;
129 double gather_flops;
130 } times;
131
132 //!> reached (relative) accuracy
133 double accuracy;
134 //!> desired accuracy
135 double desired_accuracy;
136
137private:
138 friend class boost::serialization::access;
139 // serialization
140 template <typename Archive>
141 void serialize(Archive& ar, const unsigned int version)
142 {
143 ar & energies.total;
144 ar & energies.nuclear_repulsion;
145 ar & energies.electron_coulomb;
146 ar & energies.electron_exchange;
147 ar & energies.correlation;
148 ar & energies.overlap;
149 ar & energies.kinetic;
150 ar & energies.hcore;
151 ar & energies.eigenvalues;
152 if (version < 2) {
153 FragmentForces::forces_t justforces(forces);
154 ar & justforces;
155 dynamic_cast<FragmentForces::forces_t &>(forces) = justforces;
156 } else
157 ar & forces;
158 ar & sampled_grid;
159 ar & DoLongrange;
160 if (version > 0)
161 ar & DoValenceOnly;
162 ar & positions;
163 ar & charges;
164 if (version > 3)
165 ar & atomicnumbers;
166 ar & times.total_walltime;
167 ar & times.total_cputime;
168 ar & times.total_flops;
169 ar & times.gather_walltime;
170 ar & times.gather_cputime;
171 ar & times.gather_flops;
172 if (version > 2) {
173 ar & accuracy;
174 ar & desired_accuracy;
175 }
176 }
177};
178
179BOOST_CLASS_VERSION(MPQCData, 4)
180
181std::ostream & operator<<(std::ostream &ost, const MPQCData &data);
182
183#endif /* MPQCDATA_HPP_ */
Note: See TracBrowser for help on using the repository browser.