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