| [43dad6] | 1 | /* | 
|---|
|  | 2 | * PcpParser.cpp | 
|---|
|  | 3 | * | 
|---|
|  | 4 | *  Created on: 12.06.2010 | 
|---|
|  | 5 | *      Author: heber | 
|---|
|  | 6 | */ | 
|---|
|  | 7 |  | 
|---|
|  | 8 | #include <iostream> | 
|---|
| [36166d] | 9 | #include <iomanip> | 
|---|
| [43dad6] | 10 |  | 
|---|
|  | 11 | #include "atom.hpp" | 
|---|
|  | 12 | #include "config.hpp" | 
|---|
|  | 13 | #include "ConfigFileBuffer.hpp" | 
|---|
|  | 14 | #include "element.hpp" | 
|---|
| [1b2d30] | 15 | #include "Helpers/Assert.hpp" | 
|---|
| [43dad6] | 16 | #include "log.hpp" | 
|---|
|  | 17 | #include "molecule.hpp" | 
|---|
|  | 18 | #include "PcpParser.hpp" | 
|---|
|  | 19 | #include "periodentafel.hpp" | 
|---|
|  | 20 | #include "ThermoStatContainer.hpp" | 
|---|
|  | 21 | #include "verbose.hpp" | 
|---|
|  | 22 | #include "World.hpp" | 
|---|
| [84c494] | 23 | #include "Matrix.hpp" | 
|---|
|  | 24 | #include "Box.hpp" | 
|---|
| [43dad6] | 25 |  | 
|---|
|  | 26 | /** Constructor of PcpParser. | 
|---|
|  | 27 | * | 
|---|
|  | 28 | */ | 
|---|
|  | 29 | PcpParser::PcpParser() | 
|---|
| [1b2d30] | 30 | { | 
|---|
| [650ca8c] | 31 | Parallelization.ProcPEGamma = 8; | 
|---|
| [1b2d30] | 32 | Parallelization.ProcPEPsi = 1; | 
|---|
|  | 33 |  | 
|---|
|  | 34 | Paths.databasepath = NULL; | 
|---|
|  | 35 | Paths.configname = NULL; | 
|---|
|  | 36 | Paths.mainname = NULL; | 
|---|
|  | 37 | Paths.defaultpath = NULL; | 
|---|
|  | 38 | Paths.pseudopotpath = NULL; | 
|---|
|  | 39 |  | 
|---|
|  | 40 | Switches.DoConstrainedMD = 0; | 
|---|
|  | 41 | Switches.DoOutVis = 0; | 
|---|
|  | 42 | Switches.DoOutMes = 1; | 
|---|
|  | 43 | Switches.DoOutNICS = 0; | 
|---|
|  | 44 | Switches.DoOutOrbitals = 0; | 
|---|
|  | 45 | Switches.DoOutCurrent = 0; | 
|---|
|  | 46 | Switches.DoFullCurrent = 0; | 
|---|
|  | 47 | Switches.DoPerturbation = 0; | 
|---|
|  | 48 | Switches.DoWannier = 0; | 
|---|
|  | 49 |  | 
|---|
|  | 50 | LocalizedOrbitals.CommonWannier = 0; | 
|---|
|  | 51 | LocalizedOrbitals.SawtoothStart = 0.01; | 
|---|
|  | 52 | LocalizedOrbitals.VectorPlane = 0; | 
|---|
|  | 53 | LocalizedOrbitals.VectorCut = 0; | 
|---|
|  | 54 | LocalizedOrbitals.UseAddGramSch = 1; | 
|---|
|  | 55 | LocalizedOrbitals.Seed = 1; | 
|---|
|  | 56 | LocalizedOrbitals.EpsWannier = 1e-7; | 
|---|
|  | 57 |  | 
|---|
| [650ca8c] | 58 | StepCounts.MaxMinStopStep = 1; | 
|---|
|  | 59 | StepCounts.InitMaxMinStopStep = 1; | 
|---|
| [1b2d30] | 60 | StepCounts.OutVisStep = 10; | 
|---|
|  | 61 | StepCounts.OutSrcStep = 5; | 
|---|
| [650ca8c] | 62 | StepCounts.MaxPsiStep = 0; | 
|---|
| [1b2d30] | 63 | StepCounts.MaxOuterStep = 0; | 
|---|
|  | 64 | StepCounts.MaxMinStep = 100; | 
|---|
|  | 65 | StepCounts.RelEpsTotalEnergy = 1e-07; | 
|---|
|  | 66 | StepCounts.RelEpsKineticEnergy = 1e-05; | 
|---|
|  | 67 | StepCounts.MaxMinGapStopStep = 0; | 
|---|
|  | 68 | StepCounts.MaxInitMinStep = 100; | 
|---|
|  | 69 | StepCounts.InitRelEpsTotalEnergy = 1e-05; | 
|---|
|  | 70 | StepCounts.InitRelEpsKineticEnergy = 0.0001; | 
|---|
| [650ca8c] | 71 | StepCounts.InitMaxMinGapStopStep = 0; | 
|---|
| [1b2d30] | 72 |  | 
|---|
|  | 73 | PlaneWaveSpecifics.PsiType = 0; | 
|---|
|  | 74 | PlaneWaveSpecifics.MaxPsiDouble = 0; | 
|---|
|  | 75 | PlaneWaveSpecifics.PsiMaxNoUp = 0; | 
|---|
|  | 76 | PlaneWaveSpecifics.PsiMaxNoDown = 0; | 
|---|
|  | 77 | PlaneWaveSpecifics.ECut = 128; | 
|---|
|  | 78 | PlaneWaveSpecifics.MaxLevel = 5; | 
|---|
|  | 79 | PlaneWaveSpecifics.RiemannTensor = 0; | 
|---|
|  | 80 | PlaneWaveSpecifics.LevRFactor = 0; | 
|---|
|  | 81 | PlaneWaveSpecifics.RiemannLevel = 0; | 
|---|
|  | 82 | PlaneWaveSpecifics.Lev0Factor = 2; | 
|---|
|  | 83 | PlaneWaveSpecifics.RTActualUse = 0; | 
|---|
|  | 84 | PlaneWaveSpecifics.AddPsis = 0; | 
|---|
|  | 85 | PlaneWaveSpecifics.RCut = 20; | 
|---|
|  | 86 | PlaneWaveSpecifics.PsiType = 0; | 
|---|
|  | 87 |  | 
|---|
|  | 88 | FastParsing = false; | 
|---|
|  | 89 |  | 
|---|
|  | 90 | Deltat = 0.01; | 
|---|
|  | 91 | IsAngstroem = 1; | 
|---|
|  | 92 | RelativeCoord = 0; | 
|---|
| [5773a9] | 93 | StructOpt = 0; | 
|---|
| [1b2d30] | 94 | MaxTypes = 0; | 
|---|
|  | 95 | } | 
|---|
| [43dad6] | 96 |  | 
|---|
|  | 97 | /** Destructor of PcpParser. | 
|---|
|  | 98 | * | 
|---|
|  | 99 | */ | 
|---|
|  | 100 | PcpParser::~PcpParser() | 
|---|
|  | 101 | {} | 
|---|
|  | 102 |  | 
|---|
|  | 103 | void PcpParser::load(std::istream* file) | 
|---|
|  | 104 | { | 
|---|
|  | 105 | if (file->fail()) { | 
|---|
|  | 106 | DoeLog(1) && (eLog()<< Verbose(1) << "could not access given file" << endl); | 
|---|
|  | 107 | return; | 
|---|
|  | 108 | } | 
|---|
|  | 109 |  | 
|---|
|  | 110 | // ParseParameterFile | 
|---|
|  | 111 | class ConfigFileBuffer *FileBuffer = new ConfigFileBuffer(); | 
|---|
|  | 112 | FileBuffer->InitFileBuffer(file); | 
|---|
|  | 113 |  | 
|---|
|  | 114 | /* Oeffne Hauptparameterdatei */ | 
|---|
|  | 115 | int di = 0; | 
|---|
|  | 116 | double BoxLength[9]; | 
|---|
|  | 117 | string zeile; | 
|---|
|  | 118 | string dummy; | 
|---|
|  | 119 | int verbose = 0; | 
|---|
|  | 120 |  | 
|---|
|  | 121 | ParseThermostats(FileBuffer); | 
|---|
|  | 122 |  | 
|---|
|  | 123 | /* Namen einlesen */ | 
|---|
|  | 124 |  | 
|---|
|  | 125 | // 1. parse in options | 
|---|
|  | 126 | ParseForParameter(verbose,FileBuffer, "mainname", 0, 1, 1, string_type, (Paths.mainname), 1, critical); | 
|---|
|  | 127 | ParseForParameter(verbose,FileBuffer, "defaultpath", 0, 1, 1, string_type, (Paths.defaultpath), 1, critical); | 
|---|
|  | 128 | ParseForParameter(verbose,FileBuffer, "pseudopotpath", 0, 1, 1, string_type, (Paths.pseudopotpath), 1, critical); | 
|---|
|  | 129 | ParseForParameter(verbose,FileBuffer,"ProcPEGamma", 0, 1, 1, int_type, &(Parallelization.ProcPEGamma), 1, critical); | 
|---|
|  | 130 | ParseForParameter(verbose,FileBuffer,"ProcPEPsi", 0, 1, 1, int_type, &(Parallelization.ProcPEPsi), 1, critical); | 
|---|
|  | 131 |  | 
|---|
|  | 132 | if (!ParseForParameter(verbose,FileBuffer,"Seed", 0, 1, 1, int_type, &(LocalizedOrbitals.Seed), 1, optional)) | 
|---|
|  | 133 | LocalizedOrbitals.Seed = 1; | 
|---|
|  | 134 |  | 
|---|
|  | 135 | if(!ParseForParameter(verbose,FileBuffer,"DoOutOrbitals", 0, 1, 1, int_type, &(Switches.DoOutOrbitals), 1, optional)) { | 
|---|
|  | 136 | Switches.DoOutOrbitals = 0; | 
|---|
|  | 137 | } else { | 
|---|
|  | 138 | if (Switches.DoOutOrbitals < 0) Switches.DoOutOrbitals = 0; | 
|---|
|  | 139 | if (Switches.DoOutOrbitals > 1) Switches.DoOutOrbitals = 1; | 
|---|
|  | 140 | } | 
|---|
|  | 141 | ParseForParameter(verbose,FileBuffer,"DoOutVis", 0, 1, 1, int_type, &(Switches.DoOutVis), 1, critical); | 
|---|
|  | 142 | if (Switches.DoOutVis < 0) Switches.DoOutVis = 0; | 
|---|
|  | 143 | if (Switches.DoOutVis > 1) Switches.DoOutVis = 1; | 
|---|
|  | 144 | if (!ParseForParameter(verbose,FileBuffer,"VectorPlane", 0, 1, 1, int_type, &(LocalizedOrbitals.VectorPlane), 1, optional)) | 
|---|
|  | 145 | LocalizedOrbitals.VectorPlane = -1; | 
|---|
|  | 146 | if (!ParseForParameter(verbose,FileBuffer,"VectorCut", 0, 1, 1, double_type, &(LocalizedOrbitals.VectorCut), 1, optional)) | 
|---|
|  | 147 | LocalizedOrbitals.VectorCut = 0.; | 
|---|
|  | 148 | ParseForParameter(verbose,FileBuffer,"DoOutMes", 0, 1, 1, int_type, &(Switches.DoOutMes), 1, critical); | 
|---|
|  | 149 | if (Switches.DoOutMes < 0) Switches.DoOutMes = 0; | 
|---|
|  | 150 | if (Switches.DoOutMes > 1) Switches.DoOutMes = 1; | 
|---|
|  | 151 | if (!ParseForParameter(verbose,FileBuffer,"DoOutCurr", 0, 1, 1, int_type, &(Switches.DoOutCurrent), 1, optional)) | 
|---|
|  | 152 | Switches.DoOutCurrent = 0; | 
|---|
|  | 153 | if (Switches.DoOutCurrent < 0) Switches.DoOutCurrent = 0; | 
|---|
|  | 154 | if (Switches.DoOutCurrent > 1) Switches.DoOutCurrent = 1; | 
|---|
|  | 155 | ParseForParameter(verbose,FileBuffer,"AddGramSch", 0, 1, 1, int_type, &(LocalizedOrbitals.UseAddGramSch), 1, critical); | 
|---|
|  | 156 | if (LocalizedOrbitals.UseAddGramSch < 0) LocalizedOrbitals.UseAddGramSch = 0; | 
|---|
|  | 157 | if (LocalizedOrbitals.UseAddGramSch > 2) LocalizedOrbitals.UseAddGramSch = 2; | 
|---|
|  | 158 | if(!ParseForParameter(verbose,FileBuffer,"DoWannier", 0, 1, 1, int_type, &(Switches.DoWannier), 1, optional)) { | 
|---|
|  | 159 | Switches.DoWannier = 0; | 
|---|
|  | 160 | } else { | 
|---|
|  | 161 | if (Switches.DoWannier < 0) Switches.DoWannier = 0; | 
|---|
|  | 162 | if (Switches.DoWannier > 1) Switches.DoWannier = 1; | 
|---|
|  | 163 | } | 
|---|
|  | 164 | if(!ParseForParameter(verbose,FileBuffer,"CommonWannier", 0, 1, 1, int_type, &(LocalizedOrbitals.CommonWannier), 1, optional)) { | 
|---|
|  | 165 | LocalizedOrbitals.CommonWannier = 0; | 
|---|
|  | 166 | } else { | 
|---|
|  | 167 | if (LocalizedOrbitals.CommonWannier < 0) LocalizedOrbitals.CommonWannier = 0; | 
|---|
|  | 168 | if (LocalizedOrbitals.CommonWannier > 4) LocalizedOrbitals.CommonWannier = 4; | 
|---|
|  | 169 | } | 
|---|
|  | 170 | if(!ParseForParameter(verbose,FileBuffer,"SawtoothStart", 0, 1, 1, double_type, &(LocalizedOrbitals.SawtoothStart), 1, optional)) { | 
|---|
|  | 171 | LocalizedOrbitals.SawtoothStart = 0.01; | 
|---|
|  | 172 | } else { | 
|---|
|  | 173 | if (LocalizedOrbitals.SawtoothStart < 0.) LocalizedOrbitals.SawtoothStart = 0.; | 
|---|
|  | 174 | if (LocalizedOrbitals.SawtoothStart > 1.) LocalizedOrbitals.SawtoothStart = 1.; | 
|---|
|  | 175 | } | 
|---|
|  | 176 |  | 
|---|
|  | 177 | if (ParseForParameter(verbose,FileBuffer,"DoConstrainedMD", 0, 1, 1, int_type, &(Switches.DoConstrainedMD), 1, optional)) | 
|---|
|  | 178 | if (Switches.DoConstrainedMD < 0) | 
|---|
|  | 179 | Switches.DoConstrainedMD = 0; | 
|---|
|  | 180 | ParseForParameter(verbose,FileBuffer,"MaxOuterStep", 0, 1, 1, int_type, &(StepCounts.MaxOuterStep), 1, critical); | 
|---|
|  | 181 | if (!ParseForParameter(verbose,FileBuffer,"Deltat", 0, 1, 1, double_type, &(Deltat), 1, optional)) | 
|---|
|  | 182 | Deltat = 1; | 
|---|
|  | 183 | ParseForParameter(verbose,FileBuffer,"OutVisStep", 0, 1, 1, int_type, &(StepCounts.OutVisStep), 1, optional); | 
|---|
|  | 184 | ParseForParameter(verbose,FileBuffer,"OutSrcStep", 0, 1, 1, int_type, &(StepCounts.OutSrcStep), 1, optional); | 
|---|
|  | 185 | ParseForParameter(verbose,FileBuffer,"TargetTemp", 0, 1, 1, double_type, &(World::getInstance().getThermostats()->TargetTemp), 1, optional); | 
|---|
|  | 186 | //ParseForParameter(verbose,FileBuffer,"Thermostat", 0, 1, 1, int_type, &(ScaleTempStep), 1, optional); | 
|---|
|  | 187 | if (!ParseForParameter(verbose,FileBuffer,"EpsWannier", 0, 1, 1, double_type, &(LocalizedOrbitals.EpsWannier), 1, optional)) | 
|---|
|  | 188 | LocalizedOrbitals.EpsWannier = 1e-8; | 
|---|
|  | 189 |  | 
|---|
|  | 190 | // stop conditions | 
|---|
|  | 191 | //if (MaxOuterStep <= 0) MaxOuterStep = 1; | 
|---|
|  | 192 | ParseForParameter(verbose,FileBuffer,"MaxPsiStep", 0, 1, 1, int_type, &(StepCounts.MaxPsiStep), 1, critical); | 
|---|
|  | 193 | if (StepCounts.MaxPsiStep <= 0) StepCounts.MaxPsiStep = 3; | 
|---|
|  | 194 |  | 
|---|
|  | 195 | ParseForParameter(verbose,FileBuffer,"MaxMinStep", 0, 1, 1, int_type, &(StepCounts.MaxMinStep), 1, critical); | 
|---|
|  | 196 | ParseForParameter(verbose,FileBuffer,"RelEpsTotalE", 0, 1, 1, double_type, &(StepCounts.RelEpsTotalEnergy), 1, critical); | 
|---|
|  | 197 | ParseForParameter(verbose,FileBuffer,"RelEpsKineticE", 0, 1, 1, double_type, &(StepCounts.RelEpsKineticEnergy), 1, critical); | 
|---|
|  | 198 | ParseForParameter(verbose,FileBuffer,"MaxMinStopStep", 0, 1, 1, int_type, &(StepCounts.MaxMinStopStep), 1, critical); | 
|---|
|  | 199 | ParseForParameter(verbose,FileBuffer,"MaxMinGapStopStep", 0, 1, 1, int_type, &(StepCounts.MaxMinGapStopStep), 1, critical); | 
|---|
|  | 200 | if (StepCounts.MaxMinStep <= 0) StepCounts.MaxMinStep = StepCounts.MaxPsiStep; | 
|---|
|  | 201 | if (StepCounts.MaxMinStopStep < 1) StepCounts.MaxMinStopStep = 1; | 
|---|
|  | 202 | if (StepCounts.MaxMinGapStopStep < 1) StepCounts.MaxMinGapStopStep = 1; | 
|---|
|  | 203 |  | 
|---|
|  | 204 | ParseForParameter(verbose,FileBuffer,"MaxInitMinStep", 0, 1, 1, int_type, &(StepCounts.MaxInitMinStep), 1, critical); | 
|---|
|  | 205 | ParseForParameter(verbose,FileBuffer,"InitRelEpsTotalE", 0, 1, 1, double_type, &(StepCounts.InitRelEpsTotalEnergy), 1, critical); | 
|---|
|  | 206 | ParseForParameter(verbose,FileBuffer,"InitRelEpsKineticE", 0, 1, 1, double_type, &(StepCounts.InitRelEpsKineticEnergy), 1, critical); | 
|---|
|  | 207 | ParseForParameter(verbose,FileBuffer,"InitMaxMinStopStep", 0, 1, 1, int_type, &(StepCounts.InitMaxMinStopStep), 1, critical); | 
|---|
|  | 208 | ParseForParameter(verbose,FileBuffer,"InitMaxMinGapStopStep", 0, 1, 1, int_type, &(StepCounts.InitMaxMinGapStopStep), 1, critical); | 
|---|
|  | 209 | if (StepCounts.MaxInitMinStep <= 0) StepCounts.MaxInitMinStep = StepCounts.MaxPsiStep; | 
|---|
|  | 210 | if (StepCounts.InitMaxMinStopStep < 1) StepCounts.InitMaxMinStopStep = 1; | 
|---|
|  | 211 | if (StepCounts.InitMaxMinGapStopStep < 1) StepCounts.InitMaxMinGapStopStep = 1; | 
|---|
|  | 212 |  | 
|---|
|  | 213 | // Unit cell and magnetic field | 
|---|
|  | 214 | ParseForParameter(verbose,FileBuffer, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */ | 
|---|
| [84c494] | 215 | double *cell_size = new double[6]; | 
|---|
| [43dad6] | 216 | cell_size[0] = BoxLength[0]; | 
|---|
|  | 217 | cell_size[1] = BoxLength[3]; | 
|---|
|  | 218 | cell_size[2] = BoxLength[4]; | 
|---|
|  | 219 | cell_size[3] = BoxLength[6]; | 
|---|
|  | 220 | cell_size[4] = BoxLength[7]; | 
|---|
|  | 221 | cell_size[5] = BoxLength[8]; | 
|---|
| [84c494] | 222 | World::getInstance().setDomain(cell_size); | 
|---|
|  | 223 | delete[] cell_size; | 
|---|
| [43dad6] | 224 | //if (1) fprintf(stderr,"\n"); | 
|---|
|  | 225 |  | 
|---|
|  | 226 | ParseForParameter(verbose,FileBuffer,"DoPerturbation", 0, 1, 1, int_type, &(Switches.DoPerturbation), 1, optional); | 
|---|
|  | 227 | ParseForParameter(verbose,FileBuffer,"DoOutNICS", 0, 1, 1, int_type, &(Switches.DoOutNICS), 1, optional); | 
|---|
|  | 228 | if (!ParseForParameter(verbose,FileBuffer,"DoFullCurrent", 0, 1, 1, int_type, &(Switches.DoFullCurrent), 1, optional)) | 
|---|
|  | 229 | Switches.DoFullCurrent = 0; | 
|---|
|  | 230 | if (Switches.DoFullCurrent < 0) Switches.DoFullCurrent = 0; | 
|---|
|  | 231 | if (Switches.DoFullCurrent > 2) Switches.DoFullCurrent = 2; | 
|---|
|  | 232 | if (Switches.DoOutNICS < 0) Switches.DoOutNICS = 0; | 
|---|
|  | 233 | if (Switches.DoOutNICS > 2) Switches.DoOutNICS = 2; | 
|---|
|  | 234 | if (Switches.DoPerturbation == 0) { | 
|---|
|  | 235 | Switches.DoFullCurrent = 0; | 
|---|
|  | 236 | Switches.DoOutNICS = 0; | 
|---|
|  | 237 | } | 
|---|
|  | 238 |  | 
|---|
|  | 239 | ParseForParameter(verbose,FileBuffer,"ECut", 0, 1, 1, double_type, &(PlaneWaveSpecifics.ECut), 1, critical); | 
|---|
|  | 240 | ParseForParameter(verbose,FileBuffer,"MaxLevel", 0, 1, 1, int_type, &(PlaneWaveSpecifics.MaxLevel), 1, critical); | 
|---|
|  | 241 | ParseForParameter(verbose,FileBuffer,"Level0Factor", 0, 1, 1, int_type, &(PlaneWaveSpecifics.Lev0Factor), 1, critical); | 
|---|
|  | 242 | if (PlaneWaveSpecifics.Lev0Factor < 2) { | 
|---|
|  | 243 | PlaneWaveSpecifics.Lev0Factor = 2; | 
|---|
|  | 244 | } | 
|---|
|  | 245 | ParseForParameter(verbose,FileBuffer,"RiemannTensor", 0, 1, 1, int_type, &di, 1, critical); | 
|---|
|  | 246 | if (di >= 0 && di < 2) { | 
|---|
|  | 247 | PlaneWaveSpecifics.RiemannTensor = di; | 
|---|
|  | 248 | } else { | 
|---|
|  | 249 | cerr << "0 <= RiemanTensor < 2: 0 UseNotRT, 1 UseRT" << endl; | 
|---|
|  | 250 | exit(1); | 
|---|
|  | 251 | } | 
|---|
|  | 252 | switch (PlaneWaveSpecifics.RiemannTensor) { | 
|---|
|  | 253 | case 0: //UseNoRT | 
|---|
|  | 254 | if (PlaneWaveSpecifics.MaxLevel < 2) { | 
|---|
|  | 255 | PlaneWaveSpecifics.MaxLevel = 2; | 
|---|
|  | 256 | } | 
|---|
|  | 257 | PlaneWaveSpecifics.LevRFactor = 2; | 
|---|
|  | 258 | PlaneWaveSpecifics.RTActualUse = 0; | 
|---|
|  | 259 | break; | 
|---|
|  | 260 | case 1: // UseRT | 
|---|
|  | 261 | if (PlaneWaveSpecifics.MaxLevel < 3) { | 
|---|
|  | 262 | PlaneWaveSpecifics.MaxLevel = 3; | 
|---|
|  | 263 | } | 
|---|
|  | 264 | ParseForParameter(verbose,FileBuffer,"RiemannLevel", 0, 1, 1, int_type, &(PlaneWaveSpecifics.RiemannLevel), 1, critical); | 
|---|
|  | 265 | if (PlaneWaveSpecifics.RiemannLevel < 2) { | 
|---|
|  | 266 | PlaneWaveSpecifics.RiemannLevel = 2; | 
|---|
|  | 267 | } | 
|---|
|  | 268 | if (PlaneWaveSpecifics.RiemannLevel > PlaneWaveSpecifics.MaxLevel-1) { | 
|---|
|  | 269 | PlaneWaveSpecifics.RiemannLevel = PlaneWaveSpecifics.MaxLevel-1; | 
|---|
|  | 270 | } | 
|---|
|  | 271 | ParseForParameter(verbose,FileBuffer,"LevRFactor", 0, 1, 1, int_type, &(PlaneWaveSpecifics.LevRFactor), 1, critical); | 
|---|
|  | 272 | if (PlaneWaveSpecifics.LevRFactor < 2) { | 
|---|
|  | 273 | PlaneWaveSpecifics.LevRFactor = 2; | 
|---|
|  | 274 | } | 
|---|
|  | 275 | PlaneWaveSpecifics.Lev0Factor = 2; | 
|---|
|  | 276 | PlaneWaveSpecifics.RTActualUse = 2; | 
|---|
|  | 277 | break; | 
|---|
|  | 278 | } | 
|---|
|  | 279 | ParseForParameter(verbose,FileBuffer,"PsiType", 0, 1, 1, int_type, &di, 1, critical); | 
|---|
|  | 280 | if (di >= 0 && di < 2) { | 
|---|
|  | 281 | PlaneWaveSpecifics.PsiType = di; | 
|---|
|  | 282 | } else { | 
|---|
|  | 283 | cerr << "0 <= PsiType < 2: 0 UseSpinDouble, 1 UseSpinUpDown" << endl; | 
|---|
|  | 284 | exit(1); | 
|---|
|  | 285 | } | 
|---|
|  | 286 | switch (PlaneWaveSpecifics.PsiType) { | 
|---|
|  | 287 | case 0: // SpinDouble | 
|---|
|  | 288 | ParseForParameter(verbose,FileBuffer,"MaxPsiDouble", 0, 1, 1, int_type, &(PlaneWaveSpecifics.MaxPsiDouble), 1, critical); | 
|---|
| [2fd80b5] | 289 | ParseForParameter(verbose,FileBuffer,"PsiMaxNoUp", 0, 1, 1, int_type, &(PlaneWaveSpecifics.PsiMaxNoUp), 1, optional); | 
|---|
|  | 290 | ParseForParameter(verbose,FileBuffer,"PsiMaxNoDown", 0, 1, 1, int_type, &(PlaneWaveSpecifics.PsiMaxNoDown), 1, optional); | 
|---|
| [43dad6] | 291 | ParseForParameter(verbose,FileBuffer,"AddPsis", 0, 1, 1, int_type, &(PlaneWaveSpecifics.AddPsis), 1, optional); | 
|---|
|  | 292 | break; | 
|---|
|  | 293 | case 1: // SpinUpDown | 
|---|
|  | 294 | if (Parallelization.ProcPEGamma % 2) Parallelization.ProcPEGamma*=2; | 
|---|
| [2fd80b5] | 295 | ParseForParameter(verbose,FileBuffer,"MaxPsiDouble", 0, 1, 1, int_type, &(PlaneWaveSpecifics.MaxPsiDouble), 1, optional); | 
|---|
| [43dad6] | 296 | ParseForParameter(verbose,FileBuffer,"PsiMaxNoUp", 0, 1, 1, int_type, &(PlaneWaveSpecifics.PsiMaxNoUp), 1, critical); | 
|---|
|  | 297 | ParseForParameter(verbose,FileBuffer,"PsiMaxNoDown", 0, 1, 1, int_type, &(PlaneWaveSpecifics.PsiMaxNoDown), 1, critical); | 
|---|
|  | 298 | ParseForParameter(verbose,FileBuffer,"AddPsis", 0, 1, 1, int_type, &(PlaneWaveSpecifics.AddPsis), 1, optional); | 
|---|
|  | 299 | break; | 
|---|
|  | 300 | } | 
|---|
|  | 301 |  | 
|---|
|  | 302 | // IonsInitRead | 
|---|
|  | 303 |  | 
|---|
|  | 304 | ParseForParameter(verbose,FileBuffer,"RCut", 0, 1, 1, double_type, &(PlaneWaveSpecifics.RCut), 1, critical); | 
|---|
|  | 305 | ParseForParameter(verbose,FileBuffer,"IsAngstroem", 0, 1, 1, int_type, &(IsAngstroem), 1, critical); | 
|---|
|  | 306 | ParseForParameter(verbose,FileBuffer,"MaxTypes", 0, 1, 1, int_type, &(MaxTypes), 1, critical); | 
|---|
|  | 307 | if (!ParseForParameter(verbose,FileBuffer,"RelativeCoord", 0, 1, 1, int_type, &(RelativeCoord) , 1, optional)) | 
|---|
|  | 308 | RelativeCoord = 0; | 
|---|
|  | 309 | if (!ParseForParameter(verbose,FileBuffer,"StructOpt", 0, 1, 1, int_type, &(StructOpt), 1, optional)) | 
|---|
|  | 310 | StructOpt = 0; | 
|---|
|  | 311 |  | 
|---|
|  | 312 | // 3. parse the molecule in | 
|---|
|  | 313 | molecule *mol = World::getInstance().createMolecule(); | 
|---|
| [35b698] | 314 | MoleculeListClass *molecules = World::getInstance().getMolecules(); | 
|---|
|  | 315 | molecules->insert(mol); | 
|---|
| [43dad6] | 316 | LoadMolecule(mol, FileBuffer, World::getInstance().getPeriode(), FastParsing); | 
|---|
|  | 317 | //mol->SetNameFromFilename(filename); | 
|---|
|  | 318 | mol->ActiveFlag = true; | 
|---|
|  | 319 | //MolList->insert(mol); | 
|---|
|  | 320 |  | 
|---|
|  | 321 | // 4. dissect the molecule into connected subgraphs | 
|---|
|  | 322 | // don't do this here ... | 
|---|
|  | 323 | //MolList->DissectMoleculeIntoConnectedSubgraphs(mol,this); | 
|---|
|  | 324 | //delete(mol); | 
|---|
|  | 325 |  | 
|---|
|  | 326 | delete(FileBuffer); | 
|---|
|  | 327 | } | 
|---|
|  | 328 |  | 
|---|
|  | 329 | /** Saves the World into a PCP config file. | 
|---|
|  | 330 | * \param *file output stream to save to | 
|---|
|  | 331 | */ | 
|---|
|  | 332 | void PcpParser::save(std::ostream* file) | 
|---|
|  | 333 | { | 
|---|
| [84c494] | 334 | const Matrix &domain = World::getInstance().getDomain().getM(); | 
|---|
| [43dad6] | 335 | class ThermoStatContainer *Thermostats = World::getInstance().getThermostats(); | 
|---|
|  | 336 | if (!file->fail()) { | 
|---|
| [650ca8c] | 337 | // calculate number of Psis | 
|---|
|  | 338 | vector<atom *> allatoms = World::getInstance().getAllAtoms(); | 
|---|
|  | 339 | CalculateOrbitals(allatoms); | 
|---|
| [43dad6] | 340 | *file << "# ParallelCarParinello - main configuration file - created with molecuilder" << endl; | 
|---|
|  | 341 | *file << endl; | 
|---|
| [650ca8c] | 342 | if (Paths.mainname != NULL) | 
|---|
|  | 343 | *file << "mainname\t" << Paths.mainname << "\t# programm name (for runtime files)" << endl; | 
|---|
|  | 344 | else | 
|---|
|  | 345 | *file << "mainname\tpcp\t# programm name (for runtime files)" << endl; | 
|---|
|  | 346 | if (Paths.defaultpath != NULL) | 
|---|
|  | 347 | *file << "defaultpath\t" << Paths.defaultpath << "\t# where to put files during runtime" << endl; | 
|---|
|  | 348 | else | 
|---|
|  | 349 | *file << "defaultpath\tnot specified\t# where to put files during runtime" << endl; | 
|---|
|  | 350 | if (Paths.pseudopotpath != NULL) | 
|---|
|  | 351 | *file << "pseudopotpath\t" << Paths.pseudopotpath << "\t# where to find pseudopotentials" << endl; | 
|---|
|  | 352 | else | 
|---|
|  | 353 | *file << "pseudopotpath\tnot specified\t# where to find pseudopotentials" << endl; | 
|---|
| [43dad6] | 354 | *file << endl; | 
|---|
|  | 355 | *file << "ProcPEGamma\t" << Parallelization.ProcPEGamma << "\t# for parallel computing: share constants" << endl; | 
|---|
|  | 356 | *file << "ProcPEPsi\t" << Parallelization.ProcPEPsi << "\t# for parallel computing: share wave functions" << endl; | 
|---|
|  | 357 | *file << "DoOutVis\t" << Switches.DoOutVis << "\t# Output data for OpenDX" << endl; | 
|---|
|  | 358 | *file << "DoOutMes\t" << Switches.DoOutMes << "\t# Output data for measurements" << endl; | 
|---|
|  | 359 | *file << "DoOutOrbitals\t" << Switches.DoOutOrbitals << "\t# Output all Orbitals" << endl; | 
|---|
|  | 360 | *file << "DoOutCurr\t" << Switches.DoOutCurrent << "\t# Ouput current density for OpenDx" << endl; | 
|---|
|  | 361 | *file << "DoOutNICS\t" << Switches.DoOutNICS << "\t# Output Nucleus independent current shieldings" << endl; | 
|---|
|  | 362 | *file << "DoPerturbation\t" << Switches.DoPerturbation << "\t# Do perturbation calculate and determine susceptibility and shielding" << endl; | 
|---|
|  | 363 | *file << "DoFullCurrent\t" << Switches.DoFullCurrent << "\t# Do full perturbation" << endl; | 
|---|
|  | 364 | *file << "DoConstrainedMD\t" << Switches.DoConstrainedMD << "\t# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD" << endl; | 
|---|
| [650ca8c] | 365 | ASSERT(Thermostats != NULL, "PcpParser::save() - Thermostats not initialized!"); | 
|---|
|  | 366 | ASSERT(Thermostats->ThermostatNames != NULL, "PcpParser::save() - Thermostats not initialized!"); | 
|---|
| [43dad6] | 367 | *file << "Thermostat\t" << Thermostats->ThermostatNames[Thermostats->Thermostat] << "\t"; | 
|---|
|  | 368 | switch(Thermostats->Thermostat) { | 
|---|
|  | 369 | default: | 
|---|
|  | 370 | case None: | 
|---|
|  | 371 | break; | 
|---|
|  | 372 | case Woodcock: | 
|---|
|  | 373 | *file << Thermostats->ScaleTempStep; | 
|---|
|  | 374 | break; | 
|---|
|  | 375 | case Gaussian: | 
|---|
|  | 376 | *file << Thermostats->ScaleTempStep; | 
|---|
|  | 377 | break; | 
|---|
|  | 378 | case Langevin: | 
|---|
|  | 379 | *file << Thermostats->TempFrequency << "\t" << Thermostats->alpha; | 
|---|
|  | 380 | break; | 
|---|
|  | 381 | case Berendsen: | 
|---|
|  | 382 | *file << Thermostats->TempFrequency; | 
|---|
|  | 383 | break; | 
|---|
|  | 384 | case NoseHoover: | 
|---|
|  | 385 | *file << Thermostats->HooverMass; | 
|---|
|  | 386 | break; | 
|---|
|  | 387 | }; | 
|---|
|  | 388 | *file << "\t# Which Thermostat and its parameters to use in MD case." << endl; | 
|---|
|  | 389 | *file << "CommonWannier\t" << LocalizedOrbitals.CommonWannier << "\t# Put virtual centers at indivual orbits, all common, merged by variance, to grid point, to cell center" << endl; | 
|---|
|  | 390 | *file << "SawtoothStart\t" << LocalizedOrbitals.SawtoothStart << "\t# Absolute value for smooth transition at cell border " << endl; | 
|---|
|  | 391 | *file << "VectorPlane\t" << LocalizedOrbitals.VectorPlane << "\t# Cut plane axis (x, y or z: 0,1,2) for two-dim current vector plot" << endl; | 
|---|
|  | 392 | *file << "VectorCut\t" << LocalizedOrbitals.VectorCut << "\t# Cut plane axis value" << endl; | 
|---|
|  | 393 | *file << "AddGramSch\t" << LocalizedOrbitals.UseAddGramSch << "\t# Additional GramSchmidtOrtogonalization to be safe" << endl; | 
|---|
|  | 394 | *file << "Seed\t\t" << LocalizedOrbitals.Seed << "\t# initial value for random seed for Psi coefficients" << endl; | 
|---|
|  | 395 | *file << endl; | 
|---|
|  | 396 | *file << "MaxOuterStep\t" << StepCounts.MaxOuterStep << "\t# number of MolecularDynamics/Structure optimization steps" << endl; | 
|---|
|  | 397 | *file << "Deltat\t" << Deltat << "\t# time per MD step" << endl; | 
|---|
|  | 398 | *file << "OutVisStep\t" << StepCounts.OutVisStep << "\t# Output visual data every ...th step" << endl; | 
|---|
|  | 399 | *file << "OutSrcStep\t" << StepCounts.OutSrcStep << "\t# Output \"restart\" data every ..th step" << endl; | 
|---|
|  | 400 | *file << "TargetTemp\t" << Thermostats->TargetTemp << "\t# Target temperature" << endl; | 
|---|
|  | 401 | *file << "MaxPsiStep\t" << StepCounts.MaxPsiStep << "\t# number of Minimisation steps per state (0 - default)" << endl; | 
|---|
|  | 402 | *file << "EpsWannier\t" << LocalizedOrbitals.EpsWannier << "\t# tolerance value for spread minimisation of orbitals" << endl; | 
|---|
|  | 403 | *file << endl; | 
|---|
|  | 404 | *file << "# Values specifying when to stop" << endl; | 
|---|
|  | 405 | *file << "MaxMinStep\t" << StepCounts.MaxMinStep << "\t# Maximum number of steps" << endl; | 
|---|
|  | 406 | *file << "RelEpsTotalE\t" << StepCounts.RelEpsTotalEnergy << "\t# relative change in total energy" << endl; | 
|---|
|  | 407 | *file << "RelEpsKineticE\t" << StepCounts.RelEpsKineticEnergy << "\t# relative change in kinetic energy" << endl; | 
|---|
|  | 408 | *file << "MaxMinStopStep\t" << StepCounts.MaxMinStopStep << "\t# check every ..th steps" << endl; | 
|---|
|  | 409 | *file << "MaxMinGapStopStep\t" << StepCounts.MaxMinGapStopStep << "\t# check every ..th steps" << endl; | 
|---|
|  | 410 | *file << endl; | 
|---|
|  | 411 | *file << "# Values specifying when to stop for INIT, otherwise same as above" << endl; | 
|---|
|  | 412 | *file << "MaxInitMinStep\t" << StepCounts.MaxInitMinStep << "\t# Maximum number of steps" << endl; | 
|---|
|  | 413 | *file << "InitRelEpsTotalE\t" << StepCounts.InitRelEpsTotalEnergy << "\t# relative change in total energy" << endl; | 
|---|
|  | 414 | *file << "InitRelEpsKineticE\t" << StepCounts.InitRelEpsKineticEnergy << "\t# relative change in kinetic energy" << endl; | 
|---|
|  | 415 | *file << "InitMaxMinStopStep\t" << StepCounts.InitMaxMinStopStep << "\t# check every ..th steps" << endl; | 
|---|
|  | 416 | *file << "InitMaxMinGapStopStep\t" << StepCounts.InitMaxMinGapStopStep << "\t# check every ..th steps" << endl; | 
|---|
|  | 417 | *file << endl; | 
|---|
|  | 418 | *file << "BoxLength\t\t\t# (Length of a unit cell)" << endl; | 
|---|
| [84c494] | 419 | *file << domain.at(0,0) << "\t" << endl; | 
|---|
|  | 420 | *file << domain.at(1,0) << "\t" << domain.at(1,1) << "\t" << endl; | 
|---|
|  | 421 | *file << domain.at(2,0) << "\t" << domain.at(2,1) << "\t" << domain.at(2,2) << "\t" << endl; | 
|---|
| [43dad6] | 422 | // FIXME | 
|---|
|  | 423 | *file << endl; | 
|---|
|  | 424 | *file << "ECut\t\t" << PlaneWaveSpecifics.ECut << "\t# energy cutoff for discretization in Hartrees" << endl; | 
|---|
|  | 425 | *file << "MaxLevel\t" << PlaneWaveSpecifics.MaxLevel << "\t# number of different levels in the code, >=2" << endl; | 
|---|
|  | 426 | *file << "Level0Factor\t" << PlaneWaveSpecifics.Lev0Factor << "\t# factor by which node number increases from S to 0 level" << endl; | 
|---|
|  | 427 | *file << "RiemannTensor\t" << PlaneWaveSpecifics.RiemannTensor << "\t# (Use metric)" << endl; | 
|---|
|  | 428 | switch (PlaneWaveSpecifics.RiemannTensor) { | 
|---|
|  | 429 | case 0: //UseNoRT | 
|---|
|  | 430 | break; | 
|---|
|  | 431 | case 1: // UseRT | 
|---|
|  | 432 | *file << "RiemannLevel\t" << PlaneWaveSpecifics.RiemannLevel << "\t# Number of Riemann Levels" << endl; | 
|---|
|  | 433 | *file << "LevRFactor\t" << PlaneWaveSpecifics.LevRFactor << "\t# factor by which node number increases from 0 to R level from" << endl; | 
|---|
|  | 434 | break; | 
|---|
|  | 435 | } | 
|---|
|  | 436 | *file << "PsiType\t\t" << PlaneWaveSpecifics.PsiType << "\t# 0 - doubly occupied, 1 - SpinUp,SpinDown" << endl; | 
|---|
| [650ca8c] | 437 | *file << "MaxPsiDouble\t" << PlaneWaveSpecifics.MaxPsiDouble << "\t# here: specifying both maximum number of SpinUp- and -Down-states" << endl; | 
|---|
|  | 438 | *file << "PsiMaxNoUp\t" << PlaneWaveSpecifics.PsiMaxNoUp << "\t# here: specifying maximum number of SpinUp-states" << endl; | 
|---|
|  | 439 | *file << "PsiMaxNoDown\t" << PlaneWaveSpecifics.PsiMaxNoDown << "\t# here: specifying maximum number of SpinDown-states" << endl; | 
|---|
| [43dad6] | 440 | *file << "AddPsis\t\t" << PlaneWaveSpecifics.AddPsis << "\t# Additional unoccupied Psis for bandgap determination" << endl; | 
|---|
|  | 441 | *file << endl; | 
|---|
|  | 442 | *file << "RCut\t\t" << PlaneWaveSpecifics.RCut << "\t# R-cut for the ewald summation" << endl; | 
|---|
|  | 443 | *file << "StructOpt\t" << StructOpt << "\t# Do structure optimization beforehand" << endl; | 
|---|
|  | 444 | *file << "IsAngstroem\t" << IsAngstroem << "\t# 0 - Bohr, 1 - Angstroem" << endl; | 
|---|
|  | 445 | *file << "RelativeCoord\t" << RelativeCoord << "\t# whether ion coordinates are relative (1) or absolute (0)" << endl; | 
|---|
|  | 446 | map<int, int> ZtoIndexMap; | 
|---|
|  | 447 | OutputElements(file, allatoms, ZtoIndexMap); | 
|---|
|  | 448 | OutputAtoms(file, allatoms, ZtoIndexMap); | 
|---|
|  | 449 | } else { | 
|---|
|  | 450 | DoeLog(1) && (eLog()<< Verbose(1) << "Cannot open output file." << endl); | 
|---|
|  | 451 | } | 
|---|
|  | 452 | } | 
|---|
|  | 453 |  | 
|---|
| [650ca8c] | 454 |  | 
|---|
|  | 455 | /** Counts necessary number of valence electrons and returns number and SpinType. | 
|---|
|  | 456 | * \param &allatoms all atoms to store away | 
|---|
|  | 457 | */ | 
|---|
|  | 458 | void PcpParser::CalculateOrbitals(vector<atom *> &allatoms) | 
|---|
|  | 459 | { | 
|---|
|  | 460 | PlaneWaveSpecifics.MaxPsiDouble = PlaneWaveSpecifics.PsiMaxNoDown = PlaneWaveSpecifics.PsiMaxNoUp = PlaneWaveSpecifics.PsiType = 0; | 
|---|
|  | 461 | for (vector<atom *>::iterator runner = allatoms.begin(); runner != allatoms.end(); ++runner) { | 
|---|
| [2fd80b5] | 462 | PlaneWaveSpecifics.MaxPsiDouble += (*runner)->type->NoValenceOrbitals; | 
|---|
| [650ca8c] | 463 | } | 
|---|
|  | 464 | cout << PlaneWaveSpecifics.MaxPsiDouble << endl; | 
|---|
|  | 465 | PlaneWaveSpecifics.PsiMaxNoDown = PlaneWaveSpecifics.MaxPsiDouble/2 + (PlaneWaveSpecifics.MaxPsiDouble % 2); | 
|---|
|  | 466 | PlaneWaveSpecifics.PsiMaxNoUp = PlaneWaveSpecifics.MaxPsiDouble/2; | 
|---|
|  | 467 | PlaneWaveSpecifics.MaxPsiDouble /= 2; | 
|---|
|  | 468 | PlaneWaveSpecifics.PsiType = (PlaneWaveSpecifics.PsiMaxNoDown == PlaneWaveSpecifics.PsiMaxNoUp) ? 0 : 1; | 
|---|
|  | 469 | if ((PlaneWaveSpecifics.PsiType == 1) && (Parallelization.ProcPEPsi < 2) && ((PlaneWaveSpecifics.PsiMaxNoDown != 1) || (PlaneWaveSpecifics.PsiMaxNoUp != 0))) { | 
|---|
|  | 470 | Parallelization.ProcPEGamma /= 2; | 
|---|
|  | 471 | Parallelization.ProcPEPsi *= 2; | 
|---|
|  | 472 | } else { | 
|---|
|  | 473 | Parallelization.ProcPEGamma *= Parallelization.ProcPEPsi; | 
|---|
|  | 474 | Parallelization.ProcPEPsi = 1; | 
|---|
|  | 475 | } | 
|---|
|  | 476 | cout << PlaneWaveSpecifics.PsiMaxNoDown << ">" << PlaneWaveSpecifics.PsiMaxNoUp << endl; | 
|---|
|  | 477 | if (PlaneWaveSpecifics.PsiMaxNoDown > PlaneWaveSpecifics.PsiMaxNoUp) { | 
|---|
|  | 478 | StepCounts.InitMaxMinStopStep = StepCounts.MaxMinStopStep = PlaneWaveSpecifics.PsiMaxNoDown; | 
|---|
|  | 479 | cout << PlaneWaveSpecifics.PsiMaxNoDown << " " << StepCounts.InitMaxMinStopStep << endl; | 
|---|
|  | 480 | } else { | 
|---|
|  | 481 | StepCounts.InitMaxMinStopStep = StepCounts.MaxMinStopStep = PlaneWaveSpecifics.PsiMaxNoUp; | 
|---|
|  | 482 | cout << PlaneWaveSpecifics.PsiMaxNoUp << " " << StepCounts.InitMaxMinStopStep << endl; | 
|---|
|  | 483 | } | 
|---|
|  | 484 | }; | 
|---|
|  | 485 |  | 
|---|
| [43dad6] | 486 | /** Prints MaxTypes and list of elements to strea, | 
|---|
|  | 487 | * \param *file output stream | 
|---|
|  | 488 | * \param &allatoms vector of all atoms in the system, such as by World::getAllAtoms() | 
|---|
|  | 489 | * \param &ZtoIndexMap map of which atoms belong to which ion number | 
|---|
|  | 490 | */ | 
|---|
|  | 491 | void PcpParser::OutputElements(ostream *file, vector<atom *> &allatoms, map<int, int> &ZtoIndexMap) | 
|---|
|  | 492 | { | 
|---|
|  | 493 | map<int, int> PresentElements; | 
|---|
|  | 494 | pair <   map<int, int>::iterator, bool > Inserter; | 
|---|
|  | 495 | // insert all found elements into the map | 
|---|
|  | 496 | for (vector<atom *>::iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) { | 
|---|
|  | 497 | Inserter = PresentElements.insert(pair<int, int>((*AtomRunner)->type->Z, 1)); | 
|---|
|  | 498 | if (!Inserter.second) // increase if present | 
|---|
|  | 499 | Inserter.first->second += 1; | 
|---|
|  | 500 | } | 
|---|
|  | 501 | // print total element count | 
|---|
|  | 502 | *file << "MaxTypes\t" << PresentElements.size() <<  "\t# maximum number of different ion types" << endl; | 
|---|
| [650ca8c] | 503 | *file << endl; | 
|---|
| [43dad6] | 504 | // print element list | 
|---|
|  | 505 | *file << "# Ion type data (PP = PseudoPotential, Z = atomic number)" << endl; | 
|---|
|  | 506 | *file << "#Ion_TypeNr.\tAmount\tZ\tRGauss\tL_Max(PP)L_Loc(PP)IonMass\t# chemical name, symbol" << endl; | 
|---|
|  | 507 | // elements are due to map sorted by Z value automatically, hence just count through them | 
|---|
|  | 508 | int counter = 1; | 
|---|
|  | 509 | for(map<int, int>::const_iterator iter=PresentElements.begin(); iter!=PresentElements.end();++iter) { | 
|---|
|  | 510 | const element * const elemental = World::getInstance().getPeriode()->FindElement(iter->first); | 
|---|
|  | 511 | ZtoIndexMap.insert( pair<int,int> (iter->first, counter) ); | 
|---|
|  | 512 | *file << "Ion_Type" << counter++ << "\t" << iter->second << "\t" << elemental->Z << "\t1.0\t3\t3\t" << fixed << setprecision(11) << showpoint << elemental->mass << "\t" << elemental->name << "\t" << elemental->symbol <<endl; | 
|---|
|  | 513 | } | 
|---|
|  | 514 | } | 
|---|
|  | 515 |  | 
|---|
|  | 516 | /** Output all atoms one per line. | 
|---|
|  | 517 | * \param *file output stream | 
|---|
|  | 518 | * \param &allatoms vector of all atoms in the system, such as by World::getAllAtoms() | 
|---|
|  | 519 | * \param &ZtoIndexMap map of which atoms belong to which ion number | 
|---|
|  | 520 | */ | 
|---|
|  | 521 | void PcpParser::OutputAtoms(ostream *file, vector<atom *> &allatoms, map<int, int> &ZtoIndexMap) | 
|---|
|  | 522 | { | 
|---|
|  | 523 | *file << "#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)" << endl; | 
|---|
|  | 524 | map<int, int> ZtoCountMap; | 
|---|
|  | 525 | pair <   map<int, int>::iterator, bool > Inserter; | 
|---|
| [1b2d30] | 526 | int nr = 0; | 
|---|
| [43dad6] | 527 | for (vector<atom *>::iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) { | 
|---|
|  | 528 | Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->type->Z, 1) ); | 
|---|
|  | 529 | if (!Inserter.second) | 
|---|
|  | 530 | Inserter.first->second += 1; | 
|---|
| [650ca8c] | 531 | const int Z = (*AtomRunner)->type->Z; | 
|---|
|  | 532 | *file << "Ion_Type" << ZtoIndexMap[Z] << "_" << ZtoCountMap[Z] << "\t"  << fixed << setprecision(9) << showpoint; | 
|---|
| [1b2d30] | 533 | *file << (*AtomRunner)->x[0] << "\t" << (*AtomRunner)->x[1] << "\t" << (*AtomRunner)->x[2]; | 
|---|
|  | 534 | *file << "\t" << (*AtomRunner)->FixedIon; | 
|---|
|  | 535 | if ((*AtomRunner)->v.Norm() > MYEPSILON) | 
|---|
|  | 536 | *file << "\t" << scientific << setprecision(6) << (*AtomRunner)->v[0] << "\t" << (*AtomRunner)->v[1] << "\t" << (*AtomRunner)->v[2] << "\t"; | 
|---|
|  | 537 | *file << " # molecule nr " << nr++ << endl; | 
|---|
| [43dad6] | 538 | } | 
|---|
|  | 539 | } | 
|---|
|  | 540 |  | 
|---|
|  | 541 | /** Reading of Thermostat related values from parameter file. | 
|---|
|  | 542 | * \param *fb file buffer containing the config file | 
|---|
|  | 543 | */ | 
|---|
|  | 544 | void PcpParser::ParseThermostats(class ConfigFileBuffer * const fb) | 
|---|
|  | 545 | { | 
|---|
|  | 546 | char * const thermo = new char[12]; | 
|---|
|  | 547 | const int verbose = 0; | 
|---|
|  | 548 | class ThermoStatContainer *Thermostats = World::getInstance().getThermostats(); | 
|---|
|  | 549 |  | 
|---|
|  | 550 | // read desired Thermostat from file along with needed additional parameters | 
|---|
|  | 551 | if (ParseForParameter(verbose,fb,"Thermostat", 0, 1, 1, string_type, thermo, 1, optional)) { | 
|---|
|  | 552 | if (strcmp(thermo, Thermostats->ThermostatNames[0]) == 0) { // None | 
|---|
|  | 553 | if (Thermostats->ThermostatImplemented[0] == 1) { | 
|---|
|  | 554 | Thermostats->Thermostat = None; | 
|---|
|  | 555 | } else { | 
|---|
|  | 556 | DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl); | 
|---|
|  | 557 | Thermostats->Thermostat = None; | 
|---|
|  | 558 | } | 
|---|
|  | 559 | } else if (strcmp(thermo, Thermostats->ThermostatNames[1]) == 0) { // Woodcock | 
|---|
|  | 560 | if (Thermostats->ThermostatImplemented[1] == 1) { | 
|---|
|  | 561 | Thermostats->Thermostat = Woodcock; | 
|---|
|  | 562 | ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &Thermostats->ScaleTempStep, 1, critical); // read scaling frequency | 
|---|
|  | 563 | } else { | 
|---|
|  | 564 | DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl); | 
|---|
|  | 565 | Thermostats->Thermostat = None; | 
|---|
|  | 566 | } | 
|---|
|  | 567 | } else if (strcmp(thermo, Thermostats->ThermostatNames[2]) == 0) { // Gaussian | 
|---|
|  | 568 | if (Thermostats->ThermostatImplemented[2] == 1) { | 
|---|
|  | 569 | Thermostats->Thermostat = Gaussian; | 
|---|
|  | 570 | ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &Thermostats->ScaleTempStep, 1, critical); // read collision rate | 
|---|
|  | 571 | } else { | 
|---|
|  | 572 | DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl); | 
|---|
|  | 573 | Thermostats->Thermostat = None; | 
|---|
|  | 574 | } | 
|---|
|  | 575 | } else if (strcmp(thermo, Thermostats->ThermostatNames[3]) == 0) { // Langevin | 
|---|
|  | 576 | if (Thermostats->ThermostatImplemented[3] == 1) { | 
|---|
|  | 577 | Thermostats->Thermostat = Langevin; | 
|---|
|  | 578 | ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &Thermostats->TempFrequency, 1, critical); // read gamma | 
|---|
|  | 579 | if (ParseForParameter(verbose,fb,"Thermostat", 0, 3, 1, double_type, &Thermostats->alpha, 1, optional)) { | 
|---|
|  | 580 | DoLog(2) && (Log() << Verbose(2) << "Extended Stochastic Thermostat detected with interpolation coefficient " << Thermostats->alpha << "." << endl); | 
|---|
|  | 581 | } else { | 
|---|
|  | 582 | Thermostats->alpha = 1.; | 
|---|
|  | 583 | } | 
|---|
|  | 584 | } else { | 
|---|
|  | 585 | DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl); | 
|---|
|  | 586 | Thermostats->Thermostat = None; | 
|---|
|  | 587 | } | 
|---|
|  | 588 | } else if (strcmp(thermo, Thermostats->ThermostatNames[4]) == 0) { // Berendsen | 
|---|
|  | 589 | if (Thermostats->ThermostatImplemented[4] == 1) { | 
|---|
|  | 590 | Thermostats->Thermostat = Berendsen; | 
|---|
|  | 591 | ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &Thermostats->TempFrequency, 1, critical); // read \tau_T | 
|---|
|  | 592 | } else { | 
|---|
|  | 593 | DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl); | 
|---|
|  | 594 | Thermostats->Thermostat = None; | 
|---|
|  | 595 | } | 
|---|
|  | 596 | } else if (strcmp(thermo, Thermostats->ThermostatNames[5]) == 0) { // Nose-Hoover | 
|---|
|  | 597 | if (Thermostats->ThermostatImplemented[5] == 1) { | 
|---|
|  | 598 | Thermostats->Thermostat = NoseHoover; | 
|---|
|  | 599 | ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &Thermostats->HooverMass, 1, critical); // read Hoovermass | 
|---|
|  | 600 | Thermostats->alpha = 0.; | 
|---|
|  | 601 | } else { | 
|---|
|  | 602 | DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl); | 
|---|
|  | 603 | Thermostats->Thermostat = None; | 
|---|
|  | 604 | } | 
|---|
|  | 605 | } else { | 
|---|
|  | 606 | DoLog(1) && (Log() << Verbose(1) << " Warning: thermostat name was not understood!" << endl); | 
|---|
|  | 607 | Thermostats->Thermostat = None; | 
|---|
|  | 608 | } | 
|---|
|  | 609 | } else { | 
|---|
|  | 610 | if ((Thermostats->TargetTemp != 0)) | 
|---|
|  | 611 | DoLog(2) && (Log() << Verbose(2) <<  "No thermostat chosen despite finite temperature MD, falling back to None." << endl); | 
|---|
|  | 612 | Thermostats->Thermostat = None; | 
|---|
|  | 613 | } | 
|---|
|  | 614 | delete[](thermo); | 
|---|
|  | 615 | }; | 
|---|
|  | 616 |  | 
|---|
| [1b2d30] | 617 | bool PcpParser::operator==(const PcpParser& b) const | 
|---|
|  | 618 | { | 
|---|
|  | 619 | ASSERT(Parallelization.ProcPEGamma == b.Parallelization.ProcPEGamma, "PcpParser ==: ProcPEGamma not"); | 
|---|
|  | 620 | ASSERT(Parallelization.ProcPEPsi == b.Parallelization.ProcPEPsi, "PcpParser ==: ProcPEPsi not"); | 
|---|
|  | 621 |  | 
|---|
|  | 622 | if ((Paths.databasepath != NULL) && (b.Paths.databasepath != NULL)) | 
|---|
|  | 623 | ASSERT(strcmp(Paths.databasepath, b.Paths.databasepath), "PcpParser ==: databasepath not"); | 
|---|
|  | 624 | if ((Paths.configname != NULL) && (b.Paths.configname != NULL)) | 
|---|
|  | 625 | ASSERT(strcmp(Paths.configname, b.Paths.configname), "PcpParser ==: configname not"); | 
|---|
|  | 626 | if ((Paths.mainname != NULL) && (b.Paths.mainname != NULL)) | 
|---|
|  | 627 | ASSERT(strcmp(Paths.mainname, b.Paths.mainname), "PcpParser ==: mainname not"); | 
|---|
|  | 628 | if ((Paths.defaultpath != NULL) && (b.Paths.defaultpath != NULL)) | 
|---|
|  | 629 | ASSERT(strcmp(Paths.defaultpath, b.Paths.defaultpath), "PcpParser ==: defaultpath not"); | 
|---|
|  | 630 | if ((Paths.pseudopotpath != NULL) && (b.Paths.pseudopotpath != NULL)) | 
|---|
|  | 631 | ASSERT(strcmp(Paths.pseudopotpath, b.Paths.pseudopotpath), "PcpParser ==: pseudopotpath not"); | 
|---|
|  | 632 |  | 
|---|
|  | 633 | ASSERT(Switches.DoConstrainedMD == b.Switches.DoConstrainedMD, "PcpParser ==: DoConstrainedMD not"); | 
|---|
|  | 634 | ASSERT(Switches.DoOutVis == b.Switches.DoOutVis, "PcpParser ==: DoOutVis not"); | 
|---|
|  | 635 | ASSERT(Switches.DoOutMes == b.Switches.DoOutMes, "PcpParser ==: DoOutMes not"); | 
|---|
|  | 636 | ASSERT(Switches.DoOutNICS == b.Switches.DoOutNICS, "PcpParser ==: DoOutNICS not"); | 
|---|
|  | 637 | ASSERT(Switches.DoOutOrbitals == b.Switches.DoOutOrbitals, "PcpParser ==: DoOutOrbitals not"); | 
|---|
|  | 638 | ASSERT(Switches.DoOutCurrent == b.Switches.DoOutCurrent, "PcpParser ==: DoOutCurrent not"); | 
|---|
|  | 639 | ASSERT(Switches.DoFullCurrent == b.Switches.DoFullCurrent, "PcpParser ==: DoFullCurrent not"); | 
|---|
|  | 640 | ASSERT(Switches.DoPerturbation == b.Switches.DoPerturbation, "PcpParser ==: DoPerturbation not"); | 
|---|
|  | 641 | ASSERT(Switches.DoWannier == b.Switches.DoWannier, "PcpParser ==: DoWannier not"); | 
|---|
|  | 642 |  | 
|---|
|  | 643 | ASSERT(LocalizedOrbitals.CommonWannier == b.LocalizedOrbitals.CommonWannier, "PcpParser ==: CommonWannier not"); | 
|---|
|  | 644 | ASSERT(LocalizedOrbitals.SawtoothStart == b.LocalizedOrbitals.SawtoothStart, "PcpParser ==: SawtoothStart not"); | 
|---|
|  | 645 | ASSERT(LocalizedOrbitals.VectorPlane == b.LocalizedOrbitals.VectorPlane, "PcpParser ==: VectorPlane not"); | 
|---|
|  | 646 | ASSERT(LocalizedOrbitals.VectorCut == b.LocalizedOrbitals.VectorCut, "PcpParser ==: VectorCut not"); | 
|---|
|  | 647 | ASSERT(LocalizedOrbitals.UseAddGramSch == b.LocalizedOrbitals.UseAddGramSch, "PcpParser ==: UseAddGramSch not"); | 
|---|
|  | 648 | ASSERT(LocalizedOrbitals.Seed == b.LocalizedOrbitals.Seed, "PcpParser ==: Seed not"); | 
|---|
|  | 649 | ASSERT(LocalizedOrbitals.EpsWannier == b.LocalizedOrbitals.EpsWannier, "PcpParser ==: EpsWannier not"); | 
|---|
|  | 650 |  | 
|---|
|  | 651 | ASSERT(StepCounts.MaxMinStopStep == b.StepCounts.MaxMinStopStep, "PcpParser ==: MaxMinStopStep not"); | 
|---|
|  | 652 | ASSERT(StepCounts.InitMaxMinStopStep == b.StepCounts.InitMaxMinStopStep, "PcpParser ==: InitMaxMinStopStep not"); | 
|---|
|  | 653 | ASSERT(StepCounts.OutVisStep == b.StepCounts.OutVisStep, "PcpParser ==: OutVisStep not"); | 
|---|
|  | 654 | ASSERT(StepCounts.OutSrcStep == b.StepCounts.OutSrcStep, "PcpParser ==: OutSrcStep not"); | 
|---|
|  | 655 | ASSERT(StepCounts.MaxPsiStep == b.StepCounts.MaxPsiStep, "PcpParser ==: MaxPsiStep not"); | 
|---|
|  | 656 | ASSERT(StepCounts.MaxOuterStep == b.StepCounts.MaxOuterStep, "PcpParser ==: MaxOuterStep not"); | 
|---|
|  | 657 | ASSERT(StepCounts.MaxMinStep == b.StepCounts.MaxMinStep, "PcpParser ==: MaxMinStep not"); | 
|---|
|  | 658 | ASSERT(StepCounts.RelEpsTotalEnergy == b.StepCounts.RelEpsTotalEnergy, "PcpParser ==: RelEpsTotalEnergy not"); | 
|---|
|  | 659 | ASSERT(StepCounts.MaxMinGapStopStep == b.StepCounts.MaxMinGapStopStep, "PcpParser ==: MaxMinGapStopStep not"); | 
|---|
|  | 660 | ASSERT(StepCounts.MaxInitMinStep == b.StepCounts.MaxInitMinStep, "PcpParser ==: MaxInitMinStep not"); | 
|---|
|  | 661 | ASSERT(StepCounts.InitRelEpsTotalEnergy == b.StepCounts.InitRelEpsTotalEnergy, "PcpParser ==: InitRelEpsTotalEnergy not"); | 
|---|
|  | 662 | ASSERT(StepCounts.InitRelEpsKineticEnergy == b.StepCounts.InitRelEpsKineticEnergy, "PcpParser ==: InitRelEpsKineticEnergy not"); | 
|---|
|  | 663 | ASSERT(StepCounts.InitMaxMinGapStopStep == b.StepCounts.InitMaxMinGapStopStep, "PcpParser ==: InitMaxMinGapStopStep not"); | 
|---|
|  | 664 |  | 
|---|
|  | 665 | ASSERT(PlaneWaveSpecifics.PsiType == b.PlaneWaveSpecifics.PsiType, "PcpParser ==: PsiType not"); | 
|---|
|  | 666 | ASSERT(PlaneWaveSpecifics.MaxPsiDouble == b.PlaneWaveSpecifics.MaxPsiDouble, "PcpParser ==: MaxPsiDouble not"); | 
|---|
|  | 667 | ASSERT(PlaneWaveSpecifics.PsiMaxNoUp == b.PlaneWaveSpecifics.PsiMaxNoUp, "PcpParser ==: PsiMaxNoUp not"); | 
|---|
|  | 668 | ASSERT(PlaneWaveSpecifics.PsiMaxNoDown == b.PlaneWaveSpecifics.PsiMaxNoDown, "PcpParser ==: PsiMaxNoDown not"); | 
|---|
|  | 669 | ASSERT(PlaneWaveSpecifics.ECut == b.PlaneWaveSpecifics.ECut, "PcpParser ==: ECut not"); | 
|---|
|  | 670 | ASSERT(PlaneWaveSpecifics.MaxLevel == b.PlaneWaveSpecifics.MaxLevel, "PcpParser ==: MaxLevel not"); | 
|---|
|  | 671 | ASSERT(PlaneWaveSpecifics.RiemannTensor == b.PlaneWaveSpecifics.RiemannTensor, "PcpParser ==: RiemannTensor not"); | 
|---|
|  | 672 | ASSERT(PlaneWaveSpecifics.LevRFactor == b.PlaneWaveSpecifics.LevRFactor, "PcpParser ==: LevRFactor not"); | 
|---|
|  | 673 | ASSERT(PlaneWaveSpecifics.RiemannLevel == b.PlaneWaveSpecifics.RiemannLevel, "PcpParser ==: RiemannLevel not"); | 
|---|
|  | 674 | ASSERT(PlaneWaveSpecifics.Lev0Factor == b.PlaneWaveSpecifics.Lev0Factor, "PcpParser ==: Lev0Factor not"); | 
|---|
|  | 675 | ASSERT(PlaneWaveSpecifics.RTActualUse == b.PlaneWaveSpecifics.RTActualUse, "PcpParser ==: RTActualUse not"); | 
|---|
|  | 676 | ASSERT(PlaneWaveSpecifics.AddPsis == b.PlaneWaveSpecifics.AddPsis, "PcpParser ==: AddPsis not"); | 
|---|
|  | 677 | ASSERT(PlaneWaveSpecifics.AddPsis == b.PlaneWaveSpecifics.AddPsis, "PcpParser ==: AddPsis not"); | 
|---|
|  | 678 | ASSERT(PlaneWaveSpecifics.RCut == b.PlaneWaveSpecifics.RCut, "PcpParser ==: RCut not"); | 
|---|
|  | 679 |  | 
|---|
|  | 680 | ASSERT(FastParsing == b.FastParsing, "PcpParser ==: FastParsing not"); | 
|---|
|  | 681 |  | 
|---|
|  | 682 | ASSERT(Deltat == b.Deltat, "PcpParser ==: Deltat not"); | 
|---|
|  | 683 | ASSERT(IsAngstroem == b.IsAngstroem, "PcpParser ==: IsAngstroem not"); | 
|---|
|  | 684 | ASSERT(RelativeCoord == b.RelativeCoord, "PcpParser ==: RelativeCoord not"); | 
|---|
|  | 685 | ASSERT(StructOpt == b.StructOpt, "PcpParser ==: StructOpt not"); | 
|---|
|  | 686 | ASSERT(MaxTypes == b.MaxTypes, "PcpParser ==: MaxTypes not"); | 
|---|
|  | 687 | ASSERT(basis == b.basis, "PcpParser ==: basis not"); | 
|---|
|  | 688 |  | 
|---|
|  | 689 | return true; | 
|---|
|  | 690 | } | 
|---|