[cc276e] | 1 | /*
|
---|
[4bc75d] | 2 | * MPQCData.hpp
|
---|
[cc276e] | 3 | *
|
---|
| 4 | * Created on: Feb 08, 2012
|
---|
| 5 | * Author: heber
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[4bc75d] | 8 | #ifndef MPQCDATA_HPP_
|
---|
| 9 | #define MPQCDATA_HPP_
|
---|
[cc276e] | 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 |
|
---|
[509014] | 19 | #include <iosfwd>
|
---|
[cc276e] | 20 | #include <vector>
|
---|
| 21 |
|
---|
| 22 | class MPQCCommandJob;
|
---|
| 23 | class MPQCCommandJobTest;
|
---|
| 24 | class MPQCDataTest;
|
---|
| 25 |
|
---|
| 26 | /** Internal class that holds the data and can be serialized.
|
---|
| 27 | *
|
---|
| 28 | */
|
---|
| 29 | class MPQCData {
|
---|
| 30 | //!> allow MPQCCommandJob access to member variables directly
|
---|
| 31 | friend class MPQCCommandJob;
|
---|
| 32 | //!> grant MPQCCommandJob's unit test access
|
---|
| 33 | friend class MPQCCommandJobTest;
|
---|
| 34 | //!> grant unit test access
|
---|
| 35 | friend class MPQCDataTest;
|
---|
[509014] | 36 | //!> grant access to output stream operator
|
---|
| 37 | friend std::ostream & operator<<(std::ostream &ost, const MPQCData &data);
|
---|
[cc276e] | 38 | public:
|
---|
| 39 | bool operator==(const MPQCData &other) const;
|
---|
| 40 |
|
---|
| 41 | bool operator!=(const MPQCData &other) const {
|
---|
| 42 | return !(*this == other);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
[a9558f] | 45 | /// Energie structure
|
---|
| 46 | struct energy_t {
|
---|
| 47 | /** Constructor for struct energy_t, sets all to zero.
|
---|
| 48 | *
|
---|
| 49 | */
|
---|
| 50 | energy_t();
|
---|
| 51 |
|
---|
| 52 | double total;
|
---|
| 53 | double nuclear_repulsion;
|
---|
[adccae] | 54 | double electron_coulomb;
|
---|
| 55 | double electron_exchange;
|
---|
[a9558f] | 56 | double correlation;
|
---|
| 57 | double overlap;
|
---|
| 58 | double kinetic;
|
---|
| 59 | double hcore;
|
---|
[188639] | 60 |
|
---|
| 61 | std::vector<double> eigenvalues;
|
---|
[a9558f] | 62 | } energies;
|
---|
[cc276e] | 63 |
|
---|
[a9558f] | 64 | /// Forces
|
---|
| 65 | typedef std::vector<double> vector_type;
|
---|
[cc276e] | 66 | std::vector< vector_type > forces;
|
---|
| 67 |
|
---|
[815f60] | 68 | /// Density
|
---|
[d12d621] | 69 | struct density_t {
|
---|
| 70 | //!> Begin (min coordinates) of grid in real space
|
---|
| 71 | double begin[3];
|
---|
| 72 | //!> edge length of cubic(!) domain
|
---|
| 73 | double size;
|
---|
| 74 | //!> level of the grid, hence \f$2^\text{level}\f$
|
---|
| 75 | int level;
|
---|
| 76 |
|
---|
| 77 | //!> typedef for vector of samples grids
|
---|
| 78 | typedef std::vector<double> grid_type;
|
---|
| 79 | //!> vector of sample points in order x, y, z
|
---|
| 80 | grid_type sampled_grid;
|
---|
| 81 | } density;
|
---|
[815f60] | 82 |
|
---|
[a9558f] | 83 | /// Timing structure
|
---|
| 84 | struct times_t {
|
---|
| 85 | /** Constructor for struct times_t, sets all to zero.
|
---|
| 86 | *
|
---|
| 87 | */
|
---|
| 88 | times_t();
|
---|
| 89 |
|
---|
| 90 | double walltime;
|
---|
| 91 | double cputime;
|
---|
| 92 | double flops;
|
---|
| 93 | } times;
|
---|
| 94 |
|
---|
[cc276e] | 95 | private:
|
---|
| 96 | friend class boost::serialization::access;
|
---|
| 97 | // serialization
|
---|
| 98 | template <typename Archive>
|
---|
| 99 | void serialize(Archive& ar, const unsigned int version)
|
---|
| 100 | {
|
---|
[a9558f] | 101 | ar & energies.total;
|
---|
| 102 | ar & energies.nuclear_repulsion;
|
---|
[adccae] | 103 | ar & energies.electron_coulomb;
|
---|
| 104 | ar & energies.electron_exchange;
|
---|
[a9558f] | 105 | ar & energies.correlation;
|
---|
| 106 | ar & energies.overlap;
|
---|
| 107 | ar & energies.kinetic;
|
---|
| 108 | ar & energies.hcore;
|
---|
[188639] | 109 | ar & energies.eigenvalues;
|
---|
[cc276e] | 110 | ar & forces;
|
---|
[d12d621] | 111 | int i;
|
---|
| 112 | for (int i=0; i<3; ++i)
|
---|
| 113 | ar & density.begin[i];
|
---|
| 114 | ar & density.size;
|
---|
| 115 | ar & density.level;
|
---|
| 116 | ar & density.sampled_grid;
|
---|
[a9558f] | 117 | ar & times.walltime;
|
---|
| 118 | ar & times.cputime;
|
---|
| 119 | ar & times.flops;
|
---|
[cc276e] | 120 | }
|
---|
| 121 | };
|
---|
| 122 |
|
---|
[509014] | 123 | std::ostream & operator<<(std::ostream &ost, const MPQCData &data);
|
---|
| 124 |
|
---|
[4bc75d] | 125 | #endif /* MPQCDATA_HPP_ */
|
---|