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