| 1 | /* | 
|---|
| 2 | * config.hpp | 
|---|
| 3 | * | 
|---|
| 4 | *  Created on: Aug 3, 2009 | 
|---|
| 5 | *      Author: heber | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef CONFIG_HPP_ | 
|---|
| 9 | #define CONFIG_HPP_ | 
|---|
| 10 |  | 
|---|
| 11 | using namespace std; | 
|---|
| 12 |  | 
|---|
| 13 | /*********************************************** includes ***********************************/ | 
|---|
| 14 |  | 
|---|
| 15 | // include config.h | 
|---|
| 16 | #ifdef HAVE_CONFIG_H | 
|---|
| 17 | #include <config.h> | 
|---|
| 18 | #endif | 
|---|
| 19 |  | 
|---|
| 20 | #include <string> | 
|---|
| 21 |  | 
|---|
| 22 | /****************************************** forward declarations *****************************/ | 
|---|
| 23 |  | 
|---|
| 24 | class molecule; | 
|---|
| 25 | class periodentafel; | 
|---|
| 26 |  | 
|---|
| 27 | /********************************************** declarations *******************************/ | 
|---|
| 28 |  | 
|---|
| 29 | class ConfigFileBuffer { | 
|---|
| 30 | public: | 
|---|
| 31 | char **buffer; | 
|---|
| 32 | int *LineMapping; | 
|---|
| 33 | int CurrentLine; | 
|---|
| 34 | int NoLines; | 
|---|
| 35 |  | 
|---|
| 36 | ConfigFileBuffer(); | 
|---|
| 37 | ConfigFileBuffer(char *filename); | 
|---|
| 38 | ~ConfigFileBuffer(); | 
|---|
| 39 |  | 
|---|
| 40 | void InitMapping(); | 
|---|
| 41 | void MapIonTypesInBuffer(int NoAtoms); | 
|---|
| 42 | }; | 
|---|
| 43 |  | 
|---|
| 44 | /** The config file. | 
|---|
| 45 | * The class contains all parameters that control a dft run also functions to load and save. | 
|---|
| 46 | */ | 
|---|
| 47 | class config { | 
|---|
| 48 | public: | 
|---|
| 49 | int PsiType; | 
|---|
| 50 | int MaxPsiDouble; | 
|---|
| 51 | int PsiMaxNoUp; | 
|---|
| 52 | int PsiMaxNoDown; | 
|---|
| 53 | int MaxMinStopStep; | 
|---|
| 54 | int InitMaxMinStopStep; | 
|---|
| 55 | int ProcPEGamma; | 
|---|
| 56 | int ProcPEPsi; | 
|---|
| 57 | char *configpath; | 
|---|
| 58 | char *configname; | 
|---|
| 59 | bool FastParsing; | 
|---|
| 60 | double Deltat; | 
|---|
| 61 | string basis; | 
|---|
| 62 |  | 
|---|
| 63 | char *databasepath; | 
|---|
| 64 |  | 
|---|
| 65 | int DoConstrainedMD; | 
|---|
| 66 | int MaxOuterStep; | 
|---|
| 67 | int Thermostat; | 
|---|
| 68 | int *ThermostatImplemented; | 
|---|
| 69 | char **ThermostatNames; | 
|---|
| 70 | double TempFrequency; | 
|---|
| 71 | double alpha; | 
|---|
| 72 | double HooverMass; | 
|---|
| 73 | double TargetTemp; | 
|---|
| 74 | int ScaleTempStep; | 
|---|
| 75 |  | 
|---|
| 76 | private: | 
|---|
| 77 | char *mainname; | 
|---|
| 78 | char *defaultpath; | 
|---|
| 79 | char *pseudopotpath; | 
|---|
| 80 |  | 
|---|
| 81 | int DoOutVis; | 
|---|
| 82 | int DoOutMes; | 
|---|
| 83 | int DoOutNICS; | 
|---|
| 84 | int DoOutOrbitals; | 
|---|
| 85 | int DoOutCurrent; | 
|---|
| 86 | int DoFullCurrent; | 
|---|
| 87 | int DoPerturbation; | 
|---|
| 88 | int DoWannier; | 
|---|
| 89 | int CommonWannier; | 
|---|
| 90 | double SawtoothStart; | 
|---|
| 91 | int VectorPlane; | 
|---|
| 92 | double VectorCut; | 
|---|
| 93 | int UseAddGramSch; | 
|---|
| 94 | int Seed; | 
|---|
| 95 |  | 
|---|
| 96 | int OutVisStep; | 
|---|
| 97 | int OutSrcStep; | 
|---|
| 98 | int MaxPsiStep; | 
|---|
| 99 | double EpsWannier; | 
|---|
| 100 |  | 
|---|
| 101 | int MaxMinStep; | 
|---|
| 102 | double RelEpsTotalEnergy; | 
|---|
| 103 | double RelEpsKineticEnergy; | 
|---|
| 104 | int MaxMinGapStopStep; | 
|---|
| 105 | int MaxInitMinStep; | 
|---|
| 106 | double InitRelEpsTotalEnergy; | 
|---|
| 107 | double InitRelEpsKineticEnergy; | 
|---|
| 108 | int InitMaxMinGapStopStep; | 
|---|
| 109 |  | 
|---|
| 110 | //double BoxLength[NDIM*NDIM]; | 
|---|
| 111 |  | 
|---|
| 112 | double ECut; | 
|---|
| 113 | int MaxLevel; | 
|---|
| 114 | int RiemannTensor; | 
|---|
| 115 | int LevRFactor; | 
|---|
| 116 | int RiemannLevel; | 
|---|
| 117 | int Lev0Factor; | 
|---|
| 118 | int RTActualUse; | 
|---|
| 119 | int AddPsis; | 
|---|
| 120 |  | 
|---|
| 121 | double RCut; | 
|---|
| 122 | int StructOpt; | 
|---|
| 123 | int IsAngstroem; | 
|---|
| 124 | int RelativeCoord; | 
|---|
| 125 | int MaxTypes; | 
|---|
| 126 |  | 
|---|
| 127 |  | 
|---|
| 128 | public: | 
|---|
| 129 | config(); | 
|---|
| 130 | ~config(); | 
|---|
| 131 |  | 
|---|
| 132 | int TestSyntax(char *filename, periodentafel *periode, molecule *mol); | 
|---|
| 133 | void Load(char *filename, periodentafel *periode, molecule *mol); | 
|---|
| 134 | void LoadOld(char *filename, periodentafel *periode, molecule *mol); | 
|---|
| 135 | void RetrieveConfigPathAndName(string filename); | 
|---|
| 136 | bool Save(const char *filename, periodentafel *periode, molecule *mol) const; | 
|---|
| 137 | bool SaveMPQC(const char *filename, molecule *mol) const; | 
|---|
| 138 | void Edit(); | 
|---|
| 139 | bool GetIsAngstroem() const; | 
|---|
| 140 | char *GetDefaultPath() const; | 
|---|
| 141 | void SetDefaultPath(const char *path); | 
|---|
| 142 | void InitThermostats(class ConfigFileBuffer *fb); | 
|---|
| 143 | }; | 
|---|
| 144 |  | 
|---|
| 145 | int ParseForParameter(int verbose, ifstream *file, const char *name, int sequential, int const xth, int const yth, int type, void *value, int repetition, int critical); | 
|---|
| 146 | int ParseForParameter(int verbose, struct ConfigFileBuffer *FileBuffer, const char *name, int sequential, int const xth, int const yth, int type, void *value, int repetition, int critical); | 
|---|
| 147 | void LoadMolecule(molecule *&mol, struct ConfigFileBuffer *&FileBuffer, periodentafel *periode, bool FastParsing); | 
|---|
| 148 | void PrepareFileBuffer(char *filename, struct ConfigFileBuffer *&FileBuffer); | 
|---|
| 149 |  | 
|---|
| 150 | #endif /* CONFIG_HPP_ */ | 
|---|