| 1 | /* | 
|---|
| 2 | * PcpParser.hpp | 
|---|
| 3 | * | 
|---|
| 4 | *  Created on: 12.06.2010 | 
|---|
| 5 | *      Author: heber | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef PCPPARSER_HPP_ | 
|---|
| 9 | #define PCPPARSER_HPP_ | 
|---|
| 10 |  | 
|---|
| 11 | // include config.h | 
|---|
| 12 | #ifdef HAVE_CONFIG_H | 
|---|
| 13 | #include <config.h> | 
|---|
| 14 | #endif | 
|---|
| 15 |  | 
|---|
| 16 | #include <iosfwd> | 
|---|
| 17 | #include <map> | 
|---|
| 18 | #include <string> | 
|---|
| 19 | #include <vector> | 
|---|
| 20 |  | 
|---|
| 21 | #include "FormatParser.hpp" | 
|---|
| 22 | #include "FormatParserTrait.hpp" | 
|---|
| 23 | #include "FormatParserInterface.hpp" | 
|---|
| 24 | #include "FormatParser_common.hpp" | 
|---|
| 25 | #include "ParserTypes.hpp" | 
|---|
| 26 |  | 
|---|
| 27 | class atom; | 
|---|
| 28 |  | 
|---|
| 29 | // declaration of specialized FormatParserTrait | 
|---|
| 30 | template<> | 
|---|
| 31 | struct FormatParserTrait<pcp> | 
|---|
| 32 | { | 
|---|
| 33 | //!> Name of the parser | 
|---|
| 34 | static const std::string name; | 
|---|
| 35 | //!> suffix of the files the parser understands to read and write | 
|---|
| 36 | static const std::string suffix; | 
|---|
| 37 | //!> ParserTypes enumeration for the parser | 
|---|
| 38 | static const enum ParserTypes type; | 
|---|
| 39 | }; | 
|---|
| 40 |  | 
|---|
| 41 | /** | 
|---|
| 42 | * Parser for PCP config files. | 
|---|
| 43 | */ | 
|---|
| 44 | template <> | 
|---|
| 45 | class FormatParser< pcp >  : virtual public FormatParserInterface, public FormatParser_common | 
|---|
| 46 | { | 
|---|
| 47 | public: | 
|---|
| 48 | FormatParser(); | 
|---|
| 49 | virtual ~FormatParser(); | 
|---|
| 50 | void load(std::istream* file); | 
|---|
| 51 | void save(std::ostream* file, const std::vector<const atom *> &atoms); | 
|---|
| 52 |  | 
|---|
| 53 | bool operator==(const FormatParser< pcp >& b) const; | 
|---|
| 54 |  | 
|---|
| 55 | private: | 
|---|
| 56 |  | 
|---|
| 57 | void ParseThermostats(class ConfigFileBuffer * const fb); | 
|---|
| 58 | void OutputAtoms( | 
|---|
| 59 | std::ostream *file, | 
|---|
| 60 | const std::vector<const atom *> &allatoms, | 
|---|
| 61 | std::map<int, int> &ZtoIndexMap); | 
|---|
| 62 | void OutputElements( | 
|---|
| 63 | std::ostream *file, | 
|---|
| 64 | const std::vector<const atom *> &allatoms, | 
|---|
| 65 | std::map<int, int> &ZtoIndexMap); | 
|---|
| 66 | void CalculateOrbitals( | 
|---|
| 67 | const std::vector<const atom *> &allatoms); | 
|---|
| 68 |  | 
|---|
| 69 | class StructParallelization { | 
|---|
| 70 | public: | 
|---|
| 71 | StructParallelization(); | 
|---|
| 72 | ~StructParallelization(); | 
|---|
| 73 |  | 
|---|
| 74 | int ProcPEGamma; | 
|---|
| 75 | int ProcPEPsi; | 
|---|
| 76 | } Parallelization; | 
|---|
| 77 |  | 
|---|
| 78 | /* | 
|---|
| 79 | * Contains all the paths and names | 
|---|
| 80 | */ | 
|---|
| 81 | class StructPaths { | 
|---|
| 82 | public: | 
|---|
| 83 | StructPaths(); | 
|---|
| 84 | ~StructPaths(); | 
|---|
| 85 |  | 
|---|
| 86 | char *databasepath; | 
|---|
| 87 | char *configname; | 
|---|
| 88 | char *mainname; | 
|---|
| 89 | char *defaultpath; | 
|---|
| 90 | char *pseudopotpath; | 
|---|
| 91 | } Paths; | 
|---|
| 92 |  | 
|---|
| 93 | /* | 
|---|
| 94 | * Contains all Do/Don't switches | 
|---|
| 95 | */ | 
|---|
| 96 | class StructSwitches { | 
|---|
| 97 | public: | 
|---|
| 98 | StructSwitches(); | 
|---|
| 99 | ~StructSwitches(); | 
|---|
| 100 |  | 
|---|
| 101 | int DoConstrainedMD; | 
|---|
| 102 | int DoOutVis; | 
|---|
| 103 | int DoOutMes; | 
|---|
| 104 | int DoOutNICS; | 
|---|
| 105 | int DoOutOrbitals; | 
|---|
| 106 | int DoOutCurrent; | 
|---|
| 107 | int DoFullCurrent; | 
|---|
| 108 | int DoPerturbation; | 
|---|
| 109 | int DoWannier; | 
|---|
| 110 | } Switches; | 
|---|
| 111 |  | 
|---|
| 112 | /* | 
|---|
| 113 | * Contains parameters regarding localization of orbitals or magnetic perturbation | 
|---|
| 114 | */ | 
|---|
| 115 | class StructLocalizedOrbitals { | 
|---|
| 116 | public: | 
|---|
| 117 | StructLocalizedOrbitals(); | 
|---|
| 118 | ~StructLocalizedOrbitals(); | 
|---|
| 119 |  | 
|---|
| 120 | int CommonWannier; | 
|---|
| 121 | double SawtoothStart; | 
|---|
| 122 | int VectorPlane; | 
|---|
| 123 | double VectorCut; | 
|---|
| 124 | int UseAddGramSch; | 
|---|
| 125 | int Seed; | 
|---|
| 126 | double EpsWannier; | 
|---|
| 127 | } LocalizedOrbitals; | 
|---|
| 128 |  | 
|---|
| 129 | /* | 
|---|
| 130 | * Contains all step count and other epsilon threshold parameters | 
|---|
| 131 | */ | 
|---|
| 132 | class StructStepCounts { | 
|---|
| 133 | public: | 
|---|
| 134 | StructStepCounts(); | 
|---|
| 135 | ~StructStepCounts(); | 
|---|
| 136 |  | 
|---|
| 137 | int MaxMinStopStep; | 
|---|
| 138 | int InitMaxMinStopStep; | 
|---|
| 139 |  | 
|---|
| 140 | int OutVisStep; | 
|---|
| 141 | int OutSrcStep; | 
|---|
| 142 | int MaxPsiStep; | 
|---|
| 143 |  | 
|---|
| 144 | int MaxOuterStep; | 
|---|
| 145 |  | 
|---|
| 146 | int MaxMinStep; | 
|---|
| 147 | double RelEpsTotalEnergy; | 
|---|
| 148 | double RelEpsKineticEnergy; | 
|---|
| 149 | int MaxMinGapStopStep; | 
|---|
| 150 | int MaxInitMinStep; | 
|---|
| 151 | double InitRelEpsTotalEnergy; | 
|---|
| 152 | double InitRelEpsKineticEnergy; | 
|---|
| 153 | int InitMaxMinGapStopStep; | 
|---|
| 154 | } StepCounts; | 
|---|
| 155 |  | 
|---|
| 156 | /* | 
|---|
| 157 | * Contains all parameters specific to the plane wave basis set | 
|---|
| 158 | */ | 
|---|
| 159 | class StructPlaneWaveSpecifics { | 
|---|
| 160 | public: | 
|---|
| 161 | StructPlaneWaveSpecifics(); | 
|---|
| 162 | ~StructPlaneWaveSpecifics(); | 
|---|
| 163 |  | 
|---|
| 164 | int PsiType; | 
|---|
| 165 | int MaxPsiDouble; | 
|---|
| 166 | int PsiMaxNoUp; | 
|---|
| 167 | int PsiMaxNoDown; | 
|---|
| 168 | double ECut; | 
|---|
| 169 | int MaxLevel; | 
|---|
| 170 | int RiemannTensor; | 
|---|
| 171 | int LevRFactor; | 
|---|
| 172 | int RiemannLevel; | 
|---|
| 173 | int Lev0Factor; | 
|---|
| 174 | int RTActualUse; | 
|---|
| 175 | int AddPsis; | 
|---|
| 176 | double RCut; | 
|---|
| 177 | } PlaneWaveSpecifics; | 
|---|
| 178 |  | 
|---|
| 179 | bool FastParsing; | 
|---|
| 180 |  | 
|---|
| 181 | double Deltat; | 
|---|
| 182 | int IsAngstroem; | 
|---|
| 183 | int RelativeCoord; | 
|---|
| 184 | int StructOpt; | 
|---|
| 185 | int MaxTypes; | 
|---|
| 186 | std::string basis; | 
|---|
| 187 | }; | 
|---|
| 188 |  | 
|---|
| 189 | #endif /* PCPPARSER_HPP_ */ | 
|---|