Changeset 7a1dd0 for src


Ignore:
Timestamp:
Apr 18, 2011, 3:00:06 PM (14 years ago)
Author:
Frederik Heber <heber@…>
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:
b404da
Parents:
4fdc65
git-author:
Frederik Heber <heber@…> (04/18/11 10:05:27)
git-committer:
Frederik Heber <heber@…> (04/18/11 15:00:06)
Message:

Added regression tests on parsing present but empty files.

  • every Parser now first loads an empty file (no newlinw, 0 bytes) as initial regression test.
  • this closes ticket #131.
Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/PcpParser.cpp

    r4fdc65 r7a1dd0  
    167167
    168168  // 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;
     169  if (!ParseForParameter(verbose,FileBuffer, "mainname", 0, 1, 1, string_type, (Paths.mainname), 1, critical)) {
     170    DoeLog(1) && (eLog()<< Verbose(1) << "mainname is missing, is file empty?" << endl);
    180171  } 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 */
    258   double *cell_size = new double[6];
    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];
    265   World::getInstance().setDomain(cell_size);
    266   delete[] cell_size;
    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;
     172    ParseForParameter(verbose,FileBuffer, "defaultpath", 0, 1, 1, string_type, (Paths.defaultpath), 1, critical);
     173    ParseForParameter(verbose,FileBuffer, "pseudopotpath", 0, 1, 1, string_type, (Paths.pseudopotpath), 1, critical);
     174    ParseForParameter(verbose,FileBuffer,"ProcPEGamma", 0, 1, 1, int_type, &(Parallelization.ProcPEGamma), 1, critical);
     175    ParseForParameter(verbose,FileBuffer,"ProcPEPsi", 0, 1, 1, int_type, &(Parallelization.ProcPEPsi), 1, critical);
     176
     177    if (!ParseForParameter(verbose,FileBuffer,"Seed", 0, 1, 1, int_type, &(LocalizedOrbitals.Seed), 1, optional))
     178      LocalizedOrbitals.Seed = 1;
     179
     180    if(!ParseForParameter(verbose,FileBuffer,"DoOutOrbitals", 0, 1, 1, int_type, &(Switches.DoOutOrbitals), 1, optional)) {
     181      Switches.DoOutOrbitals = 0;
     182    } else {
     183      if (Switches.DoOutOrbitals < 0) Switches.DoOutOrbitals = 0;
     184      if (Switches.DoOutOrbitals > 1) Switches.DoOutOrbitals = 1;
     185    }
     186    ParseForParameter(verbose,FileBuffer,"DoOutVis", 0, 1, 1, int_type, &(Switches.DoOutVis), 1, critical);
     187    if (Switches.DoOutVis < 0) Switches.DoOutVis = 0;
     188    if (Switches.DoOutVis > 1) Switches.DoOutVis = 1;
     189    if (!ParseForParameter(verbose,FileBuffer,"VectorPlane", 0, 1, 1, int_type, &(LocalizedOrbitals.VectorPlane), 1, optional))
     190      LocalizedOrbitals.VectorPlane = -1;
     191    if (!ParseForParameter(verbose,FileBuffer,"VectorCut", 0, 1, 1, double_type, &(LocalizedOrbitals.VectorCut), 1, optional))
     192      LocalizedOrbitals.VectorCut = 0.;
     193    ParseForParameter(verbose,FileBuffer,"DoOutMes", 0, 1, 1, int_type, &(Switches.DoOutMes), 1, critical);
     194    if (Switches.DoOutMes < 0) Switches.DoOutMes = 0;
     195    if (Switches.DoOutMes > 1) Switches.DoOutMes = 1;
     196    if (!ParseForParameter(verbose,FileBuffer,"DoOutCurr", 0, 1, 1, int_type, &(Switches.DoOutCurrent), 1, optional))
     197      Switches.DoOutCurrent = 0;
     198    if (Switches.DoOutCurrent < 0) Switches.DoOutCurrent = 0;
     199    if (Switches.DoOutCurrent > 1) Switches.DoOutCurrent = 1;
     200    ParseForParameter(verbose,FileBuffer,"AddGramSch", 0, 1, 1, int_type, &(LocalizedOrbitals.UseAddGramSch), 1, critical);
     201    if (LocalizedOrbitals.UseAddGramSch < 0) LocalizedOrbitals.UseAddGramSch = 0;
     202    if (LocalizedOrbitals.UseAddGramSch > 2) LocalizedOrbitals.UseAddGramSch = 2;
     203    if(!ParseForParameter(verbose,FileBuffer,"DoWannier", 0, 1, 1, int_type, &(Switches.DoWannier), 1, optional)) {
     204      Switches.DoWannier = 0;
     205    } else {
     206      if (Switches.DoWannier < 0) Switches.DoWannier = 0;
     207      if (Switches.DoWannier > 1) Switches.DoWannier = 1;
     208    }
     209    if(!ParseForParameter(verbose,FileBuffer,"CommonWannier", 0, 1, 1, int_type, &(LocalizedOrbitals.CommonWannier), 1, optional)) {
     210      LocalizedOrbitals.CommonWannier = 0;
     211    } else {
     212      if (LocalizedOrbitals.CommonWannier < 0) LocalizedOrbitals.CommonWannier = 0;
     213      if (LocalizedOrbitals.CommonWannier > 4) LocalizedOrbitals.CommonWannier = 4;
     214    }
     215    if(!ParseForParameter(verbose,FileBuffer,"SawtoothStart", 0, 1, 1, double_type, &(LocalizedOrbitals.SawtoothStart), 1, optional)) {
     216      LocalizedOrbitals.SawtoothStart = 0.01;
     217    } else {
     218      if (LocalizedOrbitals.SawtoothStart < 0.) LocalizedOrbitals.SawtoothStart = 0.;
     219      if (LocalizedOrbitals.SawtoothStart > 1.) LocalizedOrbitals.SawtoothStart = 1.;
     220    }
     221
     222    if (ParseForParameter(verbose,FileBuffer,"DoConstrainedMD", 0, 1, 1, int_type, &(Switches.DoConstrainedMD), 1, optional))
     223      if (Switches.DoConstrainedMD < 0)
     224        Switches.DoConstrainedMD = 0;
     225    ParseForParameter(verbose,FileBuffer,"MaxOuterStep", 0, 1, 1, int_type, &(StepCounts.MaxOuterStep), 1, critical);
     226    if (!ParseForParameter(verbose,FileBuffer,"Deltat", 0, 1, 1, double_type, &(Deltat), 1, optional))
     227      Deltat = 1;
     228    ParseForParameter(verbose,FileBuffer,"OutVisStep", 0, 1, 1, int_type, &(StepCounts.OutVisStep), 1, optional);
     229    ParseForParameter(verbose,FileBuffer,"OutSrcStep", 0, 1, 1, int_type, &(StepCounts.OutSrcStep), 1, optional);
     230    ParseForParameter(verbose,FileBuffer,"TargetTemp", 0, 1, 1, double_type, &(World::getInstance().getThermostats()->TargetTemp), 1, optional);
     231    //ParseForParameter(verbose,FileBuffer,"Thermostat", 0, 1, 1, int_type, &(ScaleTempStep), 1, optional);
     232    if (!ParseForParameter(verbose,FileBuffer,"EpsWannier", 0, 1, 1, double_type, &(LocalizedOrbitals.EpsWannier), 1, optional))
     233      LocalizedOrbitals.EpsWannier = 1e-8;
     234
     235    // stop conditions
     236    //if (MaxOuterStep <= 0) MaxOuterStep = 1;
     237    ParseForParameter(verbose,FileBuffer,"MaxPsiStep", 0, 1, 1, int_type, &(StepCounts.MaxPsiStep), 1, critical);
     238    if (StepCounts.MaxPsiStep <= 0) StepCounts.MaxPsiStep = 3;
     239
     240    ParseForParameter(verbose,FileBuffer,"MaxMinStep", 0, 1, 1, int_type, &(StepCounts.MaxMinStep), 1, critical);
     241    ParseForParameter(verbose,FileBuffer,"RelEpsTotalE", 0, 1, 1, double_type, &(StepCounts.RelEpsTotalEnergy), 1, critical);
     242    ParseForParameter(verbose,FileBuffer,"RelEpsKineticE", 0, 1, 1, double_type, &(StepCounts.RelEpsKineticEnergy), 1, critical);
     243    ParseForParameter(verbose,FileBuffer,"MaxMinStopStep", 0, 1, 1, int_type, &(StepCounts.MaxMinStopStep), 1, critical);
     244    ParseForParameter(verbose,FileBuffer,"MaxMinGapStopStep", 0, 1, 1, int_type, &(StepCounts.MaxMinGapStopStep), 1, critical);
     245    if (StepCounts.MaxMinStep <= 0) StepCounts.MaxMinStep = StepCounts.MaxPsiStep;
     246    if (StepCounts.MaxMinStopStep < 1) StepCounts.MaxMinStopStep = 1;
     247    if (StepCounts.MaxMinGapStopStep < 1) StepCounts.MaxMinGapStopStep = 1;
     248
     249    ParseForParameter(verbose,FileBuffer,"MaxInitMinStep", 0, 1, 1, int_type, &(StepCounts.MaxInitMinStep), 1, critical);
     250    ParseForParameter(verbose,FileBuffer,"InitRelEpsTotalE", 0, 1, 1, double_type, &(StepCounts.InitRelEpsTotalEnergy), 1, critical);
     251    ParseForParameter(verbose,FileBuffer,"InitRelEpsKineticE", 0, 1, 1, double_type, &(StepCounts.InitRelEpsKineticEnergy), 1, critical);
     252    ParseForParameter(verbose,FileBuffer,"InitMaxMinStopStep", 0, 1, 1, int_type, &(StepCounts.InitMaxMinStopStep), 1, critical);
     253    ParseForParameter(verbose,FileBuffer,"InitMaxMinGapStopStep", 0, 1, 1, int_type, &(StepCounts.InitMaxMinGapStopStep), 1, critical);
     254    if (StepCounts.MaxInitMinStep <= 0) StepCounts.MaxInitMinStep = StepCounts.MaxPsiStep;
     255    if (StepCounts.InitMaxMinStopStep < 1) StepCounts.InitMaxMinStopStep = 1;
     256    if (StepCounts.InitMaxMinGapStopStep < 1) StepCounts.InitMaxMinGapStopStep = 1;
     257
     258    // Unit cell and magnetic field
     259    ParseForParameter(verbose,FileBuffer, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */
     260    double *cell_size = new double[6];
     261    cell_size[0] = BoxLength[0];
     262    cell_size[1] = BoxLength[3];
     263    cell_size[2] = BoxLength[4];
     264    cell_size[3] = BoxLength[6];
     265    cell_size[4] = BoxLength[7];
     266    cell_size[5] = BoxLength[8];
     267    World::getInstance().setDomain(cell_size);
     268    delete[] cell_size;
     269    //if (1) fprintf(stderr,"\n");
     270
     271    ParseForParameter(verbose,FileBuffer,"DoPerturbation", 0, 1, 1, int_type, &(Switches.DoPerturbation), 1, optional);
     272    ParseForParameter(verbose,FileBuffer,"DoOutNICS", 0, 1, 1, int_type, &(Switches.DoOutNICS), 1, optional);
     273    if (!ParseForParameter(verbose,FileBuffer,"DoFullCurrent", 0, 1, 1, int_type, &(Switches.DoFullCurrent), 1, optional))
     274      Switches.DoFullCurrent = 0;
     275    if (Switches.DoFullCurrent < 0) Switches.DoFullCurrent = 0;
     276    if (Switches.DoFullCurrent > 2) Switches.DoFullCurrent = 2;
     277    if (Switches.DoOutNICS < 0) Switches.DoOutNICS = 0;
     278    if (Switches.DoOutNICS > 2) Switches.DoOutNICS = 2;
     279    if (Switches.DoPerturbation == 0) {
     280      Switches.DoFullCurrent = 0;
     281      Switches.DoOutNICS = 0;
     282    }
     283
     284    ParseForParameter(verbose,FileBuffer,"ECut", 0, 1, 1, double_type, &(PlaneWaveSpecifics.ECut), 1, critical);
     285    ParseForParameter(verbose,FileBuffer,"MaxLevel", 0, 1, 1, int_type, &(PlaneWaveSpecifics.MaxLevel), 1, critical);
     286    ParseForParameter(verbose,FileBuffer,"Level0Factor", 0, 1, 1, int_type, &(PlaneWaveSpecifics.Lev0Factor), 1, critical);
     287    if (PlaneWaveSpecifics.Lev0Factor < 2) {
     288      PlaneWaveSpecifics.Lev0Factor = 2;
     289    }
     290    ParseForParameter(verbose,FileBuffer,"RiemannTensor", 0, 1, 1, int_type, &di, 1, critical);
     291    if (di >= 0 && di < 2) {
     292      PlaneWaveSpecifics.RiemannTensor = di;
     293    } else {
     294      cerr << "0 <= RiemanTensor < 2: 0 UseNotRT, 1 UseRT" << endl;
     295      exit(1);
     296    }
     297    switch (PlaneWaveSpecifics.RiemannTensor) {
     298      case 0: //UseNoRT
     299        if (PlaneWaveSpecifics.MaxLevel < 2) {
     300          PlaneWaveSpecifics.MaxLevel = 2;
     301        }
     302        PlaneWaveSpecifics.LevRFactor = 2;
     303        PlaneWaveSpecifics.RTActualUse = 0;
     304        break;
     305      case 1: // UseRT
     306        if (PlaneWaveSpecifics.MaxLevel < 3) {
     307          PlaneWaveSpecifics.MaxLevel = 3;
     308        }
     309        ParseForParameter(verbose,FileBuffer,"RiemannLevel", 0, 1, 1, int_type, &(PlaneWaveSpecifics.RiemannLevel), 1, critical);
     310        if (PlaneWaveSpecifics.RiemannLevel < 2) {
     311          PlaneWaveSpecifics.RiemannLevel = 2;
     312        }
     313        if (PlaneWaveSpecifics.RiemannLevel > PlaneWaveSpecifics.MaxLevel-1) {
     314          PlaneWaveSpecifics.RiemannLevel = PlaneWaveSpecifics.MaxLevel-1;
     315        }
     316        ParseForParameter(verbose,FileBuffer,"LevRFactor", 0, 1, 1, int_type, &(PlaneWaveSpecifics.LevRFactor), 1, critical);
     317        if (PlaneWaveSpecifics.LevRFactor < 2) {
     318          PlaneWaveSpecifics.LevRFactor = 2;
     319        }
     320        PlaneWaveSpecifics.Lev0Factor = 2;
     321        PlaneWaveSpecifics.RTActualUse = 2;
     322        break;
     323    }
     324    ParseForParameter(verbose,FileBuffer,"PsiType", 0, 1, 1, int_type, &di, 1, critical);
     325    if (di >= 0 && di < 2) {
     326      PlaneWaveSpecifics.PsiType = di;
     327    } else {
     328      cerr << "0 <= PsiType < 2: 0 UseSpinDouble, 1 UseSpinUpDown" << endl;
     329      exit(1);
     330    }
     331    switch (PlaneWaveSpecifics.PsiType) {
     332    case 0: // SpinDouble
     333      ParseForParameter(verbose,FileBuffer,"MaxPsiDouble", 0, 1, 1, int_type, &(PlaneWaveSpecifics.MaxPsiDouble), 1, critical);
     334      ParseForParameter(verbose,FileBuffer,"PsiMaxNoUp", 0, 1, 1, int_type, &(PlaneWaveSpecifics.PsiMaxNoUp), 1, optional);
     335      ParseForParameter(verbose,FileBuffer,"PsiMaxNoDown", 0, 1, 1, int_type, &(PlaneWaveSpecifics.PsiMaxNoDown), 1, optional);
     336      ParseForParameter(verbose,FileBuffer,"AddPsis", 0, 1, 1, int_type, &(PlaneWaveSpecifics.AddPsis), 1, optional);
    302337      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;
     338    case 1: // SpinUpDown
     339      if (Parallelization.ProcPEGamma % 2) Parallelization.ProcPEGamma*=2;
     340      ParseForParameter(verbose,FileBuffer,"MaxPsiDouble", 0, 1, 1, int_type, &(PlaneWaveSpecifics.MaxPsiDouble), 1, optional);
     341      ParseForParameter(verbose,FileBuffer,"PsiMaxNoUp", 0, 1, 1, int_type, &(PlaneWaveSpecifics.PsiMaxNoUp), 1, critical);
     342      ParseForParameter(verbose,FileBuffer,"PsiMaxNoDown", 0, 1, 1, int_type, &(PlaneWaveSpecifics.PsiMaxNoDown), 1, critical);
     343      ParseForParameter(verbose,FileBuffer,"AddPsis", 0, 1, 1, int_type, &(PlaneWaveSpecifics.AddPsis), 1, optional);
    320344      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);
    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);
    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;
    338     ParseForParameter(verbose,FileBuffer,"MaxPsiDouble", 0, 1, 1, int_type, &(PlaneWaveSpecifics.MaxPsiDouble), 1, optional);
    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;
     345    }
     346
     347    // IonsInitRead
     348
     349    ParseForParameter(verbose,FileBuffer,"RCut", 0, 1, 1, double_type, &(PlaneWaveSpecifics.RCut), 1, critical);
     350    ParseForParameter(verbose,FileBuffer,"IsAngstroem", 0, 1, 1, int_type, &(IsAngstroem), 1, critical);
     351    ParseForParameter(verbose,FileBuffer,"MaxTypes", 0, 1, 1, int_type, &(MaxTypes), 1, critical);
     352    if (!ParseForParameter(verbose,FileBuffer,"RelativeCoord", 0, 1, 1, int_type, &(RelativeCoord) , 1, optional))
     353      RelativeCoord = 0;
     354    if (!ParseForParameter(verbose,FileBuffer,"StructOpt", 0, 1, 1, int_type, &(StructOpt), 1, optional))
     355      StructOpt = 0;
     356  }
    354357
    355358  // 3. parse the molecule in
  • src/config.cpp

    r4fdc65 r7a1dd0  
    14461446          //Error(InitReading, name);
    14471447          fprintf(stderr,"Error:InitReading, critical %s not found\n", name);
    1448           exit(255);
     1448          return 0;
    14491449        } else {
    14501450          //fprintf(stdout,"Rewinding to OldCurrentLine due to search till end of file.\n");
Note: See TracChangeset for help on using the changeset viewer.