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