| [14de469] | 1 | /** \file config.cpp | 
|---|
|  | 2 | * | 
|---|
|  | 3 | * Function implementations for the class config. | 
|---|
|  | 4 | * | 
|---|
|  | 5 | */ | 
|---|
|  | 6 |  | 
|---|
|  | 7 | #include "molecules.hpp" | 
|---|
|  | 8 |  | 
|---|
|  | 9 | /************************************* Functions for class config ***************************/ | 
|---|
|  | 10 |  | 
|---|
|  | 11 | /** Constructor for config file class. | 
|---|
|  | 12 | */ | 
|---|
|  | 13 | config::config() | 
|---|
|  | 14 | { | 
|---|
| [c750cc] | 15 | mainname = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname"); | 
|---|
|  | 16 | defaultpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname"); | 
|---|
|  | 17 | pseudopotpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname"); | 
|---|
|  | 18 | configpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname"); | 
|---|
|  | 19 | configname = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname"); | 
|---|
| [14de469] | 20 | strcpy(mainname,"pcp"); | 
|---|
| [5b15ab] | 21 | strcpy(defaultpath,"not specified"); | 
|---|
|  | 22 | strcpy(pseudopotpath,"not specified"); | 
|---|
| [04980c] | 23 | configpath[0]='\0'; | 
|---|
|  | 24 | configname[0]='\0'; | 
|---|
| [14de469] | 25 |  | 
|---|
| [62c16c] | 26 | FastParsing = false; | 
|---|
| [14de469] | 27 | ProcPEGamma=8; | 
|---|
|  | 28 | ProcPEPsi=1; | 
|---|
|  | 29 | DoOutVis=0; | 
|---|
|  | 30 | DoOutMes=1; | 
|---|
|  | 31 | DoOutNICS=0; | 
|---|
|  | 32 | DoOutOrbitals=0; | 
|---|
|  | 33 | DoOutCurrent=0; | 
|---|
|  | 34 | DoPerturbation=0; | 
|---|
|  | 35 | DoFullCurrent=0; | 
|---|
|  | 36 | CommonWannier=0; | 
|---|
|  | 37 | SawtoothStart=0.01; | 
|---|
|  | 38 | VectorPlane=0; | 
|---|
|  | 39 | VectorCut=0; | 
|---|
|  | 40 | UseAddGramSch=1; | 
|---|
|  | 41 | Seed=1; | 
|---|
|  | 42 |  | 
|---|
|  | 43 | MaxOuterStep=0; | 
|---|
|  | 44 | Deltat=0; | 
|---|
|  | 45 | OutVisStep=10; | 
|---|
|  | 46 | OutSrcStep=5; | 
|---|
|  | 47 | TargetTemp=0.00095004455; | 
|---|
|  | 48 | ScaleTempStep=25; | 
|---|
|  | 49 | MaxPsiStep=0; | 
|---|
|  | 50 | EpsWannier=1e-7; | 
|---|
|  | 51 |  | 
|---|
|  | 52 | MaxMinStep=100; | 
|---|
|  | 53 | RelEpsTotalEnergy=1e-7; | 
|---|
|  | 54 | RelEpsKineticEnergy=1e-5; | 
|---|
|  | 55 | MaxMinStopStep=1; | 
|---|
|  | 56 | MaxMinGapStopStep=0; | 
|---|
|  | 57 | MaxInitMinStep=100; | 
|---|
|  | 58 | InitRelEpsTotalEnergy=1e-5; | 
|---|
|  | 59 | InitRelEpsKineticEnergy=1e-4; | 
|---|
|  | 60 | InitMaxMinStopStep=1; | 
|---|
|  | 61 | InitMaxMinGapStopStep=0; | 
|---|
|  | 62 |  | 
|---|
|  | 63 | //BoxLength[NDIM*NDIM]; | 
|---|
|  | 64 |  | 
|---|
|  | 65 | ECut=128.; | 
|---|
|  | 66 | MaxLevel=5; | 
|---|
|  | 67 | RiemannTensor=0; | 
|---|
|  | 68 | LevRFactor=0; | 
|---|
|  | 69 | RiemannLevel=0; | 
|---|
|  | 70 | Lev0Factor=2; | 
|---|
|  | 71 | RTActualUse=0; | 
|---|
|  | 72 | PsiType=0; | 
|---|
|  | 73 | MaxPsiDouble=0; | 
|---|
|  | 74 | PsiMaxNoUp=0; | 
|---|
|  | 75 | PsiMaxNoDown=0; | 
|---|
|  | 76 | AddPsis=0; | 
|---|
|  | 77 |  | 
|---|
|  | 78 | RCut=20.; | 
|---|
|  | 79 | StructOpt=0; | 
|---|
|  | 80 | IsAngstroem=1; | 
|---|
|  | 81 | RelativeCoord=0; | 
|---|
|  | 82 | MaxTypes=0; | 
|---|
|  | 83 | }; | 
|---|
|  | 84 |  | 
|---|
|  | 85 |  | 
|---|
|  | 86 | /** Destructor for config file class. | 
|---|
|  | 87 | */ | 
|---|
|  | 88 | config::~config() | 
|---|
|  | 89 | { | 
|---|
|  | 90 | Free((void **)&mainname, "config::~config: *mainname"); | 
|---|
|  | 91 | Free((void **)&defaultpath, "config::~config: *defaultpath"); | 
|---|
|  | 92 | Free((void **)&pseudopotpath, "config::~config: *pseudopotpath"); | 
|---|
| [5b15ab] | 93 | Free((void **)&configpath, "config::~config: *configpath"); | 
|---|
| [b5ecd9] | 94 | Free((void **)&configname, "config::~config: *configname"); | 
|---|
| [14de469] | 95 | }; | 
|---|
|  | 96 |  | 
|---|
|  | 97 | /** Displays menu for editing each entry of the config file. | 
|---|
|  | 98 | * Nothing fancy here, just lots of cout << Verbose(0)s for the menu and a switch/case | 
|---|
|  | 99 | * for each entry of the config file structure. | 
|---|
|  | 100 | */ | 
|---|
|  | 101 | void config::Edit(molecule *mol) | 
|---|
|  | 102 | { | 
|---|
|  | 103 | char choice; | 
|---|
|  | 104 |  | 
|---|
|  | 105 | do { | 
|---|
|  | 106 | cout << Verbose(0) << "===========EDIT CONFIGURATION============================" << endl; | 
|---|
|  | 107 | cout << Verbose(0) << " A - mainname (prefix for all runtime files)" << endl; | 
|---|
|  | 108 | cout << Verbose(0) << " B - Default path (for runtime files)" << endl; | 
|---|
|  | 109 | cout << Verbose(0) << " C - Path of pseudopotential files" << endl; | 
|---|
|  | 110 | cout << Verbose(0) << " D - Number of coefficient sharing processes" << endl; | 
|---|
|  | 111 | cout << Verbose(0) << " E - Number of wave function sharing processes" << endl; | 
|---|
|  | 112 | cout << Verbose(0) << " F - 0: Don't output density for OpenDX, 1: do" << endl; | 
|---|
|  | 113 | cout << Verbose(0) << " G - 0: Don't output physical data, 1: do" << endl; | 
|---|
|  | 114 | cout << Verbose(0) << " H - 0: Don't output densities of each unperturbed orbital for OpenDX, 1: do" << endl; | 
|---|
|  | 115 | cout << Verbose(0) << " I - 0: Don't output current density for OpenDX, 1: do" << endl; | 
|---|
|  | 116 | cout << Verbose(0) << " J - 0: Don't do the full current calculation, 1: do" << endl; | 
|---|
|  | 117 | cout << Verbose(0) << " K - 0: Don't do perturbation calculation to obtain susceptibility and shielding, 1: do" << endl; | 
|---|
|  | 118 | cout << Verbose(0) << " L - 0: Wannier centres as calculated, 1: common centre for all, 2: unite centres according to spread, 3: cell centre, 4: shifted to nearest grid point" << endl; | 
|---|
|  | 119 | cout << Verbose(0) << " M - Absolute begin of unphysical sawtooth transfer for position operator within cell" << endl; | 
|---|
|  | 120 | cout << Verbose(0) << " N - (0,1,2) x,y,z-plane to do two-dimensional current vector cut" << endl; | 
|---|
|  | 121 | cout << Verbose(0) << " O - Absolute position along vector cut axis for cut plane" << endl; | 
|---|
|  | 122 | cout << Verbose(0) << " P - Additional Gram-Schmidt-Orthonormalization to stabilize numerics" << endl; | 
|---|
|  | 123 | cout << Verbose(0) << " Q - Initial integer value of random number generator" << endl; | 
|---|
|  | 124 | cout << Verbose(0) << " R - for perturbation 0, for structure optimization defines upper limit of iterations" << endl; | 
|---|
|  | 125 | cout << Verbose(0) << " T - Output visual after ...th step" << endl; | 
|---|
|  | 126 | cout << Verbose(0) << " U - Output source densities of wave functions after ...th step" << endl; | 
|---|
|  | 127 | cout << Verbose(0) << " X - minimization iterations per wave function, if unsure leave at default value 0" << endl; | 
|---|
|  | 128 | cout << Verbose(0) << " Y - tolerance value for total spread in iterative Jacobi diagonalization" << endl; | 
|---|
|  | 129 | cout << Verbose(0) << " Z - Maximum number of minimization iterations" << endl; | 
|---|
|  | 130 | cout << Verbose(0) << " a - Relative change in total energy to stop min. iteration" << endl; | 
|---|
|  | 131 | cout << Verbose(0) << " b - Relative change in kinetic energy to stop min. iteration" << endl; | 
|---|
|  | 132 | cout << Verbose(0) << " c - Check stop conditions every ..th step during min. iteration" << endl; | 
|---|
|  | 133 | cout << Verbose(0) << " e - Maximum number of minimization iterations during initial level" << endl; | 
|---|
|  | 134 | cout << Verbose(0) << " f - Relative change in total energy to stop min. iteration during initial level" << endl; | 
|---|
|  | 135 | cout << Verbose(0) << " g - Relative change in kinetic energy to stop min. iteration during initial level" << endl; | 
|---|
|  | 136 | cout << Verbose(0) << " h - Check stop conditions every ..th step during min. iteration during initial level" << endl; | 
|---|
|  | 137 | cout << Verbose(0) << " j - six lower diagonal entries of matrix, defining the unit cell" << endl; | 
|---|
|  | 138 | cout << Verbose(0) << " k - Energy cutoff of plane wave basis in Hartree" << endl; | 
|---|
|  | 139 | cout << Verbose(0) << " l - Maximum number of levels in multi-level-ansatz" << endl; | 
|---|
|  | 140 | cout << Verbose(0) << " m - Factor by which grid nodes increase between standard and upper level" << endl; | 
|---|
|  | 141 | cout << Verbose(0) << " n - 0: Don't use RiemannTensor, 1: Do" << endl; | 
|---|
|  | 142 | cout << Verbose(0) << " o - Factor by which grid nodes increase between Riemann and standard(?) level" << endl; | 
|---|
|  | 143 | cout << Verbose(0) << " p - Number of Riemann levels" << endl; | 
|---|
|  | 144 | cout << Verbose(0) << " r - 0: Don't Use RiemannTensor, 1: Do" << endl; | 
|---|
|  | 145 | cout << Verbose(0) << " s - 0: Doubly occupied orbitals, 1: Up-/Down-Orbitals" << endl; | 
|---|
|  | 146 | cout << Verbose(0) << " t - Number of orbitals (depends pn SpinType)" << endl; | 
|---|
|  | 147 | cout << Verbose(0) << " u - Number of SpinUp orbitals (depends on SpinType)" << endl; | 
|---|
|  | 148 | cout << Verbose(0) << " v - Number of SpinDown orbitals (depends on SpinType)" << endl; | 
|---|
|  | 149 | cout << Verbose(0) << " w - Number of additional, unoccupied orbitals" << endl; | 
|---|
|  | 150 | cout << Verbose(0) << " x - radial cutoff for ewald summation in Bohrradii" << endl; | 
|---|
|  | 151 | cout << Verbose(0) << " y - 0: Don't do structure optimization beforehand, 1: Do" << endl; | 
|---|
|  | 152 | cout << Verbose(0) << " z - 0: Units are in Bohr radii, 1: units are in Aengstrom" << endl; | 
|---|
|  | 153 | cout << Verbose(0) << " i - 0: Coordinates given in file are absolute, 1: ... are relative to unit cell" << endl; | 
|---|
|  | 154 | cout << Verbose(0) << "=========================================================" << endl; | 
|---|
|  | 155 | cout << Verbose(0) << "INPUT: "; | 
|---|
|  | 156 | cin >> choice; | 
|---|
|  | 157 |  | 
|---|
|  | 158 | switch (choice) { | 
|---|
|  | 159 | case 'A': // mainname | 
|---|
|  | 160 | cout << Verbose(0) << "Old: " << config::mainname << "\t new: "; | 
|---|
|  | 161 | cin >> config::mainname; | 
|---|
|  | 162 | break; | 
|---|
|  | 163 | case 'B': // defaultpath | 
|---|
|  | 164 | cout << Verbose(0) << "Old: " << config::defaultpath << "\t new: "; | 
|---|
|  | 165 | cin >> config::defaultpath; | 
|---|
|  | 166 | break; | 
|---|
|  | 167 | case 'C': // pseudopotpath | 
|---|
|  | 168 | cout << Verbose(0) << "Old: " << config::pseudopotpath << "\t new: "; | 
|---|
|  | 169 | cin >> config::pseudopotpath; | 
|---|
|  | 170 | break; | 
|---|
|  | 171 |  | 
|---|
|  | 172 | case 'D': // ProcPEGamma | 
|---|
|  | 173 | cout << Verbose(0) << "Old: " << config::ProcPEGamma << "\t new: "; | 
|---|
|  | 174 | cin >> config::ProcPEGamma; | 
|---|
|  | 175 | break; | 
|---|
|  | 176 | case 'E': // ProcPEPsi | 
|---|
|  | 177 | cout << Verbose(0) << "Old: " << config::ProcPEPsi << "\t new: "; | 
|---|
|  | 178 | cin >> config::ProcPEPsi; | 
|---|
|  | 179 | break; | 
|---|
|  | 180 | case 'F': // DoOutVis | 
|---|
|  | 181 | cout << Verbose(0) << "Old: " << config::DoOutVis << "\t new: "; | 
|---|
|  | 182 | cin >> config::DoOutVis; | 
|---|
|  | 183 | break; | 
|---|
|  | 184 | case 'G': // DoOutMes | 
|---|
|  | 185 | cout << Verbose(0) << "Old: " << config::DoOutMes << "\t new: "; | 
|---|
|  | 186 | cin >> config::DoOutMes; | 
|---|
|  | 187 | break; | 
|---|
|  | 188 | case 'H': // DoOutOrbitals | 
|---|
|  | 189 | cout << Verbose(0) << "Old: " << config::DoOutOrbitals << "\t new: "; | 
|---|
|  | 190 | cin >> config::DoOutOrbitals; | 
|---|
|  | 191 | break; | 
|---|
|  | 192 | case 'I': // DoOutCurrent | 
|---|
|  | 193 | cout << Verbose(0) << "Old: " << config::DoOutCurrent << "\t new: "; | 
|---|
|  | 194 | cin >> config::DoOutCurrent; | 
|---|
|  | 195 | break; | 
|---|
|  | 196 | case 'J': // DoFullCurrent | 
|---|
|  | 197 | cout << Verbose(0) << "Old: " << config::DoFullCurrent << "\t new: "; | 
|---|
|  | 198 | cin >> config::DoFullCurrent; | 
|---|
|  | 199 | break; | 
|---|
|  | 200 | case 'K': // DoPerturbation | 
|---|
|  | 201 | cout << Verbose(0) << "Old: " << config::DoPerturbation << "\t new: "; | 
|---|
|  | 202 | cin >> config::DoPerturbation; | 
|---|
|  | 203 | break; | 
|---|
|  | 204 | case 'L': // CommonWannier | 
|---|
|  | 205 | cout << Verbose(0) << "Old: " << config::CommonWannier << "\t new: "; | 
|---|
|  | 206 | cin >> config::CommonWannier; | 
|---|
|  | 207 | break; | 
|---|
|  | 208 | case 'M': // SawtoothStart | 
|---|
|  | 209 | cout << Verbose(0) << "Old: " << config::SawtoothStart << "\t new: "; | 
|---|
|  | 210 | cin >> config::SawtoothStart; | 
|---|
|  | 211 | break; | 
|---|
|  | 212 | case 'N': // VectorPlane | 
|---|
|  | 213 | cout << Verbose(0) << "Old: " << config::VectorPlane << "\t new: "; | 
|---|
|  | 214 | cin >> config::VectorPlane; | 
|---|
|  | 215 | break; | 
|---|
|  | 216 | case 'O': // VectorCut | 
|---|
|  | 217 | cout << Verbose(0) << "Old: " << config::VectorCut << "\t new: "; | 
|---|
|  | 218 | cin >> config::VectorCut; | 
|---|
|  | 219 | break; | 
|---|
|  | 220 | case 'P': // UseAddGramSch | 
|---|
|  | 221 | cout << Verbose(0) << "Old: " << config::UseAddGramSch << "\t new: "; | 
|---|
|  | 222 | cin >> config::UseAddGramSch; | 
|---|
|  | 223 | break; | 
|---|
|  | 224 | case 'Q': // Seed | 
|---|
|  | 225 | cout << Verbose(0) << "Old: " << config::Seed << "\t new: "; | 
|---|
|  | 226 | cin >> config::Seed; | 
|---|
|  | 227 | break; | 
|---|
|  | 228 |  | 
|---|
|  | 229 | case 'R': // MaxOuterStep | 
|---|
|  | 230 | cout << Verbose(0) << "Old: " << config::MaxOuterStep << "\t new: "; | 
|---|
|  | 231 | cin >> config::MaxOuterStep; | 
|---|
|  | 232 | break; | 
|---|
|  | 233 | case 'T': // OutVisStep | 
|---|
|  | 234 | cout << Verbose(0) << "Old: " << config::OutVisStep << "\t new: "; | 
|---|
|  | 235 | cin >> config::OutVisStep; | 
|---|
|  | 236 | break; | 
|---|
|  | 237 | case 'U': // OutSrcStep | 
|---|
|  | 238 | cout << Verbose(0) << "Old: " << config::OutSrcStep << "\t new: "; | 
|---|
|  | 239 | cin >> config::OutSrcStep; | 
|---|
|  | 240 | break; | 
|---|
|  | 241 | case 'X': // MaxPsiStep | 
|---|
|  | 242 | cout << Verbose(0) << "Old: " << config::MaxPsiStep << "\t new: "; | 
|---|
|  | 243 | cin >> config::MaxPsiStep; | 
|---|
|  | 244 | break; | 
|---|
|  | 245 | case 'Y': // EpsWannier | 
|---|
|  | 246 | cout << Verbose(0) << "Old: " << config::EpsWannier << "\t new: "; | 
|---|
|  | 247 | cin >> config::EpsWannier; | 
|---|
|  | 248 | break; | 
|---|
|  | 249 |  | 
|---|
|  | 250 | case 'Z': // MaxMinStep | 
|---|
|  | 251 | cout << Verbose(0) << "Old: " << config::MaxMinStep << "\t new: "; | 
|---|
|  | 252 | cin >> config::MaxMinStep; | 
|---|
|  | 253 | break; | 
|---|
|  | 254 | case 'a': // RelEpsTotalEnergy | 
|---|
|  | 255 | cout << Verbose(0) << "Old: " << config::RelEpsTotalEnergy << "\t new: "; | 
|---|
|  | 256 | cin >> config::RelEpsTotalEnergy; | 
|---|
|  | 257 | break; | 
|---|
|  | 258 | case 'b': // RelEpsKineticEnergy | 
|---|
|  | 259 | cout << Verbose(0) << "Old: " << config::RelEpsKineticEnergy << "\t new: "; | 
|---|
|  | 260 | cin >> config::RelEpsKineticEnergy; | 
|---|
|  | 261 | break; | 
|---|
|  | 262 | case 'c': // MaxMinStopStep | 
|---|
|  | 263 | cout << Verbose(0) << "Old: " << config::MaxMinStopStep << "\t new: "; | 
|---|
|  | 264 | cin >> config::MaxMinStopStep; | 
|---|
|  | 265 | break; | 
|---|
|  | 266 | case 'e': // MaxInitMinStep | 
|---|
|  | 267 | cout << Verbose(0) << "Old: " << config::MaxInitMinStep << "\t new: "; | 
|---|
|  | 268 | cin >> config::MaxInitMinStep; | 
|---|
|  | 269 | break; | 
|---|
|  | 270 | case 'f': // InitRelEpsTotalEnergy | 
|---|
|  | 271 | cout << Verbose(0) << "Old: " << config::InitRelEpsTotalEnergy << "\t new: "; | 
|---|
|  | 272 | cin >> config::InitRelEpsTotalEnergy; | 
|---|
|  | 273 | break; | 
|---|
|  | 274 | case 'g': // InitRelEpsKineticEnergy | 
|---|
|  | 275 | cout << Verbose(0) << "Old: " << config::InitRelEpsKineticEnergy << "\t new: "; | 
|---|
|  | 276 | cin >> config::InitRelEpsKineticEnergy; | 
|---|
|  | 277 | break; | 
|---|
|  | 278 | case 'h': // InitMaxMinStopStep | 
|---|
|  | 279 | cout << Verbose(0) << "Old: " << config::InitMaxMinStopStep << "\t new: "; | 
|---|
|  | 280 | cin >> config::InitMaxMinStopStep; | 
|---|
|  | 281 | break; | 
|---|
|  | 282 |  | 
|---|
|  | 283 | case 'j': // BoxLength | 
|---|
|  | 284 | cout << Verbose(0) << "enter lower triadiagonalo form of basis matrix" << endl << endl; | 
|---|
| [7f3b9d] | 285 | for (int i=6;i--;) { | 
|---|
| [14de469] | 286 | cout << Verbose(0) << "Cell size" << i << ": "; | 
|---|
|  | 287 | cin >> mol->cell_size[i]; | 
|---|
|  | 288 | } | 
|---|
|  | 289 | break; | 
|---|
|  | 290 |  | 
|---|
|  | 291 | case 'k': // ECut | 
|---|
|  | 292 | cout << Verbose(0) << "Old: " << config::ECut << "\t new: "; | 
|---|
|  | 293 | cin >> config::ECut; | 
|---|
|  | 294 | break; | 
|---|
|  | 295 | case 'l': // MaxLevel | 
|---|
|  | 296 | cout << Verbose(0) << "Old: " << config::MaxLevel << "\t new: "; | 
|---|
|  | 297 | cin >> config::MaxLevel; | 
|---|
|  | 298 | break; | 
|---|
|  | 299 | case 'm': // RiemannTensor | 
|---|
|  | 300 | cout << Verbose(0) << "Old: " << config::RiemannTensor << "\t new: "; | 
|---|
|  | 301 | cin >> config::RiemannTensor; | 
|---|
|  | 302 | break; | 
|---|
|  | 303 | case 'n': // LevRFactor | 
|---|
|  | 304 | cout << Verbose(0) << "Old: " << config::LevRFactor << "\t new: "; | 
|---|
|  | 305 | cin >> config::LevRFactor; | 
|---|
|  | 306 | break; | 
|---|
|  | 307 | case 'o': // RiemannLevel | 
|---|
|  | 308 | cout << Verbose(0) << "Old: " << config::RiemannLevel << "\t new: "; | 
|---|
|  | 309 | cin >> config::RiemannLevel; | 
|---|
|  | 310 | break; | 
|---|
|  | 311 | case 'p': // Lev0Factor | 
|---|
|  | 312 | cout << Verbose(0) << "Old: " << config::Lev0Factor << "\t new: "; | 
|---|
|  | 313 | cin >> config::Lev0Factor; | 
|---|
|  | 314 | break; | 
|---|
|  | 315 | case 'r': // RTActualUse | 
|---|
|  | 316 | cout << Verbose(0) << "Old: " << config::RTActualUse << "\t new: "; | 
|---|
|  | 317 | cin >> config::RTActualUse; | 
|---|
|  | 318 | break; | 
|---|
|  | 319 | case 's': // PsiType | 
|---|
|  | 320 | cout << Verbose(0) << "Old: " << config::PsiType << "\t new: "; | 
|---|
|  | 321 | cin >> config::PsiType; | 
|---|
|  | 322 | break; | 
|---|
|  | 323 | case 't': // MaxPsiDouble | 
|---|
|  | 324 | cout << Verbose(0) << "Old: " << config::MaxPsiDouble << "\t new: "; | 
|---|
|  | 325 | cin >> config::MaxPsiDouble; | 
|---|
|  | 326 | break; | 
|---|
|  | 327 | case 'u': // PsiMaxNoUp | 
|---|
|  | 328 | cout << Verbose(0) << "Old: " << config::PsiMaxNoUp << "\t new: "; | 
|---|
|  | 329 | cin >> config::PsiMaxNoUp; | 
|---|
|  | 330 | break; | 
|---|
|  | 331 | case 'v': // PsiMaxNoDown | 
|---|
|  | 332 | cout << Verbose(0) << "Old: " << config::PsiMaxNoDown << "\t new: "; | 
|---|
|  | 333 | cin >> config::PsiMaxNoDown; | 
|---|
|  | 334 | break; | 
|---|
|  | 335 | case 'w': // AddPsis | 
|---|
|  | 336 | cout << Verbose(0) << "Old: " << config::AddPsis << "\t new: "; | 
|---|
|  | 337 | cin >> config::AddPsis; | 
|---|
|  | 338 | break; | 
|---|
|  | 339 |  | 
|---|
|  | 340 | case 'x': // RCut | 
|---|
|  | 341 | cout << Verbose(0) << "Old: " << config::RCut << "\t new: "; | 
|---|
|  | 342 | cin >> config::RCut; | 
|---|
|  | 343 | break; | 
|---|
|  | 344 | case 'y': // StructOpt | 
|---|
|  | 345 | cout << Verbose(0) << "Old: " << config::StructOpt << "\t new: "; | 
|---|
|  | 346 | cin >> config::StructOpt; | 
|---|
|  | 347 | break; | 
|---|
|  | 348 | case 'z': // IsAngstroem | 
|---|
|  | 349 | cout << Verbose(0) << "Old: " << config::IsAngstroem << "\t new: "; | 
|---|
|  | 350 | cin >> config::IsAngstroem; | 
|---|
|  | 351 | break; | 
|---|
|  | 352 | case 'i': // RelativeCoord | 
|---|
|  | 353 | cout << Verbose(0) << "Old: " << config::RelativeCoord << "\t new: "; | 
|---|
|  | 354 | cin >> config::RelativeCoord; | 
|---|
|  | 355 | break; | 
|---|
|  | 356 | }; | 
|---|
|  | 357 | } while (choice != 'q'); | 
|---|
|  | 358 | }; | 
|---|
|  | 359 |  | 
|---|
|  | 360 | /** Tests whether a given configuration file adhears to old or new syntax. | 
|---|
| [5b15ab] | 361 | * \param *filename filename of config file to be tested | 
|---|
| [14de469] | 362 | * \param *periode pointer to a periodentafel class with all elements | 
|---|
|  | 363 | * \param *mol pointer to molecule containing all atoms of the molecule | 
|---|
|  | 364 | * \return 0 - old syntax, 1 - new syntax, -1 - unknown syntax | 
|---|
|  | 365 | */ | 
|---|
| [5b15ab] | 366 | int config::TestSyntax(char *filename, periodentafel *periode, molecule *mol) | 
|---|
| [14de469] | 367 | { | 
|---|
|  | 368 | int test; | 
|---|
| [5b15ab] | 369 | ifstream file(filename); | 
|---|
|  | 370 |  | 
|---|
| [14de469] | 371 | // search file for keyword: ProcPEGamma (new syntax) | 
|---|
| [5b15ab] | 372 | if (ParseForParameter(1,&file,"ProcPEGamma", 0, 1, 1, int_type, &test, 1, optional)) { | 
|---|
|  | 373 | file.close(); | 
|---|
| [14de469] | 374 | return 1; | 
|---|
| [5b15ab] | 375 | } | 
|---|
| [14de469] | 376 | // search file for keyword: ProcsGammaPsi (old syntax) | 
|---|
| [5b15ab] | 377 | if (ParseForParameter(1,&file,"ProcsGammaPsi", 0, 1, 1, int_type, &test, 1, optional)) { | 
|---|
|  | 378 | file.close(); | 
|---|
| [14de469] | 379 | return 0; | 
|---|
| [5b15ab] | 380 | } | 
|---|
|  | 381 | file.close(); | 
|---|
| [14de469] | 382 | return -1; | 
|---|
|  | 383 | } | 
|---|
|  | 384 |  | 
|---|
|  | 385 | /** Returns private config::IsAngstroem. | 
|---|
|  | 386 | * \return IsAngstroem | 
|---|
|  | 387 | */ | 
|---|
|  | 388 | bool config::GetIsAngstroem() const | 
|---|
|  | 389 | { | 
|---|
|  | 390 | return (IsAngstroem == 1); | 
|---|
|  | 391 | }; | 
|---|
|  | 392 |  | 
|---|
|  | 393 | /** Returns private config::*defaultpath. | 
|---|
|  | 394 | * \return *defaultpath | 
|---|
|  | 395 | */ | 
|---|
|  | 396 | char * config::GetDefaultPath() const | 
|---|
|  | 397 | { | 
|---|
|  | 398 | return defaultpath; | 
|---|
|  | 399 | }; | 
|---|
|  | 400 |  | 
|---|
|  | 401 |  | 
|---|
|  | 402 | /** Returns private config::*defaultpath. | 
|---|
|  | 403 | * \return *defaultpath | 
|---|
|  | 404 | */ | 
|---|
|  | 405 | void config::SetDefaultPath(const char *path) | 
|---|
|  | 406 | { | 
|---|
|  | 407 | strcpy(defaultpath, path); | 
|---|
|  | 408 | }; | 
|---|
|  | 409 |  | 
|---|
| [5b15ab] | 410 | /** Retrieves the path in the given config file name. | 
|---|
| [7f3b9d] | 411 | * \param filename config file string | 
|---|
| [5b15ab] | 412 | */ | 
|---|
| [7f3b9d] | 413 | void config::RetrieveConfigPathAndName(string filename) | 
|---|
| [5b15ab] | 414 | { | 
|---|
| [b5ecd9] | 415 | char *ptr = NULL; | 
|---|
| [7f3b9d] | 416 | char *buffer = new char[MAXSTRINGSIZE]; | 
|---|
|  | 417 | strncpy(buffer, filename.c_str(), MAXSTRINGSIZE); | 
|---|
| [5b15ab] | 418 | int last = -1; | 
|---|
| [7f3b9d] | 419 | for(last=MAXSTRINGSIZE;last--;) { | 
|---|
|  | 420 | if (buffer[last] == '/') | 
|---|
| [5b15ab] | 421 | break; | 
|---|
|  | 422 | } | 
|---|
| [a2c084] | 423 | if (last == -1) { // no path in front, set to local directory. | 
|---|
| [5b15ab] | 424 | strcpy(configpath, "./"); | 
|---|
| [7f3b9d] | 425 | ptr = buffer; | 
|---|
| [5b15ab] | 426 | } else { | 
|---|
| [7f3b9d] | 427 | strncpy(configpath, buffer, last+1); | 
|---|
|  | 428 | ptr = &buffer[last+1]; | 
|---|
| [5b15ab] | 429 | if (last < 254) | 
|---|
|  | 430 | configpath[last+1]='\0'; | 
|---|
|  | 431 | } | 
|---|
| [b5ecd9] | 432 | strcpy(configname, ptr); | 
|---|
|  | 433 | cout << "Found configpath: " << configpath << ", dir slash was found at " << last << ", config name is " << configname << "." << endl; | 
|---|
| [7f3b9d] | 434 | delete[](buffer); | 
|---|
| [5b15ab] | 435 | }; | 
|---|
|  | 436 |  | 
|---|
|  | 437 |  | 
|---|
| [14de469] | 438 | /** Initializes config file structure by loading elements from a give file. | 
|---|
|  | 439 | * \param *file input file stream being the opened config file | 
|---|
|  | 440 | * \param *periode pointer to a periodentafel class with all elements | 
|---|
|  | 441 | * \param *mol pointer to molecule containing all atoms of the molecule | 
|---|
|  | 442 | */ | 
|---|
| [5b15ab] | 443 | void config::Load(char *filename, periodentafel *periode, molecule *mol) | 
|---|
| [14de469] | 444 | { | 
|---|
| [5b15ab] | 445 | ifstream *file = new ifstream(filename); | 
|---|
|  | 446 | if (file == NULL) { | 
|---|
|  | 447 | cerr << "ERROR: config file " << filename << " missing!" << endl; | 
|---|
|  | 448 | return; | 
|---|
|  | 449 | } | 
|---|
| [b5ecd9] | 450 | RetrieveConfigPathAndName(filename); | 
|---|
| [14de469] | 451 | // ParseParameters | 
|---|
|  | 452 |  | 
|---|
|  | 453 | /* Oeffne Hauptparameterdatei */ | 
|---|
|  | 454 | int di; | 
|---|
|  | 455 | double BoxLength[9]; | 
|---|
|  | 456 | string zeile; | 
|---|
|  | 457 | string dummy; | 
|---|
|  | 458 | element *elementhash[128]; | 
|---|
|  | 459 | char name[128]; | 
|---|
|  | 460 | char keyword[128]; | 
|---|
|  | 461 | int Z, No; | 
|---|
|  | 462 | int verbose = 0; | 
|---|
|  | 463 |  | 
|---|
|  | 464 | /* Namen einlesen */ | 
|---|
|  | 465 |  | 
|---|
|  | 466 | ParseForParameter(verbose,file, "mainname", 0, 1, 1, string_type, (config::mainname), 1, critical); | 
|---|
|  | 467 | ParseForParameter(verbose,file, "defaultpath", 0, 1, 1, string_type, (config::defaultpath), 1, critical); | 
|---|
|  | 468 | ParseForParameter(verbose,file, "pseudopotpath", 0, 1, 1, string_type, (config::pseudopotpath), 1, critical); | 
|---|
|  | 469 | ParseForParameter(verbose,file,"ProcPEGamma", 0, 1, 1, int_type, &(config::ProcPEGamma), 1, critical); | 
|---|
|  | 470 | ParseForParameter(verbose,file,"ProcPEPsi", 0, 1, 1, int_type, &(config::ProcPEPsi), 1, critical); | 
|---|
|  | 471 |  | 
|---|
|  | 472 | if (!ParseForParameter(verbose,file,"Seed", 0, 1, 1, int_type, &(config::Seed), 1, optional)) | 
|---|
|  | 473 | config::Seed = 1; | 
|---|
|  | 474 |  | 
|---|
|  | 475 | if(!ParseForParameter(verbose,file,"DoOutOrbitals", 0, 1, 1, int_type, &(config::DoOutOrbitals), 1, optional)) { | 
|---|
|  | 476 | config::DoOutOrbitals = 0; | 
|---|
|  | 477 | } else { | 
|---|
|  | 478 | if (config::DoOutOrbitals < 0) config::DoOutOrbitals = 0; | 
|---|
|  | 479 | if (config::DoOutOrbitals > 1) config::DoOutOrbitals = 1; | 
|---|
|  | 480 | } | 
|---|
|  | 481 | ParseForParameter(verbose,file,"DoOutVis", 0, 1, 1, int_type, &(config::DoOutVis), 1, critical); | 
|---|
|  | 482 | if (config::DoOutVis < 0) config::DoOutVis = 0; | 
|---|
|  | 483 | if (config::DoOutVis > 1) config::DoOutVis = 1; | 
|---|
|  | 484 | if (!ParseForParameter(verbose,file,"VectorPlane", 0, 1, 1, int_type, &(config::VectorPlane), 1, optional)) | 
|---|
|  | 485 | config::VectorPlane = -1; | 
|---|
|  | 486 | if (!ParseForParameter(verbose,file,"VectorCut", 0, 1, 1, double_type, &(config::VectorCut), 1, optional)) | 
|---|
|  | 487 | config::VectorCut = 0.; | 
|---|
|  | 488 | ParseForParameter(verbose,file,"DoOutMes", 0, 1, 1, int_type, &(config::DoOutMes), 1, critical); | 
|---|
|  | 489 | if (config::DoOutMes < 0) config::DoOutMes = 0; | 
|---|
|  | 490 | if (config::DoOutMes > 1) config::DoOutMes = 1; | 
|---|
|  | 491 | if (!ParseForParameter(verbose,file,"DoOutCurr", 0, 1, 1, int_type, &(config::DoOutCurrent), 1, optional)) | 
|---|
|  | 492 | config::DoOutCurrent = 0; | 
|---|
|  | 493 | if (config::DoOutCurrent < 0) config::DoOutCurrent = 0; | 
|---|
|  | 494 | if (config::DoOutCurrent > 1) config::DoOutCurrent = 1; | 
|---|
|  | 495 | ParseForParameter(verbose,file,"AddGramSch", 0, 1, 1, int_type, &(config::UseAddGramSch), 1, critical); | 
|---|
|  | 496 | if (config::UseAddGramSch < 0) config::UseAddGramSch = 0; | 
|---|
|  | 497 | if (config::UseAddGramSch > 2) config::UseAddGramSch = 2; | 
|---|
|  | 498 | if(!ParseForParameter(verbose,file,"CommonWannier", 0, 1, 1, int_type, &(config::CommonWannier), 1, optional)) { | 
|---|
|  | 499 | config::CommonWannier = 0; | 
|---|
|  | 500 | } else { | 
|---|
|  | 501 | if (config::CommonWannier < 0) config::CommonWannier = 0; | 
|---|
|  | 502 | if (config::CommonWannier > 4) config::CommonWannier = 4; | 
|---|
|  | 503 | } | 
|---|
|  | 504 | if(!ParseForParameter(verbose,file,"SawtoothStart", 0, 1, 1, double_type, &(config::SawtoothStart), 1, optional)) { | 
|---|
|  | 505 | config::SawtoothStart = 0.01; | 
|---|
|  | 506 | } else { | 
|---|
|  | 507 | if (config::SawtoothStart < 0.) config::SawtoothStart = 0.; | 
|---|
|  | 508 | if (config::SawtoothStart > 1.) config::SawtoothStart = 1.; | 
|---|
|  | 509 | } | 
|---|
|  | 510 |  | 
|---|
|  | 511 | ParseForParameter(verbose,file,"MaxOuterStep", 0, 1, 1, int_type, &(config::MaxOuterStep), 1, critical); | 
|---|
|  | 512 | ParseForParameter(verbose,file,"Deltat", 0, 1, 1, double_type, &(config::Deltat), 1, optional); | 
|---|
|  | 513 | ParseForParameter(verbose,file,"OutVisStep", 0, 1, 1, int_type, &(config::OutVisStep), 1, optional); | 
|---|
|  | 514 | ParseForParameter(verbose,file,"OutSrcStep", 0, 1, 1, int_type, &(config::OutSrcStep), 1, optional); | 
|---|
|  | 515 | ParseForParameter(verbose,file,"TargetTemp", 0, 1, 1, double_type, &(config::TargetTemp), 1, optional); | 
|---|
|  | 516 | //ParseForParameter(verbose,file,"Thermostat", 0, 1, 1, int_type, &(config::ScaleTempStep), 1, optional); | 
|---|
|  | 517 | if (!ParseForParameter(verbose,file,"EpsWannier", 0, 1, 1, double_type, &(config::EpsWannier), 1, optional)) | 
|---|
|  | 518 | config::EpsWannier = 1e-8; | 
|---|
|  | 519 |  | 
|---|
|  | 520 | // stop conditions | 
|---|
|  | 521 | //if (config::MaxOuterStep <= 0) config::MaxOuterStep = 1; | 
|---|
|  | 522 | ParseForParameter(verbose,file,"MaxPsiStep", 0, 1, 1, int_type, &(config::MaxPsiStep), 1, critical); | 
|---|
|  | 523 | if (config::MaxPsiStep <= 0) config::MaxPsiStep = 3; | 
|---|
|  | 524 |  | 
|---|
|  | 525 | ParseForParameter(verbose,file,"MaxMinStep", 0, 1, 1, int_type, &(config::MaxMinStep), 1, critical); | 
|---|
|  | 526 | ParseForParameter(verbose,file,"RelEpsTotalE", 0, 1, 1, double_type, &(config::RelEpsTotalEnergy), 1, critical); | 
|---|
|  | 527 | ParseForParameter(verbose,file,"RelEpsKineticE", 0, 1, 1, double_type, &(config::RelEpsKineticEnergy), 1, critical); | 
|---|
|  | 528 | ParseForParameter(verbose,file,"MaxMinStopStep", 0, 1, 1, int_type, &(config::MaxMinStopStep), 1, critical); | 
|---|
|  | 529 | ParseForParameter(verbose,file,"MaxMinGapStopStep", 0, 1, 1, int_type, &(config::MaxMinGapStopStep), 1, critical); | 
|---|
|  | 530 | if (config::MaxMinStep <= 0) config::MaxMinStep = config::MaxPsiStep; | 
|---|
|  | 531 | if (config::MaxMinStopStep < 1) config::MaxMinStopStep = 1; | 
|---|
|  | 532 | if (config::MaxMinGapStopStep < 1) config::MaxMinGapStopStep = 1; | 
|---|
|  | 533 |  | 
|---|
|  | 534 | ParseForParameter(verbose,file,"MaxInitMinStep", 0, 1, 1, int_type, &(config::MaxInitMinStep), 1, critical); | 
|---|
|  | 535 | ParseForParameter(verbose,file,"InitRelEpsTotalE", 0, 1, 1, double_type, &(config::InitRelEpsTotalEnergy), 1, critical); | 
|---|
|  | 536 | ParseForParameter(verbose,file,"InitRelEpsKineticE", 0, 1, 1, double_type, &(config::InitRelEpsKineticEnergy), 1, critical); | 
|---|
|  | 537 | ParseForParameter(verbose,file,"InitMaxMinStopStep", 0, 1, 1, int_type, &(config::InitMaxMinStopStep), 1, critical); | 
|---|
|  | 538 | ParseForParameter(verbose,file,"InitMaxMinGapStopStep", 0, 1, 1, int_type, &(config::InitMaxMinGapStopStep), 1, critical); | 
|---|
|  | 539 | if (config::MaxInitMinStep <= 0) config::MaxInitMinStep = config::MaxPsiStep; | 
|---|
|  | 540 | if (config::InitMaxMinStopStep < 1) config::InitMaxMinStopStep = 1; | 
|---|
|  | 541 | if (config::InitMaxMinGapStopStep < 1) config::InitMaxMinGapStopStep = 1; | 
|---|
|  | 542 |  | 
|---|
|  | 543 | // Unit cell and magnetic field | 
|---|
|  | 544 | ParseForParameter(verbose,file, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */ | 
|---|
|  | 545 | mol->cell_size[0] = BoxLength[0]; | 
|---|
|  | 546 | mol->cell_size[1] = BoxLength[3]; | 
|---|
|  | 547 | mol->cell_size[2] = BoxLength[4]; | 
|---|
|  | 548 | mol->cell_size[3] = BoxLength[6]; | 
|---|
|  | 549 | mol->cell_size[4] = BoxLength[7]; | 
|---|
|  | 550 | mol->cell_size[5] = BoxLength[8]; | 
|---|
|  | 551 | if (1) fprintf(stderr,"\n"); | 
|---|
|  | 552 |  | 
|---|
|  | 553 | ParseForParameter(verbose,file,"DoPerturbation", 0, 1, 1, int_type, &(config::DoPerturbation), 1, optional); | 
|---|
|  | 554 | ParseForParameter(verbose,file,"DoOutNICS", 0, 1, 1, int_type, &(config::DoOutNICS), 1, optional); | 
|---|
|  | 555 | if (!ParseForParameter(verbose,file,"DoFullCurrent", 0, 1, 1, int_type, &(config::DoFullCurrent), 1, optional)) | 
|---|
|  | 556 | config::DoFullCurrent = 0; | 
|---|
|  | 557 | if (config::DoFullCurrent < 0) config::DoFullCurrent = 0; | 
|---|
|  | 558 | if (config::DoFullCurrent > 2) config::DoFullCurrent = 2; | 
|---|
|  | 559 | if (config::DoOutNICS < 0) config::DoOutNICS = 0; | 
|---|
|  | 560 | if (config::DoOutNICS > 2) config::DoOutNICS = 2; | 
|---|
|  | 561 | if (config::DoPerturbation == 0) { | 
|---|
|  | 562 | config::DoFullCurrent = 0; | 
|---|
|  | 563 | config::DoOutNICS = 0; | 
|---|
|  | 564 | } | 
|---|
|  | 565 |  | 
|---|
|  | 566 | ParseForParameter(verbose,file,"ECut", 0, 1, 1, double_type, &(config::ECut), 1, critical); | 
|---|
|  | 567 | ParseForParameter(verbose,file,"MaxLevel", 0, 1, 1, int_type, &(config::MaxLevel), 1, critical); | 
|---|
|  | 568 | ParseForParameter(verbose,file,"Level0Factor", 0, 1, 1, int_type, &(config::Lev0Factor), 1, critical); | 
|---|
|  | 569 | if (config::Lev0Factor < 2) { | 
|---|
|  | 570 | config::Lev0Factor = 2; | 
|---|
|  | 571 | } | 
|---|
|  | 572 | ParseForParameter(verbose,file,"RiemannTensor", 0, 1, 1, int_type, &di, 1, critical); | 
|---|
|  | 573 | if (di >= 0 && di < 2) { | 
|---|
|  | 574 | config::RiemannTensor = di; | 
|---|
|  | 575 | } else { | 
|---|
|  | 576 | fprintf(stderr, "0 <= RiemanTensor < 2: 0 UseNotRT, 1 UseRT"); | 
|---|
|  | 577 | exit(1); | 
|---|
|  | 578 | } | 
|---|
|  | 579 | switch (config::RiemannTensor) { | 
|---|
|  | 580 | case 0: //UseNoRT | 
|---|
|  | 581 | if (config::MaxLevel < 2) { | 
|---|
|  | 582 | config::MaxLevel = 2; | 
|---|
|  | 583 | } | 
|---|
|  | 584 | config::LevRFactor = 2; | 
|---|
|  | 585 | config::RTActualUse = 0; | 
|---|
|  | 586 | break; | 
|---|
|  | 587 | case 1: // UseRT | 
|---|
|  | 588 | if (config::MaxLevel < 3) { | 
|---|
|  | 589 | config::MaxLevel = 3; | 
|---|
|  | 590 | } | 
|---|
|  | 591 | ParseForParameter(verbose,file,"RiemannLevel", 0, 1, 1, int_type, &(config::RiemannLevel), 1, critical); | 
|---|
|  | 592 | if (config::RiemannLevel < 2) { | 
|---|
|  | 593 | config::RiemannLevel = 2; | 
|---|
|  | 594 | } | 
|---|
|  | 595 | if (config::RiemannLevel > config::MaxLevel-1) { | 
|---|
|  | 596 | config::RiemannLevel = config::MaxLevel-1; | 
|---|
|  | 597 | } | 
|---|
|  | 598 | ParseForParameter(verbose,file,"LevRFactor", 0, 1, 1, int_type, &(config::LevRFactor), 1, critical); | 
|---|
|  | 599 | if (config::LevRFactor < 2) { | 
|---|
|  | 600 | config::LevRFactor = 2; | 
|---|
|  | 601 | } | 
|---|
|  | 602 | config::Lev0Factor = 2; | 
|---|
|  | 603 | config::RTActualUse = 2; | 
|---|
|  | 604 | break; | 
|---|
|  | 605 | } | 
|---|
|  | 606 | ParseForParameter(verbose,file,"PsiType", 0, 1, 1, int_type, &di, 1, critical); | 
|---|
|  | 607 | if (di >= 0 && di < 2) { | 
|---|
|  | 608 | config::PsiType = di; | 
|---|
|  | 609 | } else { | 
|---|
|  | 610 | fprintf(stderr, "0 <= PsiType < 2: 0 UseSpinDouble, 1 UseSpinUpDown"); | 
|---|
|  | 611 | exit(1); | 
|---|
|  | 612 | } | 
|---|
|  | 613 | switch (config::PsiType) { | 
|---|
|  | 614 | case 0: // SpinDouble | 
|---|
|  | 615 | ParseForParameter(verbose,file,"MaxPsiDouble", 0, 1, 1, int_type, &(config::MaxPsiDouble), 1, critical); | 
|---|
|  | 616 | ParseForParameter(verbose,file,"AddPsis", 0, 1, 1, int_type, &(config::AddPsis), 1, optional); | 
|---|
|  | 617 | break; | 
|---|
|  | 618 | case 1: // SpinUpDown | 
|---|
|  | 619 | if (config::ProcPEGamma % 2) config::ProcPEGamma*=2; | 
|---|
|  | 620 | ParseForParameter(verbose,file,"PsiMaxNoUp", 0, 1, 1, int_type, &(config::PsiMaxNoUp), 1, critical); | 
|---|
|  | 621 | ParseForParameter(verbose,file,"PsiMaxNoDown", 0, 1, 1, int_type, &(config::PsiMaxNoDown), 1, critical); | 
|---|
|  | 622 | ParseForParameter(verbose,file,"AddPsis", 0, 1, 1, int_type, &(config::AddPsis), 1, optional); | 
|---|
|  | 623 | break; | 
|---|
|  | 624 | } | 
|---|
|  | 625 |  | 
|---|
|  | 626 | // IonsInitRead | 
|---|
|  | 627 |  | 
|---|
|  | 628 | ParseForParameter(verbose,file,"RCut", 0, 1, 1, double_type, &(config::RCut), 1, critical); | 
|---|
|  | 629 | ParseForParameter(verbose,file,"IsAngstroem", 0, 1, 1, int_type, &(config::IsAngstroem), 1, critical); | 
|---|
|  | 630 | ParseForParameter(verbose,file,"MaxTypes", 0, 1, 1, int_type, &(config::MaxTypes), 1, critical); | 
|---|
|  | 631 | if (!ParseForParameter(verbose,file,"RelativeCoord", 0, 1, 1, int_type, &(config::RelativeCoord) , 1, optional)) | 
|---|
|  | 632 | config::RelativeCoord = 0; | 
|---|
|  | 633 | if (!ParseForParameter(verbose,file,"StructOpt", 0, 1, 1, int_type, &(config::StructOpt), 1, optional)) | 
|---|
|  | 634 | config::StructOpt = 0; | 
|---|
|  | 635 | for (int i=0; i < config::MaxTypes; i++) { | 
|---|
|  | 636 | sprintf(name,"Ion_Type%i",i+1); | 
|---|
|  | 637 | ParseForParameter(verbose,file, (const char*)name, 0, 1, 1, int_type, &No, 1, critical); | 
|---|
|  | 638 | ParseForParameter(verbose,file, name, 0, 2, 1, int_type, &Z, 1, critical); | 
|---|
|  | 639 | elementhash[i] = periode->FindElement(Z); | 
|---|
|  | 640 | for(int j=0;j<No;j++) { | 
|---|
|  | 641 | int repetition = 1; // which repeated keyword shall be read | 
|---|
|  | 642 | sprintf(keyword,"%s_%i",name, j+1); | 
|---|
|  | 643 | atom *neues = new atom(); | 
|---|
|  | 644 | // then parse for each atom the coordinates as often as present | 
|---|
| [62c16c] | 645 | if (!FastParsing) { | 
|---|
|  | 646 | while (ParseForParameter(verbose,file, keyword, 0, 1, 1, double_type, &neues->x.x[0], repetition, (repetition == 1) ? critical : optional) && | 
|---|
|  | 647 | ParseForParameter(verbose,file, keyword, 0, 2, 1, double_type, &neues->x.x[1], repetition, (repetition == 1) ? critical : optional) && | 
|---|
|  | 648 | ParseForParameter(verbose,file, keyword, 0, 3, 1, double_type, &neues->x.x[2], repetition, (repetition == 1) ? critical : optional)) | 
|---|
|  | 649 | repetition++; | 
|---|
|  | 650 | repetition--; | 
|---|
|  | 651 | //cout << "Found " << repetition << " times of the keyword " << keyword << "." << endl; | 
|---|
|  | 652 | } | 
|---|
| [14de469] | 653 | ParseForParameter(verbose,file, keyword, 0, 1, 1, double_type, &neues->x.x[0], repetition,critical); | 
|---|
|  | 654 | ParseForParameter(verbose,file, keyword, 0, 2, 1, double_type, &neues->x.x[1], repetition,critical); | 
|---|
|  | 655 | ParseForParameter(verbose,file, keyword, 0, 3, 1, double_type, &neues->x.x[2], repetition,critical); | 
|---|
| [943d02] | 656 | ParseForParameter(verbose,file, keyword, 0, 4, 1, int_type, &neues->FixedIon, repetition,critical); | 
|---|
|  | 657 | if(!ParseForParameter(verbose,file, keyword, 0, 5, 1, double_type, &neues->v.x[0], repetition,optional)) | 
|---|
|  | 658 | neues->v.x[0] = 0.; | 
|---|
|  | 659 | if(!ParseForParameter(verbose,file, keyword, 0, 6, 1, double_type, &neues->v.x[1], repetition,optional)) | 
|---|
|  | 660 | neues->v.x[1] = 0.; | 
|---|
| [62c16c] | 661 | if(!ParseForParameter(verbose,file, keyword, (int)FastParsing, 7, 1, double_type, &neues->v.x[2], repetition,optional)) | 
|---|
| [943d02] | 662 | neues->v.x[2] = 0.; | 
|---|
| [14de469] | 663 | neues->type = elementhash[i]; // find element type | 
|---|
|  | 664 | mol->AddAtom(neues); | 
|---|
|  | 665 | } | 
|---|
|  | 666 | } | 
|---|
| [5b15ab] | 667 | file->close(); | 
|---|
|  | 668 | delete(file); | 
|---|
| [14de469] | 669 | }; | 
|---|
|  | 670 |  | 
|---|
|  | 671 | /** Initializes config file structure by loading elements from a give file with old pcp syntax. | 
|---|
|  | 672 | * \param *file input file stream being the opened config file with old pcp syntax | 
|---|
|  | 673 | * \param *periode pointer to a periodentafel class with all elements | 
|---|
|  | 674 | * \param *mol pointer to molecule containing all atoms of the molecule | 
|---|
|  | 675 | */ | 
|---|
| [5b15ab] | 676 | void config::LoadOld(char *filename, periodentafel *periode, molecule *mol) | 
|---|
| [14de469] | 677 | { | 
|---|
| [5b15ab] | 678 | ifstream *file = new ifstream(filename); | 
|---|
|  | 679 | if (file == NULL) { | 
|---|
|  | 680 | cerr << "ERROR: config file " << filename << " missing!" << endl; | 
|---|
|  | 681 | return; | 
|---|
|  | 682 | } | 
|---|
| [b5ecd9] | 683 | RetrieveConfigPathAndName(filename); | 
|---|
| [14de469] | 684 | // ParseParameters | 
|---|
|  | 685 |  | 
|---|
|  | 686 | /* Oeffne Hauptparameterdatei */ | 
|---|
|  | 687 | int l, i, di; | 
|---|
|  | 688 | double a,b; | 
|---|
|  | 689 | double BoxLength[9]; | 
|---|
|  | 690 | string zeile; | 
|---|
|  | 691 | string dummy; | 
|---|
|  | 692 | element *elementhash[128]; | 
|---|
|  | 693 | int Z, No, AtomNo, found; | 
|---|
|  | 694 | int verbose = 0; | 
|---|
|  | 695 |  | 
|---|
|  | 696 | /* Namen einlesen */ | 
|---|
|  | 697 |  | 
|---|
|  | 698 | ParseForParameter(verbose,file, "mainname", 0, 1, 1, string_type, (config::mainname), 1, critical); | 
|---|
|  | 699 | ParseForParameter(verbose,file, "defaultpath", 0, 1, 1, string_type, (config::defaultpath), 1, critical); | 
|---|
|  | 700 | ParseForParameter(verbose,file, "pseudopotpath", 0, 1, 1, string_type, (config::pseudopotpath), 1, critical); | 
|---|
|  | 701 | ParseForParameter(verbose,file, "ProcsGammaPsi", 0, 1, 1, int_type, &(config::ProcPEGamma), 1, critical); | 
|---|
|  | 702 | ParseForParameter(verbose,file, "ProcsGammaPsi", 0, 2, 1, int_type, &(config::ProcPEPsi), 1, critical); | 
|---|
|  | 703 | config::Seed = 1; | 
|---|
|  | 704 | config::DoOutOrbitals = 0; | 
|---|
|  | 705 | ParseForParameter(verbose,file,"DoOutVis", 0, 1, 1, int_type, &(config::DoOutVis), 1, critical); | 
|---|
|  | 706 | if (config::DoOutVis < 0) config::DoOutVis = 0; | 
|---|
|  | 707 | if (config::DoOutVis > 1) config::DoOutVis = 1; | 
|---|
|  | 708 | config::VectorPlane = -1; | 
|---|
|  | 709 | config::VectorCut = 0.; | 
|---|
|  | 710 | ParseForParameter(verbose,file,"DoOutMes", 0, 1, 1, int_type, &(config::DoOutMes), 1, critical); | 
|---|
|  | 711 | if (config::DoOutMes < 0) config::DoOutMes = 0; | 
|---|
|  | 712 | if (config::DoOutMes > 1) config::DoOutMes = 1; | 
|---|
|  | 713 | config::DoOutCurrent = 0; | 
|---|
|  | 714 | ParseForParameter(verbose,file,"AddGramSch", 0, 1, 1, int_type, &(config::UseAddGramSch), 1, critical); | 
|---|
|  | 715 | if (config::UseAddGramSch < 0) config::UseAddGramSch = 0; | 
|---|
|  | 716 | if (config::UseAddGramSch > 2) config::UseAddGramSch = 2; | 
|---|
|  | 717 | config::CommonWannier = 0; | 
|---|
|  | 718 | config::SawtoothStart = 0.01; | 
|---|
|  | 719 |  | 
|---|
|  | 720 | ParseForParameter(verbose,file,"MaxOuterStep", 0, 1, 1, double_type, &(config::MaxOuterStep), 1, critical); | 
|---|
|  | 721 | ParseForParameter(verbose,file,"Deltat", 0, 1, 1, double_type, &(config::Deltat), 1, optional); | 
|---|
|  | 722 | ParseForParameter(verbose,file,"VisOuterStep", 0, 1, 1, int_type, &(config::OutVisStep), 1, optional); | 
|---|
|  | 723 | ParseForParameter(verbose,file,"VisSrcOuterStep", 0, 1, 1, int_type, &(config::OutSrcStep), 1, optional); | 
|---|
|  | 724 | ParseForParameter(verbose,file,"TargetTemp", 0, 1, 1, double_type, &(config::TargetTemp), 1, optional); | 
|---|
|  | 725 | ParseForParameter(verbose,file,"ScaleTempStep", 0, 1, 1, int_type, &(config::ScaleTempStep), 1, optional); | 
|---|
|  | 726 | config::EpsWannier = 1e-8; | 
|---|
|  | 727 |  | 
|---|
|  | 728 | // stop conditions | 
|---|
|  | 729 | //if (config::MaxOuterStep <= 0) config::MaxOuterStep = 1; | 
|---|
|  | 730 | ParseForParameter(verbose,file,"MaxPsiStep", 0, 1, 1, int_type, &(config::MaxPsiStep), 1, critical); | 
|---|
|  | 731 | if (config::MaxPsiStep <= 0) config::MaxPsiStep = 3; | 
|---|
|  | 732 |  | 
|---|
|  | 733 | ParseForParameter(verbose,file,"MaxMinStep", 0, 1, 1, int_type, &(config::MaxMinStep), 1, critical); | 
|---|
|  | 734 | ParseForParameter(verbose,file,"MaxMinStep", 0, 2, 1, double_type, &(config::RelEpsTotalEnergy), 1, critical); | 
|---|
|  | 735 | ParseForParameter(verbose,file,"MaxMinStep", 0, 3, 1, double_type, &(config::RelEpsKineticEnergy), 1, critical); | 
|---|
|  | 736 | ParseForParameter(verbose,file,"MaxMinStep", 0, 4, 1, int_type, &(config::MaxMinStopStep), 1, critical); | 
|---|
|  | 737 | if (config::MaxMinStep <= 0) config::MaxMinStep = config::MaxPsiStep; | 
|---|
|  | 738 | if (config::MaxMinStopStep < 1) config::MaxMinStopStep = 1; | 
|---|
|  | 739 | config::MaxMinGapStopStep = 1; | 
|---|
|  | 740 |  | 
|---|
|  | 741 | ParseForParameter(verbose,file,"MaxInitMinStep", 0, 1, 1, int_type, &(config::MaxInitMinStep), 1, critical); | 
|---|
|  | 742 | ParseForParameter(verbose,file,"MaxInitMinStep", 0, 2, 1, double_type, &(config::InitRelEpsTotalEnergy), 1, critical); | 
|---|
|  | 743 | ParseForParameter(verbose,file,"MaxInitMinStep", 0, 3, 1, double_type, &(config::InitRelEpsKineticEnergy), 1, critical); | 
|---|
|  | 744 | ParseForParameter(verbose,file,"MaxInitMinStep", 0, 4, 1, int_type, &(config::InitMaxMinStopStep), 1, critical); | 
|---|
|  | 745 | if (config::MaxInitMinStep <= 0) config::MaxInitMinStep = config::MaxPsiStep; | 
|---|
|  | 746 | if (config::InitMaxMinStopStep < 1) config::InitMaxMinStopStep = 1; | 
|---|
|  | 747 | config::InitMaxMinGapStopStep = 1; | 
|---|
|  | 748 |  | 
|---|
|  | 749 | ParseForParameter(verbose,file, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */ | 
|---|
|  | 750 | mol->cell_size[0] = BoxLength[0]; | 
|---|
|  | 751 | mol->cell_size[1] = BoxLength[3]; | 
|---|
|  | 752 | mol->cell_size[2] = BoxLength[4]; | 
|---|
|  | 753 | mol->cell_size[3] = BoxLength[6]; | 
|---|
|  | 754 | mol->cell_size[4] = BoxLength[7]; | 
|---|
|  | 755 | mol->cell_size[5] = BoxLength[8]; | 
|---|
|  | 756 | if (1) fprintf(stderr,"\n"); | 
|---|
|  | 757 | config::DoPerturbation = 0; | 
|---|
|  | 758 | config::DoFullCurrent = 0; | 
|---|
|  | 759 |  | 
|---|
|  | 760 | ParseForParameter(verbose,file,"ECut", 0, 1, 1, double_type, &(config::ECut), 1, critical); | 
|---|
|  | 761 | ParseForParameter(verbose,file,"MaxLevel", 0, 1, 1, int_type, &(config::MaxLevel), 1, critical); | 
|---|
|  | 762 | ParseForParameter(verbose,file,"Level0Factor", 0, 1, 1, int_type, &(config::Lev0Factor), 1, critical); | 
|---|
|  | 763 | if (config::Lev0Factor < 2) { | 
|---|
|  | 764 | config::Lev0Factor = 2; | 
|---|
|  | 765 | } | 
|---|
|  | 766 | ParseForParameter(verbose,file,"RiemannTensor", 0, 1, 1, int_type, &di, 1, critical); | 
|---|
|  | 767 | if (di >= 0 && di < 2) { | 
|---|
|  | 768 | config::RiemannTensor = di; | 
|---|
|  | 769 | } else { | 
|---|
|  | 770 | fprintf(stderr, "0 <= RiemanTensor < 2: 0 UseNotRT, 1 UseRT"); | 
|---|
|  | 771 | exit(1); | 
|---|
|  | 772 | } | 
|---|
|  | 773 | switch (config::RiemannTensor) { | 
|---|
|  | 774 | case 0: //UseNoRT | 
|---|
|  | 775 | if (config::MaxLevel < 2) { | 
|---|
|  | 776 | config::MaxLevel = 2; | 
|---|
|  | 777 | } | 
|---|
|  | 778 | config::LevRFactor = 2; | 
|---|
|  | 779 | config::RTActualUse = 0; | 
|---|
|  | 780 | break; | 
|---|
|  | 781 | case 1: // UseRT | 
|---|
|  | 782 | if (config::MaxLevel < 3) { | 
|---|
|  | 783 | config::MaxLevel = 3; | 
|---|
|  | 784 | } | 
|---|
|  | 785 | ParseForParameter(verbose,file,"RiemannLevel", 0, 1, 1, int_type, &(config::RiemannLevel), 1, critical); | 
|---|
|  | 786 | if (config::RiemannLevel < 2) { | 
|---|
|  | 787 | config::RiemannLevel = 2; | 
|---|
|  | 788 | } | 
|---|
|  | 789 | if (config::RiemannLevel > config::MaxLevel-1) { | 
|---|
|  | 790 | config::RiemannLevel = config::MaxLevel-1; | 
|---|
|  | 791 | } | 
|---|
|  | 792 | ParseForParameter(verbose,file,"LevRFactor", 0, 1, 1, int_type, &(config::LevRFactor), 1, critical); | 
|---|
|  | 793 | if (config::LevRFactor < 2) { | 
|---|
|  | 794 | config::LevRFactor = 2; | 
|---|
|  | 795 | } | 
|---|
|  | 796 | config::Lev0Factor = 2; | 
|---|
|  | 797 | config::RTActualUse = 2; | 
|---|
|  | 798 | break; | 
|---|
|  | 799 | } | 
|---|
|  | 800 | ParseForParameter(verbose,file,"PsiType", 0, 1, 1, int_type, &di, 1, critical); | 
|---|
|  | 801 | if (di >= 0 && di < 2) { | 
|---|
|  | 802 | config::PsiType = di; | 
|---|
|  | 803 | } else { | 
|---|
|  | 804 | fprintf(stderr, "0 <= PsiType < 2: 0 UseSpinDouble, 1 UseSpinUpDown"); | 
|---|
|  | 805 | exit(1); | 
|---|
|  | 806 | } | 
|---|
|  | 807 | switch (config::PsiType) { | 
|---|
|  | 808 | case 0: // SpinDouble | 
|---|
|  | 809 | ParseForParameter(verbose,file,"MaxPsiDouble", 0, 1, 1, int_type, &(config::MaxPsiDouble), 1, critical); | 
|---|
|  | 810 | config::AddPsis = 0; | 
|---|
|  | 811 | break; | 
|---|
|  | 812 | case 1: // SpinUpDown | 
|---|
|  | 813 | if (config::ProcPEGamma % 2) config::ProcPEGamma*=2; | 
|---|
|  | 814 | ParseForParameter(verbose,file,"MaxPsiUp", 0, 1, 1, int_type, &(config::PsiMaxNoUp), 1, critical); | 
|---|
|  | 815 | ParseForParameter(verbose,file,"MaxPsiDown", 0, 1, 1, int_type, &(config::PsiMaxNoDown), 1, critical); | 
|---|
|  | 816 | config::AddPsis = 0; | 
|---|
|  | 817 | break; | 
|---|
|  | 818 | } | 
|---|
|  | 819 |  | 
|---|
|  | 820 | // IonsInitRead | 
|---|
|  | 821 |  | 
|---|
|  | 822 | ParseForParameter(verbose,file,"RCut", 0, 1, 1, double_type, &(config::RCut), 1, critical); | 
|---|
|  | 823 | ParseForParameter(verbose,file,"IsAngstroem", 0, 1, 1, int_type, &(config::IsAngstroem), 1, critical); | 
|---|
|  | 824 | config::RelativeCoord = 0; | 
|---|
|  | 825 | config::StructOpt = 0; | 
|---|
|  | 826 |  | 
|---|
|  | 827 | // Routine from builder.cpp | 
|---|
|  | 828 |  | 
|---|
|  | 829 |  | 
|---|
| [7f3b9d] | 830 | for (i=MAX_ELEMENTS;i--;) | 
|---|
|  | 831 | elementhash[i] = NULL; | 
|---|
| [14de469] | 832 | cout << Verbose(0) << "Parsing Ions ..." << endl; | 
|---|
|  | 833 | No=0; | 
|---|
|  | 834 | found = 0; | 
|---|
|  | 835 | while (getline(*file,zeile,'\n')) { | 
|---|
|  | 836 | if (zeile.find("Ions_Data") == 0) { | 
|---|
|  | 837 | cout << Verbose(1) << "found Ions_Data...begin parsing" << endl; | 
|---|
|  | 838 | found ++; | 
|---|
|  | 839 | } | 
|---|
|  | 840 | if (found > 0) { | 
|---|
|  | 841 | if (zeile.find("Ions_Data") == 0) | 
|---|
|  | 842 | getline(*file,zeile,'\n'); // read next line and parse this one | 
|---|
|  | 843 | istringstream input(zeile); | 
|---|
|  | 844 | input >> AtomNo;  // number of atoms | 
|---|
|  | 845 | input >> Z;       // atomic number | 
|---|
|  | 846 | input >> a; | 
|---|
|  | 847 | input >> l; | 
|---|
|  | 848 | input >> l; | 
|---|
|  | 849 | input >> b;     // element mass | 
|---|
|  | 850 | elementhash[No] = periode->FindElement(Z); | 
|---|
|  | 851 | cout << Verbose(1) << "AtomNo: " << AtomNo << "\tZ: " << Z << "\ta:" << a << "\tl:"  << l << "\b:" << b << "\tElement:" << elementhash[No] << "\t:" << endl; | 
|---|
|  | 852 | for(i=0;i<AtomNo;i++) { | 
|---|
|  | 853 | if (!getline(*file,zeile,'\n')) {// parse on and on | 
|---|
|  | 854 | cout << Verbose(2) << "Error: Too few items in ionic list of element" << elementhash[No] << "." << endl << "Exiting." << endl; | 
|---|
|  | 855 | // return 1; | 
|---|
|  | 856 | } else { | 
|---|
|  | 857 | //cout << Verbose(2) << "Reading line: " << zeile << endl; | 
|---|
|  | 858 | } | 
|---|
|  | 859 | istringstream input2(zeile); | 
|---|
|  | 860 | atom *neues = new atom(); | 
|---|
|  | 861 | input2 >> neues->x.x[0]; // x | 
|---|
|  | 862 | input2 >> neues->x.x[1]; // y | 
|---|
|  | 863 | input2 >> neues->x.x[2]; // z | 
|---|
|  | 864 | input2 >> l; | 
|---|
|  | 865 | neues->type = elementhash[No]; // find element type | 
|---|
|  | 866 | mol->AddAtom(neues); | 
|---|
|  | 867 | } | 
|---|
|  | 868 | No++; | 
|---|
|  | 869 | } | 
|---|
|  | 870 | } | 
|---|
| [5b15ab] | 871 | file->close(); | 
|---|
|  | 872 | delete(file); | 
|---|
| [14de469] | 873 | }; | 
|---|
|  | 874 |  | 
|---|
|  | 875 | /** Stores all elements of config structure from which they can be re-read. | 
|---|
|  | 876 | * \param output open output *file stream to write to | 
|---|
|  | 877 | * \param *periode pointer to a periodentafel class with all elements | 
|---|
|  | 878 | * \param *mol pointer to molecule containing all atoms of the molecule | 
|---|
|  | 879 | */ | 
|---|
|  | 880 | bool config::Save(ofstream *output, periodentafel *periode, molecule *mol) const | 
|---|
|  | 881 | { | 
|---|
|  | 882 | bool result = true; | 
|---|
|  | 883 | // bring MaxTypes up to date | 
|---|
|  | 884 | mol->CountElements(); | 
|---|
|  | 885 | if (output != NULL) { | 
|---|
|  | 886 | *output << "# ParallelCarParinello - main configuration file - created with molecuilder" << endl; | 
|---|
|  | 887 | *output << endl; | 
|---|
|  | 888 | *output << "mainname\t" << config::mainname << "\t# programm name (for runtime files)" << endl; | 
|---|
|  | 889 | *output << "defaultpath\t" << config::defaultpath << "\t# where to put files during runtime" << endl; | 
|---|
|  | 890 | *output << "pseudopotpath\t" << config::pseudopotpath << "\t# where to find pseudopotentials" << endl; | 
|---|
|  | 891 | *output << endl; | 
|---|
|  | 892 | *output << "ProcPEGamma\t" << config::ProcPEGamma << "\t# for parallel computing: share constants" << endl; | 
|---|
|  | 893 | *output << "ProcPEPsi\t" << config::ProcPEPsi << "\t# for parallel computing: share wave functions" << endl; | 
|---|
|  | 894 | *output << "DoOutVis\t" << config::DoOutVis << "\t# Output data for OpenDX" << endl; | 
|---|
|  | 895 | *output << "DoOutMes\t" << config::DoOutMes << "\t# Output data for measurements" << endl; | 
|---|
|  | 896 | *output << "DoOutOrbitals\t" << config::DoOutOrbitals << "\t# Output all Orbitals" << endl; | 
|---|
|  | 897 | *output << "DoOutCurr\t" << config::DoOutCurrent << "\t# Ouput current density for OpenDx" << endl; | 
|---|
|  | 898 | *output << "DoOutNICS\t" << config::DoOutNICS << "\t# Output Nucleus independent current shieldings" << endl; | 
|---|
|  | 899 | *output << "DoPerturbation\t" << config::DoPerturbation << "\t# Do perturbation calculate and determine susceptibility and shielding" << endl; | 
|---|
|  | 900 | *output << "DoFullCurrent\t" << config::DoFullCurrent << "\t# Do full perturbation" << endl; | 
|---|
|  | 901 | *output << "CommonWannier\t" << config::CommonWannier << "\t# Put virtual centers at indivual orbits, all common, merged by variance, to grid point, to cell center" << endl; | 
|---|
|  | 902 | *output << "SawtoothStart\t" << config::SawtoothStart << "\t# Absolute value for smooth transition at cell border " << endl; | 
|---|
|  | 903 | *output << "VectorPlane\t" << config::VectorPlane << "\t# Cut plane axis (x, y or z: 0,1,2) for two-dim current vector plot" << endl; | 
|---|
|  | 904 | *output << "VectorCut\t" << config::VectorCut << "\t# Cut plane axis value" << endl; | 
|---|
|  | 905 | *output << "AddGramSch\t" << config::UseAddGramSch << "\t# Additional GramSchmidtOrtogonalization to be safe" << endl; | 
|---|
|  | 906 | *output << "Seed\t\t" << config::Seed << "\t# initial value for random seed for Psi coefficients" << endl; | 
|---|
|  | 907 | *output << endl; | 
|---|
|  | 908 | *output << "MaxOuterStep\t" << config::MaxOuterStep << "\t# number of MolecularDynamics/Structure optimization steps" << endl; | 
|---|
|  | 909 | *output << "Deltat\t" << config::Deltat << "\t# time per MD step" << endl; | 
|---|
|  | 910 | *output << "OutVisStep\t" << config::OutVisStep << "\t# Output visual data every ...th step" << endl; | 
|---|
|  | 911 | *output << "OutSrcStep\t" << config::OutSrcStep << "\t# Output \"restart\" data every ..th step" << endl; | 
|---|
|  | 912 | *output << "TargetTemp\t" << config::TargetTemp << "\t# Target temperature" << endl; | 
|---|
|  | 913 | *output << "MaxPsiStep\t" << config::MaxPsiStep << "\t# number of Minimisation steps per state (0 - default)" << endl; | 
|---|
|  | 914 | *output << "EpsWannier\t" << config::EpsWannier << "\t# tolerance value for spread minimisation of orbitals" << endl; | 
|---|
|  | 915 | *output << endl; | 
|---|
|  | 916 | *output << "# Values specifying when to stop" << endl; | 
|---|
|  | 917 | *output << "MaxMinStep\t" << config::MaxMinStep << "\t# Maximum number of steps" << endl; | 
|---|
|  | 918 | *output << "RelEpsTotalE\t" << config::RelEpsTotalEnergy << "\t# relative change in total energy" << endl; | 
|---|
|  | 919 | *output << "RelEpsKineticE\t" << config::RelEpsKineticEnergy << "\t# relative change in kinetic energy" << endl; | 
|---|
|  | 920 | *output << "MaxMinStopStep\t" << config::MaxMinStopStep << "\t# check every ..th steps" << endl; | 
|---|
|  | 921 | *output << "MaxMinGapStopStep\t" << config::MaxMinGapStopStep << "\t# check every ..th steps" << endl; | 
|---|
|  | 922 | *output << endl; | 
|---|
|  | 923 | *output << "# Values specifying when to stop for INIT, otherwise same as above" << endl; | 
|---|
|  | 924 | *output << "MaxInitMinStep\t" << config::MaxInitMinStep << "\t# Maximum number of steps" << endl; | 
|---|
|  | 925 | *output << "InitRelEpsTotalE\t" << config::InitRelEpsTotalEnergy << "\t# relative change in total energy" << endl; | 
|---|
|  | 926 | *output << "InitRelEpsKineticE\t" << config::InitRelEpsKineticEnergy << "\t# relative change in kinetic energy" << endl; | 
|---|
|  | 927 | *output << "InitMaxMinStopStep\t" << config::InitMaxMinStopStep << "\t# check every ..th steps" << endl; | 
|---|
|  | 928 | *output << "InitMaxMinGapStopStep\t" << config::InitMaxMinGapStopStep << "\t# check every ..th steps" << endl; | 
|---|
|  | 929 | *output << endl; | 
|---|
|  | 930 | *output << "BoxLength\t\t\t# (Length of a unit cell)" << endl; | 
|---|
|  | 931 | *output << mol->cell_size[0] << "\t" << endl; | 
|---|
|  | 932 | *output << mol->cell_size[1] << "\t" << mol->cell_size[2] << "\t" << endl; | 
|---|
|  | 933 | *output << mol->cell_size[3] << "\t" << mol->cell_size[4] << "\t" << mol->cell_size[5] << "\t" << endl; | 
|---|
|  | 934 | // FIXME | 
|---|
|  | 935 | *output << endl; | 
|---|
|  | 936 | *output << "ECut\t\t" << config::ECut << "\t# energy cutoff for discretization in Hartrees" << endl; | 
|---|
|  | 937 | *output << "MaxLevel\t" << config::MaxLevel << "\t# number of different levels in the code, >=2" << endl; | 
|---|
|  | 938 | *output << "Level0Factor\t" << config::Lev0Factor << "\t# factor by which node number increases from S to 0 level" << endl; | 
|---|
|  | 939 | *output << "RiemannTensor\t" << config::RiemannTensor << "\t# (Use metric)" << endl; | 
|---|
|  | 940 | switch (config::RiemannTensor) { | 
|---|
|  | 941 | case 0: //UseNoRT | 
|---|
|  | 942 | break; | 
|---|
|  | 943 | case 1: // UseRT | 
|---|
|  | 944 | *output << "RiemannLevel\t" << config::RiemannLevel << "\t# Number of Riemann Levels" << endl; | 
|---|
|  | 945 | *output << "LevRFactor\t" << config::LevRFactor << "\t# factor by which node number increases from 0 to R level from" << endl; | 
|---|
|  | 946 | break; | 
|---|
|  | 947 | } | 
|---|
|  | 948 | *output << "PsiType\t\t" << config::PsiType << "\t# 0 - doubly occupied, 1 - SpinUp,SpinDown" << endl; | 
|---|
|  | 949 | // write out both types for easier changing afterwards | 
|---|
|  | 950 | //  switch (PsiType) { | 
|---|
|  | 951 | //    case 0: | 
|---|
|  | 952 | *output << "MaxPsiDouble\t" << config::MaxPsiDouble << "\t# here: specifying both maximum number of SpinUp- and -Down-states" << endl; | 
|---|
|  | 953 | //      break; | 
|---|
|  | 954 | //    case 1: | 
|---|
|  | 955 | *output << "PsiMaxNoUp\t" << config::PsiMaxNoUp << "\t# here: specifying maximum number of SpinUp-states" << endl; | 
|---|
|  | 956 | *output << "PsiMaxNoDown\t" << config::PsiMaxNoDown << "\t# here: specifying maximum number of SpinDown-states" << endl; | 
|---|
|  | 957 | //      break; | 
|---|
|  | 958 | //  } | 
|---|
|  | 959 | *output << "AddPsis\t\t" << config::AddPsis << "\t# Additional unoccupied Psis for bandgap determination" << endl; | 
|---|
|  | 960 | *output << endl; | 
|---|
|  | 961 | *output << "RCut\t\t" << config::RCut << "\t# R-cut for the ewald summation" << endl; | 
|---|
|  | 962 | *output << "StructOpt\t" << config::StructOpt << "\t# Do structure optimization beforehand" << endl; | 
|---|
|  | 963 | *output << "IsAngstroem\t" << config::IsAngstroem << "\t# 0 - Bohr, 1 - Angstroem" << endl; | 
|---|
|  | 964 | *output << "RelativeCoord\t" << config::RelativeCoord << "\t# whether ion coordinates are relative (1) or absolute (0)" << endl; | 
|---|
|  | 965 | *output << "MaxTypes\t" << mol->ElementCount <<  "\t# maximum number of different ion types" << endl; | 
|---|
|  | 966 | *output << endl; | 
|---|
|  | 967 | result = result && mol->Checkout(output); | 
|---|
|  | 968 | result = result && mol->Output(output); | 
|---|
|  | 969 | return result; | 
|---|
|  | 970 | } else | 
|---|
|  | 971 | return false; | 
|---|
|  | 972 | }; | 
|---|
|  | 973 |  | 
|---|
|  | 974 | /** Reads parameter from a parsed file. | 
|---|
|  | 975 | * The file is either parsed for a certain keyword or if null is given for | 
|---|
|  | 976 | * the value in row yth and column xth. If the keyword was necessity#critical, | 
|---|
|  | 977 | * then an error is thrown and the programme aborted. | 
|---|
|  | 978 | * \warning value is modified (both in contents and position)! | 
|---|
|  | 979 | * \param verbose 1 - print found value to stderr, 0 - don't | 
|---|
|  | 980 | * \param file file to be parsed | 
|---|
|  | 981 | * \param name Name of value in file (at least 3 chars!) | 
|---|
|  | 982 | * \param sequential 1 - do not reset file pointer to begin of file, 0 - set to beginning | 
|---|
|  | 983 | *        (if file is sequentially parsed this can be way faster! However, beware of multiple values per line, as whole line is read - | 
|---|
|  | 984 | *         best approach: 0 0 0 1 (not resetted only on last value of line) - and of yth, which is now | 
|---|
|  | 985 | *         counted from this unresetted position!) | 
|---|
|  | 986 | * \param xth Which among a number of parameters it is (in grid case it's row number as grid is read as a whole!) | 
|---|
|  | 987 | * \param yth In grid case specifying column number, otherwise the yth \a name matching line | 
|---|
|  | 988 | * \param type Type of the Parameter to be read | 
|---|
|  | 989 | * \param value address of the value to be read (must have been allocated) | 
|---|
|  | 990 | * \param repetition determines, if the keyword appears multiply in the config file, which repetition shall be parsed, i.e. 1 if not multiply | 
|---|
|  | 991 | * \param critical necessity of this keyword being specified (optional, critical) | 
|---|
|  | 992 | * \return 1 - found, 0 - not found | 
|---|
|  | 993 | * \note Routine is taken from the pcp project and hack-a-slack adapted to C++ | 
|---|
|  | 994 | */ | 
|---|
|  | 995 | int config::ParseForParameter(int verbose, ifstream *file, const char *name, int sequential, int const xth, int const yth, int type, void *value, int repetition, int critical) { | 
|---|
|  | 996 | int i,j;  // loop variables | 
|---|
|  | 997 | int length = 0, maxlength = -1; | 
|---|
|  | 998 | long file_position = file->tellg(); // mark current position | 
|---|
|  | 999 | char *dummy1, *dummy, *free_dummy;    // pointers in the line that is read in per step | 
|---|
|  | 1000 | dummy1 = free_dummy = (char *) Malloc(256 * sizeof(char), "config::ParseForParameter: *free_dummy"); | 
|---|
|  | 1001 |  | 
|---|
|  | 1002 | //fprintf(stderr,"Parsing for %s\n",name); | 
|---|
|  | 1003 | if (repetition == 0) | 
|---|
|  | 1004 | //Error(SomeError, "ParseForParameter(): argument repetition must not be 0!"); | 
|---|
|  | 1005 | return 0; | 
|---|
|  | 1006 |  | 
|---|
|  | 1007 | int line = 0; // marks line where parameter was found | 
|---|
|  | 1008 | int found = (type >= grid) ? 0 : (-yth + 1);  // marks if yth parameter name was found | 
|---|
|  | 1009 | while((found != repetition)) { | 
|---|
|  | 1010 | dummy1 = dummy = free_dummy; | 
|---|
|  | 1011 | do { | 
|---|
|  | 1012 | file->getline(dummy1, 256); // Read the whole line | 
|---|
|  | 1013 | if (file->eof()) { | 
|---|
|  | 1014 | if ((critical) && (found == 0)) { | 
|---|
|  | 1015 | Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy"); | 
|---|
|  | 1016 | //Error(InitReading, name); | 
|---|
|  | 1017 | fprintf(stderr,"Error:InitReading, critical %s not found\n", name); | 
|---|
|  | 1018 | exit(255); | 
|---|
|  | 1019 | } else { | 
|---|
|  | 1020 | //if (!sequential) | 
|---|
|  | 1021 | file->clear(); | 
|---|
|  | 1022 | file->seekg(file_position, ios::beg);  // rewind to start position | 
|---|
|  | 1023 | Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy"); | 
|---|
|  | 1024 | return 0; | 
|---|
|  | 1025 | } | 
|---|
|  | 1026 | } | 
|---|
|  | 1027 | line++; | 
|---|
|  | 1028 | } while (((dummy1[0] == '#') || (dummy1[0] == '\n')) && dummy != NULL); // skip commentary and empty lines | 
|---|
|  | 1029 |  | 
|---|
|  | 1030 | // C++ getline removes newline at end, thus re-add | 
|---|
|  | 1031 | if ((dummy1 != NULL) && (strchr(dummy1,'\n') == NULL)) { | 
|---|
|  | 1032 | i = strlen(dummy1); | 
|---|
|  | 1033 | dummy1[i] = '\n'; | 
|---|
|  | 1034 | dummy1[i+1] = '\0'; | 
|---|
|  | 1035 | } | 
|---|
|  | 1036 | //fprintf(stderr,"line ends at %i, newline at %i\n", strlen(dummy1), strchr(dummy1,'\n')-free_dummy); | 
|---|
|  | 1037 | if (dummy1 == NULL) { | 
|---|
|  | 1038 | if (verbose) fprintf(stderr,"Error reading line %i\n",line); | 
|---|
|  | 1039 | } else { | 
|---|
|  | 1040 | //fprintf(stderr,"Reading next line %i: %s\n", line, dummy1); | 
|---|
|  | 1041 | } | 
|---|
|  | 1042 | // Seek for possible end of keyword on line if given ... | 
|---|
|  | 1043 | if (name != NULL) { | 
|---|
|  | 1044 | dummy = strchr(dummy1,'\t');  // set dummy on first tab or space which ever's nearer | 
|---|
|  | 1045 | if (dummy == NULL) { | 
|---|
|  | 1046 | dummy = strchr(dummy1, ' ');  // if not found seek for space | 
|---|
|  | 1047 | while ((dummy != NULL) && ((*dummy == '\t') || (*dummy == ' ')))    // skip some more tabs and spaces if necessary | 
|---|
|  | 1048 | dummy++; | 
|---|
|  | 1049 | } | 
|---|
|  | 1050 | if (dummy == NULL) { | 
|---|
|  | 1051 | dummy = strchr(dummy1, '\n'); // set on line end then (whole line = keyword) | 
|---|
|  | 1052 | //fprintf(stderr,"Error: Cannot find tabs or spaces on line %i in search for %s\n", line, name); | 
|---|
|  | 1053 | //Free((void **)&free_dummy); | 
|---|
|  | 1054 | //Error(FileOpenParams, NULL); | 
|---|
|  | 1055 | } else { | 
|---|
|  | 1056 | //fprintf(stderr,"found tab at %i\n",(char *)dummy-(char *)dummy1); | 
|---|
|  | 1057 | } | 
|---|
|  | 1058 | } else dummy = dummy1; | 
|---|
|  | 1059 | // ... and check if it is the keyword! | 
|---|
|  | 1060 | //fprintf(stderr,"name %p, dummy %i/%c, dummy1 %i/%c, strlen(name) %i\n", &name, dummy, *dummy, dummy1, *dummy1, strlen(name)); | 
|---|
|  | 1061 | if ((name == NULL) || ((dummy-dummy1 >= 3) && (strncmp(dummy1, name, strlen(name)) == 0)) && ((unsigned int)(dummy-dummy1) == strlen(name))) { | 
|---|
|  | 1062 | found++; // found the parameter! | 
|---|
|  | 1063 | //fprintf(stderr,"found %s at line %i between %i and %i\n", name, line, dummy1, dummy); | 
|---|
|  | 1064 |  | 
|---|
|  | 1065 | if (found == repetition) { | 
|---|
|  | 1066 | for (i=0;i<xth;i++) { // i = rows | 
|---|
|  | 1067 | if (type >= grid) { | 
|---|
|  | 1068 | // grid structure means that grid starts on the next line, not right after keyword | 
|---|
|  | 1069 | dummy1 = dummy = free_dummy; | 
|---|
|  | 1070 | do { | 
|---|
|  | 1071 | file->getline(dummy1, 256); // Read the whole line, skip commentary and empty ones | 
|---|
|  | 1072 | if (file->eof()) { | 
|---|
|  | 1073 | if ((critical) && (found == 0)) { | 
|---|
|  | 1074 | Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy"); | 
|---|
|  | 1075 | //Error(InitReading, name); | 
|---|
|  | 1076 | fprintf(stderr,"Error:InitReading, critical %s not found\n", name); | 
|---|
|  | 1077 | exit(255); | 
|---|
|  | 1078 | } else { | 
|---|
|  | 1079 | //if (!sequential) | 
|---|
|  | 1080 | file->clear(); | 
|---|
|  | 1081 | file->seekg(file_position, ios::beg);  // rewind to start position | 
|---|
|  | 1082 | Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy"); | 
|---|
|  | 1083 | return 0; | 
|---|
|  | 1084 | } | 
|---|
|  | 1085 | } | 
|---|
|  | 1086 | line++; | 
|---|
|  | 1087 | } while ((dummy1[0] == '#') || (dummy1[0] == '\n')); | 
|---|
|  | 1088 | if (dummy1 == NULL){ | 
|---|
|  | 1089 | if (verbose) fprintf(stderr,"Error reading line %i\n", line); | 
|---|
|  | 1090 | } else { | 
|---|
|  | 1091 | //fprintf(stderr,"Reading next line %i: %s\n", line, dummy1); | 
|---|
|  | 1092 | } | 
|---|
|  | 1093 | } else { // simple int, strings or doubles start in the same line | 
|---|
|  | 1094 | while ((*dummy == '\t') || (*dummy == ' '))   // skip interjacent tabs and spaces | 
|---|
|  | 1095 | dummy++; | 
|---|
|  | 1096 | } | 
|---|
|  | 1097 | // C++ getline removes newline at end, thus re-add | 
|---|
|  | 1098 | if ((dummy1 != NULL) && (strchr(dummy1,'\n') == NULL)) { | 
|---|
|  | 1099 | j = strlen(dummy1); | 
|---|
|  | 1100 | dummy1[j] = '\n'; | 
|---|
|  | 1101 | dummy1[j+1] = '\0'; | 
|---|
|  | 1102 | } | 
|---|
|  | 1103 |  | 
|---|
|  | 1104 | int start = (type >= grid) ? 0 : yth-1 ; | 
|---|
|  | 1105 | for (j=start;j<yth;j++) { // j = columns | 
|---|
|  | 1106 | // check for lower triangular area and upper triangular area | 
|---|
|  | 1107 | if ( ((i > j) && (type == upper_trigrid)) || ((j > i) && (type == lower_trigrid))) { | 
|---|
|  | 1108 | *((double *)value) = 0.0; | 
|---|
|  | 1109 | fprintf(stderr,"%f\t",*((double *)value)); | 
|---|
|  | 1110 | value = (void *)((long)value + sizeof(double)); | 
|---|
|  | 1111 | //value += sizeof(double); | 
|---|
|  | 1112 | } else { | 
|---|
|  | 1113 | // otherwise we must skip all interjacent tabs and spaces and find next value | 
|---|
|  | 1114 | dummy1 = dummy; | 
|---|
|  | 1115 | dummy = strchr(dummy1, '\t'); // seek for tab or space | 
|---|
|  | 1116 | if (dummy == NULL) { | 
|---|
|  | 1117 | dummy = strchr(dummy1, ' ');  // if not found seek for space | 
|---|
|  | 1118 | while ((dummy != NULL) && ((*dummy == '\t') || (*dummy == ' ')))    // skip some more tabs and spaces if necessary | 
|---|
|  | 1119 | dummy++; | 
|---|
|  | 1120 | } | 
|---|
|  | 1121 | /*              while ((dummy != NULL) && ((*dummy == '\t') || (*dummy == ' ')))    // skip some more tabs and spaces if necessary | 
|---|
|  | 1122 | dummy++;*/ | 
|---|
|  | 1123 | if (dummy == NULL) { // if still zero returned ... | 
|---|
|  | 1124 | dummy = strchr(dummy1, '\n');  // ... at line end then | 
|---|
|  | 1125 | if ((j < yth-1) && (type < 4)) {  // check if xth value or not yet | 
|---|
|  | 1126 | if (critical) { | 
|---|
|  | 1127 | if (verbose) fprintf(stderr,"Error: EoL at %i and still missing %i value(s) for parameter %s\n", line, yth-j, name); | 
|---|
|  | 1128 | Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy"); | 
|---|
|  | 1129 | //return 0; | 
|---|
|  | 1130 | exit(255); | 
|---|
|  | 1131 | //Error(FileOpenParams, NULL); | 
|---|
|  | 1132 | } else { | 
|---|
|  | 1133 | //if (!sequential) | 
|---|
|  | 1134 | file->clear(); | 
|---|
|  | 1135 | file->seekg(file_position, ios::beg);  // rewind to start position | 
|---|
|  | 1136 | Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy"); | 
|---|
|  | 1137 | return 0; | 
|---|
|  | 1138 | } | 
|---|
|  | 1139 | } | 
|---|
|  | 1140 | } else { | 
|---|
|  | 1141 | //fprintf(stderr,"found tab at %i\n",(char *)dummy-(char *)free_dummy); | 
|---|
|  | 1142 | } | 
|---|
|  | 1143 | //fprintf(stderr,"value from %i to %i\n",(char *)dummy1-(char *)free_dummy,(char *)dummy-(char *)free_dummy); | 
|---|
|  | 1144 | switch(type) { | 
|---|
|  | 1145 | case (row_int): | 
|---|
|  | 1146 | *((int *)value) = atoi(dummy1); | 
|---|
|  | 1147 | if ((verbose) && (i==0) && (j==0)) fprintf(stderr,"%s = ", name); | 
|---|
|  | 1148 | if (verbose) fprintf(stderr,"%i\t",*((int *)value)); | 
|---|
|  | 1149 | value = (void *)((long)value + sizeof(int)); | 
|---|
|  | 1150 | //value += sizeof(int); | 
|---|
|  | 1151 | break; | 
|---|
|  | 1152 | case(row_double): | 
|---|
|  | 1153 | case(grid): | 
|---|
|  | 1154 | case(lower_trigrid): | 
|---|
|  | 1155 | case(upper_trigrid): | 
|---|
|  | 1156 | *((double *)value) = atof(dummy1); | 
|---|
|  | 1157 | if ((verbose) && (i==0) && (j==0)) fprintf(stderr,"%s = ", name); | 
|---|
|  | 1158 | if (verbose) fprintf(stderr,"%lg\t",*((double *)value)); | 
|---|
|  | 1159 | value = (void *)((long)value + sizeof(double)); | 
|---|
|  | 1160 | //value += sizeof(double); | 
|---|
|  | 1161 | break; | 
|---|
|  | 1162 | case(double_type): | 
|---|
|  | 1163 | *((double *)value) = atof(dummy1); | 
|---|
|  | 1164 | if ((verbose) && (i == xth-1)) fprintf(stderr,"%s = %lg\n", name, *((double *) value)); | 
|---|
|  | 1165 | //value += sizeof(double); | 
|---|
|  | 1166 | break; | 
|---|
|  | 1167 | case(int_type): | 
|---|
|  | 1168 | *((int *)value) = atoi(dummy1); | 
|---|
|  | 1169 | if ((verbose) && (i == xth-1)) fprintf(stderr,"%s = %i\n", name, *((int *) value)); | 
|---|
|  | 1170 | //value += sizeof(int); | 
|---|
|  | 1171 | break; | 
|---|
|  | 1172 | default: | 
|---|
|  | 1173 | case(string_type): | 
|---|
|  | 1174 | if (value != NULL) { | 
|---|
| [c750cc] | 1175 | //if (maxlength == -1) maxlength = strlen((char *)value); // get maximum size of string array | 
|---|
|  | 1176 | maxlength = MAXSTRINGSIZE; | 
|---|
| [14de469] | 1177 | length = maxlength > (dummy-dummy1) ? (dummy-dummy1) : maxlength; // cap at maximum | 
|---|
|  | 1178 | strncpy((char *)value, dummy1, length);  // copy as much | 
|---|
|  | 1179 | ((char *)value)[length] = '\0';  // and set end marker | 
|---|
|  | 1180 | if ((verbose) && (i == xth-1)) fprintf(stderr,"%s is '%s' (%i chars)\n",name,((char *) value), length); | 
|---|
|  | 1181 | //value += sizeof(char); | 
|---|
|  | 1182 | } else { | 
|---|
|  | 1183 | } | 
|---|
|  | 1184 | break; | 
|---|
|  | 1185 | } | 
|---|
|  | 1186 | } | 
|---|
|  | 1187 | while (*dummy == '\t') | 
|---|
|  | 1188 | dummy++; | 
|---|
|  | 1189 | } | 
|---|
|  | 1190 | } | 
|---|
|  | 1191 | } | 
|---|
|  | 1192 | } | 
|---|
|  | 1193 | } | 
|---|
|  | 1194 | if ((type >= row_int) && (verbose)) fprintf(stderr,"\n"); | 
|---|
|  | 1195 | Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy"); | 
|---|
|  | 1196 | if (!sequential) { | 
|---|
|  | 1197 | file->clear(); | 
|---|
|  | 1198 | file->seekg(file_position, ios::beg);  // rewind to start position | 
|---|
|  | 1199 | } | 
|---|
|  | 1200 | //fprintf(stderr, "End of Parsing\n\n"); | 
|---|
|  | 1201 |  | 
|---|
|  | 1202 | return (found); // true if found, false if not | 
|---|
|  | 1203 | } | 
|---|