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