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