source: molecuilder/src/parser.hpp@ 09f4dc

Last change on this file since 09f4dc was 09f4dc, checked in by Frederik Heber <heber@…>, 16 years ago

Merge branch 'HessianMatrix'

  • Property mode set to 100755
File size: 4.4 KB
Line 
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
11using 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 ChiSuffix ".chi_all.csv"
34#define ChiPASSuffix ".chi_all_PAS.csv"
35#define ChiFragmentSuffix ".chi_all_fragment.all"
36#define ChiPASFragmentSuffix ".chi_all_PAS_fragment.all"
37#define TimeSuffix ".speed"
38
39// ======================================= FUNCTIONS ==========================================
40
41bool FilePresent(const char *filename, bool test);
42bool TestParams(int argc, char **argv);
43
44
45// ======================================= CLASS MatrixContainer =============================
46
47class MatrixContainer {
48 public:
49 double ***Matrix;
50 int **Indices;
51 char **Header;
52 int MatrixCounter;
53 int *RowCounter;
54 int *ColumnCounter;
55
56 MatrixContainer();
57 ~MatrixContainer();
58
59 bool InitialiseIndices(class MatrixContainer *Matrix = NULL);
60 bool ParseMatrix(const char *name, int skiplines, int skipcolumns, int MatrixNr);
61 virtual bool ParseFragmentMatrix(char *name, char *prefix, string suffix, int skiplines, int skipcolumns);
62 bool AllocateMatrix(char **GivenHeader, int MCounter, int *RCounter, int *CCounter);
63 bool ResetMatrix();
64 double FindMinValue();
65 double FindMaxValue();
66 bool SetLastMatrix(double value, int skipcolumns);
67 bool SetLastMatrix(double **values, int skipcolumns);
68 //bool ParseIndices();
69 //bool SumSubValues();
70 bool SumSubManyBodyTerms(class MatrixContainer &Matrix, class KeySetsContainer &KeySet, int Order);
71 bool WriteTotalFragments(const char *name, const char *prefix);
72 bool WriteLastMatrix(const char *name, const char *prefix, const char *suffix);
73};
74
75// ======================================= CLASS EnergyMatrix =============================
76
77class EnergyMatrix : public MatrixContainer {
78 public:
79 bool SumSubEnergy(class EnergyMatrix &Fragments, class EnergyMatrix *CorrectionFragments, class KeySetsContainer &KeySet, int Order, double sign);
80 bool ParseFragmentMatrix(char *name, char *prefix, string suffix, int skiplines, int skipcolumns);
81};
82
83// ======================================= CLASS ForceMatrix =============================
84
85class ForceMatrix : public MatrixContainer {
86 public:
87 bool ParseIndices(char *name);
88 bool SumSubForces(class ForceMatrix &Fragments, class KeySetsContainer &KeySet, int Order, double sign);
89 bool ParseFragmentMatrix(char *name, char *prefix, string suffix, int skiplines, int skipcolumns);
90};
91
92// ======================================= CLASS HessianMatrix =============================
93
94class HessianMatrix : public MatrixContainer {
95 public:
96 HessianMatrix();
97 //~HessianMatrix();
98 bool ParseIndices(char *name);
99 bool SumSubManyBodyTerms(class MatrixContainer &MatrixValues, class KeySetsContainer &KeySet, int Order);
100 bool SumSubHessians(class HessianMatrix &Fragments, class KeySetsContainer &KeySet, int Order, double sign);
101 bool ParseFragmentMatrix(char *name, char *prefix, string suffix, int skiplines, int skipcolumns);
102 private:
103 bool IsSymmetric;
104};
105
106// ======================================= CLASS KeySetsContainer =============================
107
108class KeySetsContainer {
109 public:
110 int **KeySets;
111 int *AtomCounter;
112 int FragmentCounter;
113 int Order;
114 int *FragmentsPerOrder;
115 int **OrderSet;
116
117 KeySetsContainer();
118 ~KeySetsContainer();
119
120 bool ParseKeySets(const char *name, const int *ACounter, const int FCounter);
121 bool ParseManyBodyTerms();
122 bool Contains(const int GreaterSet, const int SmallerSet);
123};
124
125// ======================================= END =============================================
126
127#endif /*PARSING_HPP_*/
Note: See TracBrowser for help on using the repository browser.