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