Changeset 8d1dd4


Ignore:
Timestamp:
Aug 25, 2010, 10:42:21 AM (14 years ago)
Author:
Tillmann Crueger <crueger@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
14c57a
Parents:
3e4162
Message:

Removed obsolete load methods from config class

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/config.cpp

    r3e4162 r8d1dd4  
    622622};
    623623
    624 
    625 /** Initializes config file structure by loading elements from a give file.
    626  * \param *file input file stream being the opened config file
    627  * \param BondGraphFileName file name of the bond length table file, if string is left blank, no table is parsed.
    628  * \param *periode pointer to a periodentafel class with all elements
    629  * \param *&MolList pointer to MoleculeListClass, on return containing all parsed molecules in system
    630  */
    631 void config::Load(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList)
    632 {
    633   molecule *mol = World::getInstance().createMolecule();
    634   ifstream *file = new ifstream(filename);
    635   if (file == NULL) {
    636     DoeLog(1) && (eLog()<< Verbose(1) << "config file " << filename << " missing!" << endl);
    637     return;
    638   }
    639   file->close();
    640   delete(file);
    641 
    642   // ParseParameterFile
    643   class ConfigFileBuffer *FileBuffer = new ConfigFileBuffer(filename);
    644 
    645   /* Oeffne Hauptparameterdatei */
    646   int di = 0;
    647   double BoxLength[9];
    648   string zeile;
    649   string dummy;
    650   int verbose = 0;
    651  
    652   //TODO: This is actually sensible?: if (MaxOuterStep > 0)
    653   ParseThermostats(FileBuffer);
    654  
    655   /* Namen einlesen */
    656 
    657   // 1. parse in options
    658   ParseForParameter(verbose,FileBuffer, "mainname", 0, 1, 1, string_type, (config::mainname), 1, critical);
    659   ParseForParameter(verbose,FileBuffer, "defaultpath", 0, 1, 1, string_type, (config::defaultpath), 1, critical);
    660   ParseForParameter(verbose,FileBuffer, "pseudopotpath", 0, 1, 1, string_type, (config::pseudopotpath), 1, critical);
    661   ParseForParameter(verbose,FileBuffer,"ProcPEGamma", 0, 1, 1, int_type, &(config::ProcPEGamma), 1, critical);
    662   ParseForParameter(verbose,FileBuffer,"ProcPEPsi", 0, 1, 1, int_type, &(config::ProcPEPsi), 1, critical);
    663 
    664   if (!ParseForParameter(verbose,FileBuffer,"Seed", 0, 1, 1, int_type, &(config::Seed), 1, optional))
    665     config::Seed = 1;
    666 
    667   if(!ParseForParameter(verbose,FileBuffer,"DoOutOrbitals", 0, 1, 1, int_type, &(config::DoOutOrbitals), 1, optional)) {
    668     config::DoOutOrbitals = 0;
    669   } else {
    670     if (config::DoOutOrbitals < 0) config::DoOutOrbitals = 0;
    671     if (config::DoOutOrbitals > 1) config::DoOutOrbitals = 1;
    672   }
    673   ParseForParameter(verbose,FileBuffer,"DoOutVis", 0, 1, 1, int_type, &(config::DoOutVis), 1, critical);
    674   if (config::DoOutVis < 0) config::DoOutVis = 0;
    675   if (config::DoOutVis > 1) config::DoOutVis = 1;
    676   if (!ParseForParameter(verbose,FileBuffer,"VectorPlane", 0, 1, 1, int_type, &(config::VectorPlane), 1, optional))
    677     config::VectorPlane = -1;
    678   if (!ParseForParameter(verbose,FileBuffer,"VectorCut", 0, 1, 1, double_type, &(config::VectorCut), 1, optional))
    679     config::VectorCut = 0.;
    680   ParseForParameter(verbose,FileBuffer,"DoOutMes", 0, 1, 1, int_type, &(config::DoOutMes), 1, critical);
    681   if (config::DoOutMes < 0) config::DoOutMes = 0;
    682   if (config::DoOutMes > 1) config::DoOutMes = 1;
    683   if (!ParseForParameter(verbose,FileBuffer,"DoOutCurr", 0, 1, 1, int_type, &(config::DoOutCurrent), 1, optional))
    684     config::DoOutCurrent = 0;
    685   if (config::DoOutCurrent < 0) config::DoOutCurrent = 0;
    686   if (config::DoOutCurrent > 1) config::DoOutCurrent = 1;
    687   ParseForParameter(verbose,FileBuffer,"AddGramSch", 0, 1, 1, int_type, &(config::UseAddGramSch), 1, critical);
    688   if (config::UseAddGramSch < 0) config::UseAddGramSch = 0;
    689   if (config::UseAddGramSch > 2) config::UseAddGramSch = 2;
    690   if(!ParseForParameter(verbose,FileBuffer,"DoWannier", 0, 1, 1, int_type, &(config::DoWannier), 1, optional)) {
    691     config::DoWannier = 0;
    692   } else {
    693     if (config::DoWannier < 0) config::DoWannier = 0;
    694     if (config::DoWannier > 1) config::DoWannier = 1;
    695   }
    696   if(!ParseForParameter(verbose,FileBuffer,"CommonWannier", 0, 1, 1, int_type, &(config::CommonWannier), 1, optional)) {
    697     config::CommonWannier = 0;
    698   } else {
    699     if (config::CommonWannier < 0) config::CommonWannier = 0;
    700     if (config::CommonWannier > 4) config::CommonWannier = 4;
    701   }
    702   if(!ParseForParameter(verbose,FileBuffer,"SawtoothStart", 0, 1, 1, double_type, &(config::SawtoothStart), 1, optional)) {
    703     config::SawtoothStart = 0.01;
    704   } else {
    705     if (config::SawtoothStart < 0.) config::SawtoothStart = 0.;
    706     if (config::SawtoothStart > 1.) config::SawtoothStart = 1.;
    707   }
    708  
    709   if (ParseForParameter(verbose,FileBuffer,"DoConstrainedMD", 0, 1, 1, int_type, &(config::DoConstrainedMD), 1, optional))
    710     if (config::DoConstrainedMD < 0)
    711       config::DoConstrainedMD = 0;
    712   ParseForParameter(verbose,FileBuffer,"MaxOuterStep", 0, 1, 1, int_type, &(config::MaxOuterStep), 1, critical);
    713   if (!ParseForParameter(verbose,FileBuffer,"Deltat", 0, 1, 1, double_type, &(config::Deltat), 1, optional))
    714     config::Deltat = 1;
    715   ParseForParameter(verbose,FileBuffer,"OutVisStep", 0, 1, 1, int_type, &(config::OutVisStep), 1, optional);
    716   ParseForParameter(verbose,FileBuffer,"OutSrcStep", 0, 1, 1, int_type, &(config::OutSrcStep), 1, optional);
    717   ParseForParameter(verbose,FileBuffer,"TargetTemp", 0, 1, 1, double_type, &(Thermostats->TargetTemp), 1, optional);
    718   //ParseForParameter(verbose,FileBuffer,"Thermostat", 0, 1, 1, int_type, &(config::ScaleTempStep), 1, optional);
    719   if (!ParseForParameter(verbose,FileBuffer,"EpsWannier", 0, 1, 1, double_type, &(config::EpsWannier), 1, optional))
    720     config::EpsWannier = 1e-8;
    721 
    722   // stop conditions
    723   //if (config::MaxOuterStep <= 0) config::MaxOuterStep = 1;
    724   ParseForParameter(verbose,FileBuffer,"MaxPsiStep", 0, 1, 1, int_type, &(config::MaxPsiStep), 1, critical);
    725   if (config::MaxPsiStep <= 0) config::MaxPsiStep = 3;
    726 
    727   ParseForParameter(verbose,FileBuffer,"MaxMinStep", 0, 1, 1, int_type, &(config::MaxMinStep), 1, critical);
    728   ParseForParameter(verbose,FileBuffer,"RelEpsTotalE", 0, 1, 1, double_type, &(config::RelEpsTotalEnergy), 1, critical);
    729   ParseForParameter(verbose,FileBuffer,"RelEpsKineticE", 0, 1, 1, double_type, &(config::RelEpsKineticEnergy), 1, critical);
    730   ParseForParameter(verbose,FileBuffer,"MaxMinStopStep", 0, 1, 1, int_type, &(config::MaxMinStopStep), 1, critical);
    731   ParseForParameter(verbose,FileBuffer,"MaxMinGapStopStep", 0, 1, 1, int_type, &(config::MaxMinGapStopStep), 1, critical);
    732   if (config::MaxMinStep <= 0) config::MaxMinStep = config::MaxPsiStep;
    733   if (config::MaxMinStopStep < 1) config::MaxMinStopStep = 1;
    734   if (config::MaxMinGapStopStep < 1) config::MaxMinGapStopStep = 1;
    735 
    736   ParseForParameter(verbose,FileBuffer,"MaxInitMinStep", 0, 1, 1, int_type, &(config::MaxInitMinStep), 1, critical);
    737   ParseForParameter(verbose,FileBuffer,"InitRelEpsTotalE", 0, 1, 1, double_type, &(config::InitRelEpsTotalEnergy), 1, critical);
    738   ParseForParameter(verbose,FileBuffer,"InitRelEpsKineticE", 0, 1, 1, double_type, &(config::InitRelEpsKineticEnergy), 1, critical);
    739   ParseForParameter(verbose,FileBuffer,"InitMaxMinStopStep", 0, 1, 1, int_type, &(config::InitMaxMinStopStep), 1, critical);
    740   ParseForParameter(verbose,FileBuffer,"InitMaxMinGapStopStep", 0, 1, 1, int_type, &(config::InitMaxMinGapStopStep), 1, critical);
    741   if (config::MaxInitMinStep <= 0) config::MaxInitMinStep = config::MaxPsiStep;
    742   if (config::InitMaxMinStopStep < 1) config::InitMaxMinStopStep = 1;
    743   if (config::InitMaxMinGapStopStep < 1) config::InitMaxMinGapStopStep = 1;
    744 
    745   // Unit cell and magnetic field
    746   ParseForParameter(verbose,FileBuffer, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */
    747   double * cell_size = new double[6];
    748   cell_size[0] = BoxLength[0];
    749   cell_size[1] = BoxLength[3];
    750   cell_size[2] = BoxLength[4];
    751   cell_size[3] = BoxLength[6];
    752   cell_size[4] = BoxLength[7];
    753   cell_size[5] = BoxLength[8];
    754   World::getInstance().setDomain(cell_size);
    755   delete cell_size;
    756   //if (1) fprintf(stderr,"\n");
    757 
    758   ParseForParameter(verbose,FileBuffer,"DoPerturbation", 0, 1, 1, int_type, &(config::DoPerturbation), 1, optional);
    759   ParseForParameter(verbose,FileBuffer,"DoOutNICS", 0, 1, 1, int_type, &(config::DoOutNICS), 1, optional);
    760   if (!ParseForParameter(verbose,FileBuffer,"DoFullCurrent", 0, 1, 1, int_type, &(config::DoFullCurrent), 1, optional))
    761     config::DoFullCurrent = 0;
    762   if (config::DoFullCurrent < 0) config::DoFullCurrent = 0;
    763   if (config::DoFullCurrent > 2) config::DoFullCurrent = 2;
    764   if (config::DoOutNICS < 0) config::DoOutNICS = 0;
    765   if (config::DoOutNICS > 2) config::DoOutNICS = 2;
    766   if (config::DoPerturbation == 0) {
    767     config::DoFullCurrent = 0;
    768     config::DoOutNICS = 0;
    769   }
    770 
    771   ParseForParameter(verbose,FileBuffer,"ECut", 0, 1, 1, double_type, &(config::ECut), 1, critical);
    772   ParseForParameter(verbose,FileBuffer,"MaxLevel", 0, 1, 1, int_type, &(config::MaxLevel), 1, critical);
    773   ParseForParameter(verbose,FileBuffer,"Level0Factor", 0, 1, 1, int_type, &(config::Lev0Factor), 1, critical);
    774   if (config::Lev0Factor < 2) {
    775     config::Lev0Factor = 2;
    776   }
    777   ParseForParameter(verbose,FileBuffer,"RiemannTensor", 0, 1, 1, int_type, &di, 1, critical);
    778   if (di >= 0 && di < 2) {
    779     config::RiemannTensor = di;
    780   } else {
    781     fprintf(stderr, "0 <= RiemanTensor < 2: 0 UseNotRT, 1 UseRT");
    782     exit(1);
    783   }
    784   switch (config::RiemannTensor) {
    785     case 0: //UseNoRT
    786       if (config::MaxLevel < 2) {
    787         config::MaxLevel = 2;
    788       }
    789       config::LevRFactor = 2;
    790       config::RTActualUse = 0;
    791       break;
    792     case 1: // UseRT
    793       if (config::MaxLevel < 3) {
    794         config::MaxLevel = 3;
    795       }
    796       ParseForParameter(verbose,FileBuffer,"RiemannLevel", 0, 1, 1, int_type, &(config::RiemannLevel), 1, critical);
    797       if (config::RiemannLevel < 2) {
    798         config::RiemannLevel = 2;
    799       }
    800       if (config::RiemannLevel > config::MaxLevel-1) {
    801         config::RiemannLevel = config::MaxLevel-1;
    802       }
    803       ParseForParameter(verbose,FileBuffer,"LevRFactor", 0, 1, 1, int_type, &(config::LevRFactor), 1, critical);
    804       if (config::LevRFactor < 2) {
    805         config::LevRFactor = 2;
    806       }
    807       config::Lev0Factor = 2;
    808       config::RTActualUse = 2;
    809       break;
    810   }
    811   ParseForParameter(verbose,FileBuffer,"PsiType", 0, 1, 1, int_type, &di, 1, critical);
    812   if (di >= 0 && di < 2) {
    813     config::PsiType = di;
    814   } else {
    815     fprintf(stderr, "0 <= PsiType < 2: 0 UseSpinDouble, 1 UseSpinUpDown");
    816     exit(1);
    817   }
    818   switch (config::PsiType) {
    819   case 0: // SpinDouble
    820     ParseForParameter(verbose,FileBuffer,"MaxPsiDouble", 0, 1, 1, int_type, &(config::MaxPsiDouble), 1, critical);
    821     ParseForParameter(verbose,FileBuffer,"AddPsis", 0, 1, 1, int_type, &(config::AddPsis), 1, optional);
    822     break;
    823   case 1: // SpinUpDown
    824     if (config::ProcPEGamma % 2) config::ProcPEGamma*=2;
    825     ParseForParameter(verbose,FileBuffer,"PsiMaxNoUp", 0, 1, 1, int_type, &(config::PsiMaxNoUp), 1, critical);
    826     ParseForParameter(verbose,FileBuffer,"PsiMaxNoDown", 0, 1, 1, int_type, &(config::PsiMaxNoDown), 1, critical);
    827     ParseForParameter(verbose,FileBuffer,"AddPsis", 0, 1, 1, int_type, &(config::AddPsis), 1, optional);
    828     break;
    829   }
    830 
    831   // IonsInitRead
    832 
    833   ParseForParameter(verbose,FileBuffer,"RCut", 0, 1, 1, double_type, &(config::RCut), 1, critical);
    834   ParseForParameter(verbose,FileBuffer,"IsAngstroem", 0, 1, 1, int_type, &(config::IsAngstroem), 1, critical);
    835   ParseForParameter(verbose,FileBuffer,"MaxTypes", 0, 1, 1, int_type, &(MaxTypes), 1, critical);
    836   if (!ParseForParameter(verbose,FileBuffer,"RelativeCoord", 0, 1, 1, int_type, &(config::RelativeCoord) , 1, optional))
    837     config::RelativeCoord = 0;
    838   if (!ParseForParameter(verbose,FileBuffer,"StructOpt", 0, 1, 1, int_type, &(config::StructOpt), 1, optional))
    839     config::StructOpt = 0;
    840 
    841   // 2. parse the bond graph file if given
    842   if (BG == NULL) {
    843     BG = new BondGraph(IsAngstroem);
    844     if (BG->LoadBondLengthTable(BondGraphFileName)) {
    845       DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl);
    846     } else {
    847       DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl);
    848     }
    849   }
    850 
    851   // 3. parse the molecule in
    852   LoadMolecule(mol, FileBuffer, periode, FastParsing);
    853   mol->SetNameFromFilename(filename);
    854   mol->ActiveFlag = true;
    855   MolList->insert(mol);
    856 
    857   // 4. dissect the molecule into connected subgraphs
    858   // don't do this here ...
    859   //FragmentationSubgraphDissection();
    860   //delete(mol);
    861 
    862   delete(FileBuffer);
    863 };
    864 
    865 /** Initializes config file structure by loading elements from a give file with old pcp syntax.
    866  * \param *file input file stream being the opened config file with old pcp syntax
    867  * \param BondGraphFileName file name of the bond length table file, if string is left blank, no table is parsed.
    868  * \param *periode pointer to a periodentafel class with all elements
    869  * \param *&MolList pointer to MoleculeListClass, on return containing all parsed molecules in system
    870  */
    871 void config::LoadOld(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList)
    872 {
    873   molecule *mol = World::getInstance().createMolecule();
    874   ifstream *file = new ifstream(filename);
    875   if (file == NULL) {
    876     DoeLog(1) && (eLog()<< Verbose(1) << "config file " << filename << " missing!" << endl);
    877     return;
    878   }
    879   // ParseParameters
    880 
    881   /* Oeffne Hauptparameterdatei */
    882   int l = 0;
    883   int i = 0;
    884   int di = 0;
    885   double a = 0.;
    886   double b = 0.;
    887   double BoxLength[9];
    888   string zeile;
    889   string dummy;
    890   const element *elementhash[128];
    891   int Z = -1;
    892   int No = -1;
    893   int AtomNo = -1;
    894   int found = 0;
    895   int verbose = 0;
    896 
    897   mol->ActiveFlag = true;
    898   MolList->insert(mol);
    899   /* Namen einlesen */
    900 
    901   ParseForParameter(verbose,file, "mainname", 0, 1, 1, string_type, (config::mainname), 1, critical);
    902   ParseForParameter(verbose,file, "defaultpath", 0, 1, 1, string_type, (config::defaultpath), 1, critical);
    903   ParseForParameter(verbose,file, "pseudopotpath", 0, 1, 1, string_type, (config::pseudopotpath), 1, critical);
    904   ParseForParameter(verbose,file, "ProcsGammaPsi", 0, 1, 1, int_type, &(config::ProcPEGamma), 1, critical);
    905   ParseForParameter(verbose,file, "ProcsGammaPsi", 0, 2, 1, int_type, &(config::ProcPEPsi), 1, critical);
    906   config::Seed = 1;
    907   config::DoOutOrbitals = 0;
    908   ParseForParameter(verbose,file,"DoOutVis", 0, 1, 1, int_type, &(config::DoOutVis), 1, critical);
    909   if (config::DoOutVis < 0) config::DoOutVis = 0;
    910   if (config::DoOutVis > 1) config::DoOutVis = 1;
    911   config::VectorPlane = -1;
    912   config::VectorCut = 0.;
    913   ParseForParameter(verbose,file,"DoOutMes", 0, 1, 1, int_type, &(config::DoOutMes), 1, critical);
    914   if (config::DoOutMes < 0) config::DoOutMes = 0;
    915   if (config::DoOutMes > 1) config::DoOutMes = 1;
    916   config::DoOutCurrent = 0;
    917   ParseForParameter(verbose,file,"AddGramSch", 0, 1, 1, int_type, &(config::UseAddGramSch), 1, critical);
    918   if (config::UseAddGramSch < 0) config::UseAddGramSch = 0;
    919   if (config::UseAddGramSch > 2) config::UseAddGramSch = 2;
    920   config::CommonWannier = 0;
    921   config::SawtoothStart = 0.01;
    922 
    923   ParseForParameter(verbose,file,"MaxOuterStep", 0, 1, 1, double_type, &(config::MaxOuterStep), 1, critical);
    924   ParseForParameter(verbose,file,"Deltat", 0, 1, 1, double_type, &(config::Deltat), 1, optional);
    925   ParseForParameter(verbose,file,"VisOuterStep", 0, 1, 1, int_type, &(config::OutVisStep), 1, optional);
    926   ParseForParameter(verbose,file,"VisSrcOuterStep", 0, 1, 1, int_type, &(config::OutSrcStep), 1, optional);
    927   ParseForParameter(verbose,file,"TargetTemp", 0, 1, 1, double_type, &(Thermostats->TargetTemp), 1, optional);
    928   ParseForParameter(verbose,file,"ScaleTempStep", 0, 1, 1, int_type, &(Thermostats->ScaleTempStep), 1, optional);
    929   config::EpsWannier = 1e-8;
    930 
    931   // stop conditions
    932   //if (config::MaxOuterStep <= 0) config::MaxOuterStep = 1;
    933   ParseForParameter(verbose,file,"MaxPsiStep", 0, 1, 1, int_type, &(config::MaxPsiStep), 1, critical);
    934   if (config::MaxPsiStep <= 0) config::MaxPsiStep = 3;
    935 
    936   ParseForParameter(verbose,file,"MaxMinStep", 0, 1, 1, int_type, &(config::MaxMinStep), 1, critical);
    937   ParseForParameter(verbose,file,"MaxMinStep", 0, 2, 1, double_type, &(config::RelEpsTotalEnergy), 1, critical);
    938   ParseForParameter(verbose,file,"MaxMinStep", 0, 3, 1, double_type, &(config::RelEpsKineticEnergy), 1, critical);
    939   ParseForParameter(verbose,file,"MaxMinStep", 0, 4, 1, int_type, &(config::MaxMinStopStep), 1, critical);
    940   if (config::MaxMinStep <= 0) config::MaxMinStep = config::MaxPsiStep;
    941   if (config::MaxMinStopStep < 1) config::MaxMinStopStep = 1;
    942   config::MaxMinGapStopStep = 1;
    943 
    944   ParseForParameter(verbose,file,"MaxInitMinStep", 0, 1, 1, int_type, &(config::MaxInitMinStep), 1, critical);
    945   ParseForParameter(verbose,file,"MaxInitMinStep", 0, 2, 1, double_type, &(config::InitRelEpsTotalEnergy), 1, critical);
    946   ParseForParameter(verbose,file,"MaxInitMinStep", 0, 3, 1, double_type, &(config::InitRelEpsKineticEnergy), 1, critical);
    947   ParseForParameter(verbose,file,"MaxInitMinStep", 0, 4, 1, int_type, &(config::InitMaxMinStopStep), 1, critical);
    948   if (config::MaxInitMinStep <= 0) config::MaxInitMinStep = config::MaxPsiStep;
    949   if (config::InitMaxMinStopStep < 1) config::InitMaxMinStopStep = 1;
    950   config::InitMaxMinGapStopStep = 1;
    951 
    952   ParseForParameter(verbose,file, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */
    953   double * cell_size = new double[6];
    954   cell_size[0] = BoxLength[0];
    955   cell_size[1] = BoxLength[3];
    956   cell_size[2] = BoxLength[4];
    957   cell_size[3] = BoxLength[6];
    958   cell_size[4] = BoxLength[7];
    959   cell_size[5] = BoxLength[8];
    960   World::getInstance().setDomain(cell_size);
    961   delete[] cell_size;
    962   if (1) fprintf(stderr,"\n");
    963   config::DoPerturbation = 0;
    964   config::DoFullCurrent = 0;
    965 
    966   ParseForParameter(verbose,file,"ECut", 0, 1, 1, double_type, &(config::ECut), 1, critical);
    967   ParseForParameter(verbose,file,"MaxLevel", 0, 1, 1, int_type, &(config::MaxLevel), 1, critical);
    968   ParseForParameter(verbose,file,"Level0Factor", 0, 1, 1, int_type, &(config::Lev0Factor), 1, critical);
    969   if (config::Lev0Factor < 2) {
    970     config::Lev0Factor = 2;
    971   }
    972   ParseForParameter(verbose,file,"RiemannTensor", 0, 1, 1, int_type, &di, 1, critical);
    973   if (di >= 0 && di < 2) {
    974     config::RiemannTensor = di;
    975   } else {
    976     fprintf(stderr, "0 <= RiemanTensor < 2: 0 UseNotRT, 1 UseRT");
    977     exit(1);
    978   }
    979   switch (config::RiemannTensor) {
    980     case 0: //UseNoRT
    981       if (config::MaxLevel < 2) {
    982         config::MaxLevel = 2;
    983       }
    984       config::LevRFactor = 2;
    985       config::RTActualUse = 0;
    986       break;
    987     case 1: // UseRT
    988       if (config::MaxLevel < 3) {
    989         config::MaxLevel = 3;
    990       }
    991       ParseForParameter(verbose,file,"RiemannLevel", 0, 1, 1, int_type, &(config::RiemannLevel), 1, critical);
    992       if (config::RiemannLevel < 2) {
    993         config::RiemannLevel = 2;
    994       }
    995       if (config::RiemannLevel > config::MaxLevel-1) {
    996         config::RiemannLevel = config::MaxLevel-1;
    997       }
    998       ParseForParameter(verbose,file,"LevRFactor", 0, 1, 1, int_type, &(config::LevRFactor), 1, critical);
    999       if (config::LevRFactor < 2) {
    1000         config::LevRFactor = 2;
    1001       }
    1002       config::Lev0Factor = 2;
    1003       config::RTActualUse = 2;
    1004       break;
    1005   }
    1006   ParseForParameter(verbose,file,"PsiType", 0, 1, 1, int_type, &di, 1, critical);
    1007   if (di >= 0 && di < 2) {
    1008     config::PsiType = di;
    1009   } else {
    1010     fprintf(stderr, "0 <= PsiType < 2: 0 UseSpinDouble, 1 UseSpinUpDown");
    1011     exit(1);
    1012   }
    1013   switch (config::PsiType) {
    1014   case 0: // SpinDouble
    1015     ParseForParameter(verbose,file,"MaxPsiDouble", 0, 1, 1, int_type, &(config::MaxPsiDouble), 1, critical);
    1016     config::AddPsis = 0;
    1017     break;
    1018   case 1: // SpinUpDown
    1019     if (config::ProcPEGamma % 2) config::ProcPEGamma*=2;
    1020     ParseForParameter(verbose,file,"MaxPsiUp", 0, 1, 1, int_type, &(config::PsiMaxNoUp), 1, critical);
    1021     ParseForParameter(verbose,file,"MaxPsiDown", 0, 1, 1, int_type, &(config::PsiMaxNoDown), 1, critical);
    1022     config::AddPsis = 0;
    1023     break;
    1024   }
    1025 
    1026   // IonsInitRead
    1027 
    1028   ParseForParameter(verbose,file,"RCut", 0, 1, 1, double_type, &(config::RCut), 1, critical);
    1029   ParseForParameter(verbose,file,"IsAngstroem", 0, 1, 1, int_type, &(config::IsAngstroem), 1, critical);
    1030   config::RelativeCoord = 0;
    1031   config::StructOpt = 0;
    1032 
    1033 
    1034   // 2. parse the bond graph file if given
    1035   BG = new BondGraph(IsAngstroem);
    1036   if (BG->LoadBondLengthTable(BondGraphFileName)) {
    1037     DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl);
    1038   } else {
    1039     DoLog(0) && (Log() << Verbose(0) << "Bond length table loading failed." << endl);
    1040   }
    1041 
    1042   // Routine from builder.cpp
    1043 
    1044   for (i=MAX_ELEMENTS;i--;)
    1045     elementhash[i] = NULL;
    1046   DoLog(0) && (Log() << Verbose(0) << "Parsing Ions ..." << endl);
    1047   No=0;
    1048   found = 0;
    1049   while (getline(*file,zeile,'\n')) {
    1050     if (zeile.find("Ions_Data") == 0) {
    1051       DoLog(1) && (Log() << Verbose(1) << "found Ions_Data...begin parsing" << endl);
    1052       found ++;
    1053     }
    1054     if (found > 0) {
    1055       if (zeile.find("Ions_Data") == 0)
    1056         getline(*file,zeile,'\n'); // read next line and parse this one
    1057       istringstream input(zeile);
    1058       input >> AtomNo;  // number of atoms
    1059       input >> Z;       // atomic number
    1060       input >> a;
    1061       input >> l;
    1062       input >> l;
    1063       input >> b;     // element mass
    1064       elementhash[No] = periode->FindElement(Z);
    1065       DoLog(1) && (Log() << Verbose(1) << "AtomNo: " << AtomNo << "\tZ: " << Z << "\ta:" << a << "\tl:"  << l << "\b:" << b << "\tElement:" << elementhash[No] << "\t:" << endl);
    1066       for(i=0;i<AtomNo;i++) {
    1067         if (!getline(*file,zeile,'\n')) {// parse on and on
    1068           DoLog(2) && (Log() << Verbose(2) << "Error: Too few items in ionic list of element" << elementhash[No] << "." << endl << "Exiting." << endl);
    1069           // return 1;
    1070         } else {
    1071           //Log() << Verbose(2) << "Reading line: " << zeile << endl;
    1072         }
    1073         istringstream input2(zeile);
    1074         atom *neues = World::getInstance().createAtom();
    1075         double tmp;
    1076         for (int j=0;j<NDIM;j++) {
    1077           input2 >> tmp;
    1078           neues->set(j,tmp);
    1079         }
    1080         input2 >> l;
    1081         neues->setType(elementhash[No]); // find element type
    1082         mol->AddAtom(neues);
    1083       }
    1084       No++;
    1085     }
    1086   }
    1087   file->close();
    1088   delete(file);
    1089 };
    1090624
    1091625/** Stores all elements of config structure from which they can be re-read.
  • src/config.hpp

    r3e4162 r8d1dd4  
    114114
    115115  int TestSyntax(const char * const filename, const periodentafel * const periode) const;
    116   void Load(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList);
    117   void LoadOld(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList);
    118116  bool Save(const char * const filename, const periodentafel * const periode, molecule * const mol) const;
    119117  bool SaveMPQC(const char * const filename, const molecule * const mol) const;
Note: See TracChangeset for help on using the changeset viewer.