1 | /** \file parsing.hpp
|
---|
2 | *
|
---|
3 | * Definitions of various class functions for the parsing of value files.
|
---|
4 | *
|
---|
5 | */
|
---|
6 |
|
---|
7 |
|
---|
8 | #ifndef PARSING_HPP_
|
---|
9 | #define PARSING_HPP_
|
---|
10 |
|
---|
11 | using namespace std;
|
---|
12 |
|
---|
13 | // include config.h
|
---|
14 | #ifdef HAVE_CONFIG_H
|
---|
15 | #include <config.h>
|
---|
16 | #endif
|
---|
17 |
|
---|
18 | // ======================================= DEFINES ==========================================
|
---|
19 |
|
---|
20 | #define EnergySuffix ".energy.all"
|
---|
21 | #define EnergyFragmentSuffix ".energyfragment.all"
|
---|
22 | #define ForcesSuffix ".forces.all"
|
---|
23 | #define ForceFragmentSuffix ".forcefragment.all"
|
---|
24 | #define HcorrectionSuffix ".Hcorrection.all"
|
---|
25 | #define HcorrectionFragmentSuffix ".Hcorrectionfragment.all"
|
---|
26 | #define HessianSuffix ".hessian_xx.all"
|
---|
27 | #define HessianFragmentSuffix ".hessianfragment_xx.all"
|
---|
28 | #define OrderSuffix ".Order"
|
---|
29 | #define ShieldingSuffix ".sigma_all.csv"
|
---|
30 | #define ShieldingPASSuffix ".sigma_all_PAS.csv"
|
---|
31 | #define ShieldingFragmentSuffix ".sigma_all_fragment.all"
|
---|
32 | #define ShieldingPASFragmentSuffix ".sigma_all_PAS_fragment.all"
|
---|
33 | #define TimeSuffix ".speed"
|
---|
34 |
|
---|
35 | // ======================================= FUNCTIONS ==========================================
|
---|
36 |
|
---|
37 | bool FilePresent(const char *filename, bool test);
|
---|
38 | bool TestParams(int argc, char **argv);
|
---|
39 |
|
---|
40 |
|
---|
41 | // ======================================= CLASS MatrixContainer =============================
|
---|
42 |
|
---|
43 | class MatrixContainer {
|
---|
44 | public:
|
---|
45 | double ***Matrix;
|
---|
46 | int **Indices;
|
---|
47 | char **Header;
|
---|
48 | int MatrixCounter;
|
---|
49 | int *RowCounter;
|
---|
50 | int *ColumnCounter;
|
---|
51 |
|
---|
52 | MatrixContainer();
|
---|
53 | ~MatrixContainer();
|
---|
54 |
|
---|
55 | bool InitialiseIndices(class MatrixContainer *Matrix = NULL);
|
---|
56 | bool ParseMatrix(const char *name, int skiplines, int skipcolumns, int MatrixNr);
|
---|
57 | virtual bool ParseFragmentMatrix(char *name, char *prefix, string suffix, int skiplines, int skipcolumns);
|
---|
58 | bool AllocateMatrix(char **GivenHeader, int MCounter, int *RCounter, int *CCounter);
|
---|
59 | bool ResetMatrix();
|
---|
60 | double FindMinValue();
|
---|
61 | double FindMaxValue();
|
---|
62 | bool SetLastMatrix(double value, int skipcolumns);
|
---|
63 | bool SetLastMatrix(double **values, int skipcolumns);
|
---|
64 | //bool ParseIndices();
|
---|
65 | //bool SumSubValues();
|
---|
66 | bool SumSubManyBodyTerms(class MatrixContainer &Matrix, class KeySetsContainer &KeySet, int Order);
|
---|
67 | bool WriteTotalFragments(const char *name, const char *prefix);
|
---|
68 | bool WriteLastMatrix(const char *name, const char *prefix, const char *suffix);
|
---|
69 | };
|
---|
70 |
|
---|
71 | // ======================================= CLASS EnergyMatrix =============================
|
---|
72 |
|
---|
73 | class EnergyMatrix : public MatrixContainer {
|
---|
74 | public:
|
---|
75 | bool SumSubEnergy(class EnergyMatrix &Fragments, class EnergyMatrix *CorrectionFragments, class KeySetsContainer &KeySet, int Order, double sign);
|
---|
76 | bool ParseFragmentMatrix(char *name, char *prefix, string suffix, int skiplines, int skipcolumns);
|
---|
77 | };
|
---|
78 |
|
---|
79 | // ======================================= CLASS ForceMatrix =============================
|
---|
80 |
|
---|
81 | class ForceMatrix : public MatrixContainer {
|
---|
82 | public:
|
---|
83 | bool ParseIndices(char *name);
|
---|
84 | bool SumSubForces(class ForceMatrix &Fragments, class KeySetsContainer &KeySet, int Order, double sign);
|
---|
85 | bool ParseFragmentMatrix(char *name, char *prefix, string suffix, int skiplines, int skipcolumns);
|
---|
86 | };
|
---|
87 |
|
---|
88 | // ======================================= CLASS HessianMatrix =============================
|
---|
89 |
|
---|
90 | class HessianMatrix : public MatrixContainer {
|
---|
91 | public:
|
---|
92 | HessianMatrix();
|
---|
93 | //~HessianMatrix();
|
---|
94 | bool ParseIndices(char *name);
|
---|
95 | bool SumSubManyBodyTerms(class MatrixContainer &MatrixValues, class KeySetsContainer &KeySet, int Order);
|
---|
96 | bool SumSubHessians(class HessianMatrix &Fragments, class KeySetsContainer &KeySet, int Order, double sign);
|
---|
97 | bool ParseFragmentMatrix(char *name, char *prefix, string suffix, int skiplines, int skipcolumns);
|
---|
98 | private:
|
---|
99 | bool IsSymmetric;
|
---|
100 | };
|
---|
101 |
|
---|
102 | // ======================================= CLASS KeySetsContainer =============================
|
---|
103 |
|
---|
104 | class KeySetsContainer {
|
---|
105 | public:
|
---|
106 | int **KeySets;
|
---|
107 | int *AtomCounter;
|
---|
108 | int FragmentCounter;
|
---|
109 | int Order;
|
---|
110 | int *FragmentsPerOrder;
|
---|
111 | int **OrderSet;
|
---|
112 |
|
---|
113 | KeySetsContainer();
|
---|
114 | ~KeySetsContainer();
|
---|
115 |
|
---|
116 | bool ParseKeySets(const char *name, const int *ACounter, const int FCounter);
|
---|
117 | bool ParseManyBodyTerms();
|
---|
118 | bool Contains(const int GreaterSet, const int SmallerSet);
|
---|
119 | };
|
---|
120 |
|
---|
121 | // ======================================= END =============================================
|
---|
122 |
|
---|
123 | #endif /*PARSING_HPP_*/
|
---|