Changeset 650ca8c for src/Parser


Ignore:
Timestamp:
Jun 22, 2010, 9:30:03 AM (15 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:
4ac1aa
Parents:
1434c9
Message:

FIX: PcpParser had wrong default values for testsuite cases, number orbitals are wrong, no defaults for NULL strings.

  • Variables in paths are all NULL as default, this has to be caught on output and default values given.
  • some default values were not consistent with testsuite cases (Simple_configuration/2).
  • PcpParser::save() - removed some commented-out sections.
  • new function PcpParser::CalculateOrbitals() - transfered from class molecule, acting now on vector<atom *>.
  • BUGFIX: PcpParser::OutputAtoms() - wrong index for ZtoCountMap used.
Location:
src/Parser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/PcpParser.cpp

    r1434c9 r650ca8c  
    2626PcpParser::PcpParser()
    2727{
    28   Parallelization.ProcPEGamma = 1;
     28  Parallelization.ProcPEGamma = 8;
    2929  Parallelization.ProcPEPsi = 1;
    3030
     
    5454  LocalizedOrbitals.EpsWannier = 1e-7;
    5555
    56   StepCounts.MaxMinStopStep = 0;
    57   StepCounts.InitMaxMinStopStep = 0;
     56  StepCounts.MaxMinStopStep = 1;
     57  StepCounts.InitMaxMinStopStep = 1;
    5858  StepCounts.OutVisStep = 10;
    5959  StepCounts.OutSrcStep = 5;
    60   StepCounts.MaxPsiStep = 3;
     60  StepCounts.MaxPsiStep = 0;
    6161  StepCounts.MaxOuterStep = 0;
    6262  StepCounts.MaxMinStep = 100;
     
    6767  StepCounts.InitRelEpsTotalEnergy = 1e-05;
    6868  StepCounts.InitRelEpsKineticEnergy = 0.0001;
    69   StepCounts.InitMaxMinGapStopStep = 1;
     69  StepCounts.InitMaxMinGapStopStep = 0;
    7070
    7171  PlaneWaveSpecifics.PsiType = 0;
     
    325325  class ThermoStatContainer *Thermostats = World::getInstance().getThermostats();
    326326  if (!file->fail()) {
     327    // calculate number of Psis
     328    vector<atom *> allatoms = World::getInstance().getAllAtoms();
     329    CalculateOrbitals(allatoms);
    327330    *file << "# ParallelCarParinello - main configuration file - created with molecuilder" << endl;
    328331    *file << endl;
    329     *file << "mainname\t" << Paths.mainname << "\t# programm name (for runtime files)" << endl;
    330     *file << "defaultpath\t" << Paths.defaultpath << "\t# where to put files during runtime" << endl;
    331     *file << "pseudopotpath\t" << Paths.pseudopotpath << "\t# where to find pseudopotentials" << endl;
     332    if (Paths.mainname != NULL)
     333      *file << "mainname\t" << Paths.mainname << "\t# programm name (for runtime files)" << endl;
     334    else
     335      *file << "mainname\tpcp\t# programm name (for runtime files)" << endl;
     336    if (Paths.defaultpath != NULL)
     337      *file << "defaultpath\t" << Paths.defaultpath << "\t# where to put files during runtime" << endl;
     338    else
     339      *file << "defaultpath\tnot specified\t# where to put files during runtime" << endl;
     340    if (Paths.pseudopotpath != NULL)
     341      *file << "pseudopotpath\t" << Paths.pseudopotpath << "\t# where to find pseudopotentials" << endl;
     342    else
     343      *file << "pseudopotpath\tnot specified\t# where to find pseudopotentials" << endl;
    332344    *file << endl;
    333345    *file << "ProcPEGamma\t" << Parallelization.ProcPEGamma << "\t# for parallel computing: share constants" << endl;
     
    341353    *file << "DoFullCurrent\t" << Switches.DoFullCurrent << "\t# Do full perturbation" << endl;
    342354    *file << "DoConstrainedMD\t" << Switches.DoConstrainedMD << "\t# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD" << endl;
     355    ASSERT(Thermostats != NULL, "PcpParser::save() - Thermostats not initialized!");
     356    ASSERT(Thermostats->ThermostatNames != NULL, "PcpParser::save() - Thermostats not initialized!");
    343357    *file << "Thermostat\t" << Thermostats->ThermostatNames[Thermostats->Thermostat] << "\t";
    344358    switch(Thermostats->Thermostat) {
     
    411425    }
    412426    *file << "PsiType\t\t" << PlaneWaveSpecifics.PsiType << "\t# 0 - doubly occupied, 1 - SpinUp,SpinDown" << endl;
    413     // write out both types for easier changing afterwards
    414   //  switch (PsiType) {
    415   //    case 0:
    416         *file << "MaxPsiDouble\t" << PlaneWaveSpecifics.MaxPsiDouble << "\t# here: specifying both maximum number of SpinUp- and -Down-states" << endl;
    417   //      break;
    418   //    case 1:
    419         *file << "PsiMaxNoUp\t" << PlaneWaveSpecifics.PsiMaxNoUp << "\t# here: specifying maximum number of SpinUp-states" << endl;
    420         *file << "PsiMaxNoDown\t" << PlaneWaveSpecifics.PsiMaxNoDown << "\t# here: specifying maximum number of SpinDown-states" << endl;
    421   //      break;
    422   //  }
     427    *file << "MaxPsiDouble\t" << PlaneWaveSpecifics.MaxPsiDouble << "\t# here: specifying both maximum number of SpinUp- and -Down-states" << endl;
     428    *file << "PsiMaxNoUp\t" << PlaneWaveSpecifics.PsiMaxNoUp << "\t# here: specifying maximum number of SpinUp-states" << endl;
     429    *file << "PsiMaxNoDown\t" << PlaneWaveSpecifics.PsiMaxNoDown << "\t# here: specifying maximum number of SpinDown-states" << endl;
    423430    *file << "AddPsis\t\t" << PlaneWaveSpecifics.AddPsis << "\t# Additional unoccupied Psis for bandgap determination" << endl;
    424431    *file << endl;
     
    427434    *file << "IsAngstroem\t" << IsAngstroem << "\t# 0 - Bohr, 1 - Angstroem" << endl;
    428435    *file << "RelativeCoord\t" << RelativeCoord << "\t# whether ion coordinates are relative (1) or absolute (0)" << endl;
    429     *file << endl;
    430     vector<atom *> allatoms = World::getInstance().getAllAtoms();
    431436    map<int, int> ZtoIndexMap;
    432437    OutputElements(file, allatoms, ZtoIndexMap);
    433438    OutputAtoms(file, allatoms, ZtoIndexMap);
    434 //    result = result && mol->Checkout(file);
    435 //    if (mol->MDSteps <=1 )
    436 //      result = result && mol->Output(file);
    437 //    else
    438 //      result = result && mol->OutputTrajectories(file);
    439439  } else {
    440440    DoeLog(1) && (eLog()<< Verbose(1) << "Cannot open output file." << endl);
    441441  }
    442442}
     443
     444
     445/** Counts necessary number of valence electrons and returns number and SpinType.
     446 * \param &allatoms all atoms to store away
     447 */
     448void PcpParser::CalculateOrbitals(vector<atom *> &allatoms)
     449{
     450  PlaneWaveSpecifics.MaxPsiDouble = PlaneWaveSpecifics.PsiMaxNoDown = PlaneWaveSpecifics.PsiMaxNoUp = PlaneWaveSpecifics.PsiType = 0;
     451  for (vector<atom *>::iterator runner = allatoms.begin(); runner != allatoms.end(); ++runner) {
     452    PlaneWaveSpecifics.MaxPsiDouble += (*runner)->type->Valence;
     453  }
     454  cout << PlaneWaveSpecifics.MaxPsiDouble << endl;
     455  PlaneWaveSpecifics.PsiMaxNoDown = PlaneWaveSpecifics.MaxPsiDouble/2 + (PlaneWaveSpecifics.MaxPsiDouble % 2);
     456  PlaneWaveSpecifics.PsiMaxNoUp = PlaneWaveSpecifics.MaxPsiDouble/2;
     457  PlaneWaveSpecifics.MaxPsiDouble /= 2;
     458  PlaneWaveSpecifics.PsiType = (PlaneWaveSpecifics.PsiMaxNoDown == PlaneWaveSpecifics.PsiMaxNoUp) ? 0 : 1;
     459  if ((PlaneWaveSpecifics.PsiType == 1) && (Parallelization.ProcPEPsi < 2) && ((PlaneWaveSpecifics.PsiMaxNoDown != 1) || (PlaneWaveSpecifics.PsiMaxNoUp != 0))) {
     460    Parallelization.ProcPEGamma /= 2;
     461    Parallelization.ProcPEPsi *= 2;
     462  } else {
     463    Parallelization.ProcPEGamma *= Parallelization.ProcPEPsi;
     464    Parallelization.ProcPEPsi = 1;
     465  }
     466  cout << PlaneWaveSpecifics.PsiMaxNoDown << ">" << PlaneWaveSpecifics.PsiMaxNoUp << endl;
     467  if (PlaneWaveSpecifics.PsiMaxNoDown > PlaneWaveSpecifics.PsiMaxNoUp) {
     468    StepCounts.InitMaxMinStopStep = StepCounts.MaxMinStopStep = PlaneWaveSpecifics.PsiMaxNoDown;
     469    cout << PlaneWaveSpecifics.PsiMaxNoDown << " " << StepCounts.InitMaxMinStopStep << endl;
     470  } else {
     471    StepCounts.InitMaxMinStopStep = StepCounts.MaxMinStopStep = PlaneWaveSpecifics.PsiMaxNoUp;
     472    cout << PlaneWaveSpecifics.PsiMaxNoUp << " " << StepCounts.InitMaxMinStopStep << endl;
     473  }
     474};
    443475
    444476/** Prints MaxTypes and list of elements to strea,
     
    459491  // print total element count
    460492  *file << "MaxTypes\t" << PresentElements.size() <<  "\t# maximum number of different ion types" << endl;
     493  *file << endl;
    461494  // print element list
    462495  *file << "# Ion type data (PP = PseudoPotential, Z = atomic number)" << endl;
     
    486519    if (!Inserter.second)
    487520      Inserter.first->second += 1;
    488     *file << "Ion_Type" << ZtoIndexMap[(*AtomRunner)->type->Z] << "_" << ZtoCountMap[Inserter.first->second] << "\t"  << fixed << setprecision(9) << showpoint;
     521    const int Z = (*AtomRunner)->type->Z;
     522    *file << "Ion_Type" << ZtoIndexMap[Z] << "_" << ZtoCountMap[Z] << "\t"  << fixed << setprecision(9) << showpoint;
    489523    *file << (*AtomRunner)->x[0] << "\t" << (*AtomRunner)->x[1] << "\t" << (*AtomRunner)->x[2];
    490524    *file << "\t" << (*AtomRunner)->FixedIon;
  • src/Parser/PcpParser.hpp

    r1434c9 r650ca8c  
    1010
    1111#include <iostream>
    12 #include "FormatParser.hpp"
     12#include "Parser/FormatParser.hpp"
    1313
    1414/**
     
    2929  void OutputAtoms(ostream *file, vector<atom *> &allatoms, map<int, int> &ZtoIndexMap);
    3030  void OutputElements(ostream *file, vector<atom *> &allatoms, map<int, int> &ZtoIndexMap);
     31  void CalculateOrbitals(vector<atom *> &allatoms);
    3132
    3233  struct StructParallelization {
Note: See TracChangeset for help on using the changeset viewer.