| 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<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(std::ostream *file, const std::vector<atom *> &allatoms, std::map<int, int> &ZtoIndexMap); | 
|---|
| 59 | void OutputElements(std::ostream *file, const std::vector<atom *> &allatoms, std::map<int, int> &ZtoIndexMap); | 
|---|
| 60 | void CalculateOrbitals(const std::vector<atom *> &allatoms); | 
|---|
| 61 |  | 
|---|
| 62 | class StructParallelization { | 
|---|
| 63 | public: | 
|---|
| 64 | StructParallelization(); | 
|---|
| 65 | ~StructParallelization(); | 
|---|
| 66 |  | 
|---|
| 67 | int ProcPEGamma; | 
|---|
| 68 | int ProcPEPsi; | 
|---|
| 69 | } Parallelization; | 
|---|
| 70 |  | 
|---|
| 71 | /* | 
|---|
| 72 | * Contains all the paths and names | 
|---|
| 73 | */ | 
|---|
| 74 | class StructPaths { | 
|---|
| 75 | public: | 
|---|
| 76 | StructPaths(); | 
|---|
| 77 | ~StructPaths(); | 
|---|
| 78 |  | 
|---|
| 79 | char *databasepath; | 
|---|
| 80 | char *configname; | 
|---|
| 81 | char *mainname; | 
|---|
| 82 | char *defaultpath; | 
|---|
| 83 | char *pseudopotpath; | 
|---|
| 84 | } Paths; | 
|---|
| 85 |  | 
|---|
| 86 | /* | 
|---|
| 87 | * Contains all Do/Don't switches | 
|---|
| 88 | */ | 
|---|
| 89 | class StructSwitches { | 
|---|
| 90 | public: | 
|---|
| 91 | StructSwitches(); | 
|---|
| 92 | ~StructSwitches(); | 
|---|
| 93 |  | 
|---|
| 94 | int DoConstrainedMD; | 
|---|
| 95 | int DoOutVis; | 
|---|
| 96 | int DoOutMes; | 
|---|
| 97 | int DoOutNICS; | 
|---|
| 98 | int DoOutOrbitals; | 
|---|
| 99 | int DoOutCurrent; | 
|---|
| 100 | int DoFullCurrent; | 
|---|
| 101 | int DoPerturbation; | 
|---|
| 102 | int DoWannier; | 
|---|
| 103 | } Switches; | 
|---|
| 104 |  | 
|---|
| 105 | /* | 
|---|
| 106 | * Contains parameters regarding localization of orbitals or magnetic perturbation | 
|---|
| 107 | */ | 
|---|
| 108 | class StructLocalizedOrbitals { | 
|---|
| 109 | public: | 
|---|
| 110 | StructLocalizedOrbitals(); | 
|---|
| 111 | ~StructLocalizedOrbitals(); | 
|---|
| 112 |  | 
|---|
| 113 | int CommonWannier; | 
|---|
| 114 | double SawtoothStart; | 
|---|
| 115 | int VectorPlane; | 
|---|
| 116 | double VectorCut; | 
|---|
| 117 | int UseAddGramSch; | 
|---|
| 118 | int Seed; | 
|---|
| 119 | double EpsWannier; | 
|---|
| 120 | } LocalizedOrbitals; | 
|---|
| 121 |  | 
|---|
| 122 | /* | 
|---|
| 123 | * Contains all step count and other epsilon threshold parameters | 
|---|
| 124 | */ | 
|---|
| 125 | class StructStepCounts { | 
|---|
| 126 | public: | 
|---|
| 127 | StructStepCounts(); | 
|---|
| 128 | ~StructStepCounts(); | 
|---|
| 129 |  | 
|---|
| 130 | int MaxMinStopStep; | 
|---|
| 131 | int InitMaxMinStopStep; | 
|---|
| 132 |  | 
|---|
| 133 | int OutVisStep; | 
|---|
| 134 | int OutSrcStep; | 
|---|
| 135 | int MaxPsiStep; | 
|---|
| 136 |  | 
|---|
| 137 | int MaxOuterStep; | 
|---|
| 138 |  | 
|---|
| 139 | int MaxMinStep; | 
|---|
| 140 | double RelEpsTotalEnergy; | 
|---|
| 141 | double RelEpsKineticEnergy; | 
|---|
| 142 | int MaxMinGapStopStep; | 
|---|
| 143 | int MaxInitMinStep; | 
|---|
| 144 | double InitRelEpsTotalEnergy; | 
|---|
| 145 | double InitRelEpsKineticEnergy; | 
|---|
| 146 | int InitMaxMinGapStopStep; | 
|---|
| 147 | } StepCounts; | 
|---|
| 148 |  | 
|---|
| 149 | /* | 
|---|
| 150 | * Contains all parameters specific to the plane wave basis set | 
|---|
| 151 | */ | 
|---|
| 152 | class StructPlaneWaveSpecifics { | 
|---|
| 153 | public: | 
|---|
| 154 | StructPlaneWaveSpecifics(); | 
|---|
| 155 | ~StructPlaneWaveSpecifics(); | 
|---|
| 156 |  | 
|---|
| 157 | int PsiType; | 
|---|
| 158 | int MaxPsiDouble; | 
|---|
| 159 | int PsiMaxNoUp; | 
|---|
| 160 | int PsiMaxNoDown; | 
|---|
| 161 | double ECut; | 
|---|
| 162 | int MaxLevel; | 
|---|
| 163 | int RiemannTensor; | 
|---|
| 164 | int LevRFactor; | 
|---|
| 165 | int RiemannLevel; | 
|---|
| 166 | int Lev0Factor; | 
|---|
| 167 | int RTActualUse; | 
|---|
| 168 | int AddPsis; | 
|---|
| 169 | double RCut; | 
|---|
| 170 | } PlaneWaveSpecifics; | 
|---|
| 171 |  | 
|---|
| 172 | bool FastParsing; | 
|---|
| 173 |  | 
|---|
| 174 | double Deltat; | 
|---|
| 175 | int IsAngstroem; | 
|---|
| 176 | int RelativeCoord; | 
|---|
| 177 | int StructOpt; | 
|---|
| 178 | int MaxTypes; | 
|---|
| 179 | std::string basis; | 
|---|
| 180 | }; | 
|---|
| 181 |  | 
|---|
| 182 | #endif /* PCPPARSER_HPP_ */ | 
|---|