[14de469] | 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 |
|
---|
[6dea43] | 11 | using namespace std;
|
---|
| 12 |
|
---|
| 13 | // include config.h
|
---|
| 14 | #ifdef HAVE_CONFIG_H
|
---|
| 15 | #include <config.h>
|
---|
| 16 | #endif
|
---|
| 17 |
|
---|
[14de469] | 18 | // ======================================= DEFINES ==========================================
|
---|
| 19 |
|
---|
| 20 | #define EnergySuffix ".energy.all"
|
---|
[85d278] | 21 | #define EnergyFragmentSuffix ".energyfragment.all"
|
---|
[14de469] | 22 | #define ForcesSuffix ".forces.all"
|
---|
[85d278] | 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"
|
---|
[68cb0f] | 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"
|
---|
[14de469] | 33 | #define TimeSuffix ".speed"
|
---|
| 34 |
|
---|
| 35 | // ======================================= FUNCTIONS ==========================================
|
---|
| 36 |
|
---|
[68cb0f] | 37 | bool FilePresent(const char *filename, bool test);
|
---|
[14de469] | 38 | bool TestParams(int argc, char **argv);
|
---|
| 39 |
|
---|
[6dea43] | 40 |
|
---|
[14de469] | 41 | // ======================================= CLASS MatrixContainer =============================
|
---|
| 42 |
|
---|
| 43 | class MatrixContainer {
|
---|
| 44 | public:
|
---|
| 45 | double ***Matrix;
|
---|
| 46 | int **Indices;
|
---|
[eeec8f] | 47 | char **Header;
|
---|
[14de469] | 48 | int MatrixCounter;
|
---|
| 49 | int *RowCounter;
|
---|
[f731ae] | 50 | int *ColumnCounter;
|
---|
[14de469] | 51 |
|
---|
| 52 | MatrixContainer();
|
---|
| 53 | ~MatrixContainer();
|
---|
| 54 |
|
---|
[f731ae] | 55 | bool InitialiseIndices(class MatrixContainer *Matrix = NULL);
|
---|
[8f019c] | 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);
|
---|
[eeec8f] | 58 | bool AllocateMatrix(char **GivenHeader, int MCounter, int *RCounter, int *CCounter);
|
---|
[14de469] | 59 | bool ResetMatrix();
|
---|
[390248] | 60 | double FindMinValue();
|
---|
| 61 | double FindMaxValue();
|
---|
[14de469] | 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:
|
---|
[390248] | 75 | bool SumSubEnergy(class EnergyMatrix &Fragments, class EnergyMatrix *CorrectionFragments, class KeySetsContainer &KeySet, int Order, double sign);
|
---|
[8f019c] | 76 | bool ParseFragmentMatrix(char *name, char *prefix, string suffix, int skiplines, int skipcolumns);
|
---|
[14de469] | 77 | };
|
---|
| 78 |
|
---|
| 79 | // ======================================= CLASS ForceMatrix =============================
|
---|
| 80 |
|
---|
| 81 | class ForceMatrix : public MatrixContainer {
|
---|
| 82 | public:
|
---|
| 83 | bool ParseIndices(char *name);
|
---|
[390248] | 84 | bool SumSubForces(class ForceMatrix &Fragments, class KeySetsContainer &KeySet, int Order, double sign);
|
---|
[8f019c] | 85 | bool ParseFragmentMatrix(char *name, char *prefix, string suffix, int skiplines, int skipcolumns);
|
---|
[14de469] | 86 | };
|
---|
| 87 |
|
---|
[85d278] | 88 | // ======================================= CLASS HessianMatrix =============================
|
---|
| 89 |
|
---|
[eeec8f] | 90 | class HessianMatrix : public MatrixContainer {
|
---|
[85d278] | 91 | public:
|
---|
[eeec8f] | 92 | HessianMatrix();
|
---|
| 93 | //~HessianMatrix();
|
---|
[85d278] | 94 | bool ParseIndices(char *name);
|
---|
[eeec8f] | 95 | bool SumSubManyBodyTerms(class MatrixContainer &MatrixValues, class KeySetsContainer &KeySet, int Order);
|
---|
[85d278] | 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);
|
---|
[eeec8f] | 98 | private:
|
---|
| 99 | bool IsSymmetric;
|
---|
[85d278] | 100 | };
|
---|
| 101 |
|
---|
[14de469] | 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();
|
---|
[6097ea] | 118 | bool Contains(const int GreaterSet, const int SmallerSet);
|
---|
[14de469] | 119 | };
|
---|
| 120 |
|
---|
| 121 | // ======================================= END =============================================
|
---|
| 122 |
|
---|
| 123 | #endif /*PARSING_HPP_*/
|
---|