Changeset b8f0b25


Ignore:
Timestamp:
Dec 14, 2012, 5:39:41 PM (12 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:
372c912
Parents:
69e065
git-author:
Frederik Heber <heber@…> (09/27/12 15:53:20)
git-committer:
Frederik Heber <heber@…> (12/14/12 17:39:41)
Message:

Extended FragmentResults and FragmentationChargeDensity to contain map of (IndexSet, contributions) pairs.

Location:
src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/FragmentationAction/FragmentationAutomationAction.cpp

    r69e065 rb8f0b25  
    413413  // store homology container again
    414414  std::ofstream outputstream(homology_file.string().c_str());
    415   if (outputstream.fail()) { // check if opened
     415  if (outputstream.good()) { // check if opened
    416416    boost::archive::text_oarchive oa(outputstream);
    417417    oa << homology_container;
     
    513513
    514514  // Final phase: sum up and print result
    515   {
    516     FragmentationResults results(
    517         fragmentData,
    518         longrangeData,
    519         fullsolutionData,
    520         params.path.get(),
    521         getNoAtomsFromAdjacencyFile(params.path.get()),
    522         full_sample);
    523 
     515  FragmentationResults results(
     516      fragmentData,
     517      longrangeData,
     518      fullsolutionData,
     519      params.path.get(),
     520      getNoAtomsFromAdjacencyFile(params.path.get()),
     521      full_sample);
     522
     523  {
    524524    LOG(1, "INFO: Parsing fragment files from " << params.path.get() << ".");
    525525    printReceivedFullResults(results);
     
    527527
    528528  // append all keysets to homology file
    529   if (Exitflag != 0) {
     529  if (Exitflag == 0) {
    530530    const boost::filesystem::path &homology_file = params.homology_file.get();
    531     if (!appendToHomologyFile(homology_file))
    532       Exitflag = 1;
     531    if (homology_file.string() != "") {
     532      LOG(1, "INFO: Appending HomologyGraphs to file " << homology_file.string() << ".");
     533      if (!appendToHomologyFile(homology_file))
     534        Exitflag = 1;
     535    }
    533536  }
    534537
  • src/Fragmentation/Automation/FragmentationChargeDensity.cpp

    r69e065 rb8f0b25  
    9393
    9494  /// convert all MPQCData to MPQCDataMap_t
    95   Result_Grid_fused =
    96     OrthogonalSumUpPerLevel<MPQCDataGridMap_t, MPQCData, MPQCDataGridVector_t>(
    97         fragmentData, MatrixNrLookup, container, subsetmap);
    98   Result_Fragment_fused =
    99     OrthogonalSumUpPerLevel<MPQCDataFragmentMap_t, MPQCData, MPQCDataFragmentVector_t>(
    100         fragmentData, MatrixNrLookup, container, subsetmap);
     95  OrthogonalSumUpPerLevel<MPQCDataGridMap_t, MPQCData, MPQCDataGridVector_t>(
     96      fragmentData, MatrixNrLookup, container, subsetmap,
     97      Result_Grid_fused, Result_perIndexSet_Grid);
     98  OrthogonalSumUpPerLevel<MPQCDataFragmentMap_t, MPQCData, MPQCDataFragmentVector_t>(
     99      fragmentData, MatrixNrLookup, container, subsetmap,
     100      Result_Fragment_fused, Result_perIndexSet_Fragment);
    101101}
    102102
  • src/Fragmentation/Automation/FragmentationChargeDensity.hpp

    r69e065 rb8f0b25  
    2222
    2323#include "Fragmentation/SetValues/Fragment.hpp"
     24#include "Fragmentation/Summation/IndexSet.hpp"
    2425#include "Jobs/MPQCData.hpp"
    2526#include "Jobs/MPQCDataMap.hpp"
     
    4445  const Fragment &getFragment();
    4546
     47  //!> results per level of summed up sampled grid charge
    4648  std::vector<MPQCDataGridMap_t> Result_Grid_fused;
     49  //!> results per level of summed up fragment positions and charges
     50  std::vector<MPQCDataFragmentMap_t> Result_Fragment_fused;
    4751
    48   std::vector<MPQCDataFragmentMap_t> Result_Fragment_fused;
     52  //!> results per IndexSet of summed up sampled grid charge
     53  std::map<IndexSet::ptr, MPQCDataGridMap_t> Result_perIndexSet_Grid;
     54  //!> results per IndexSet of summed up fragment positions and charges
     55  std::map<IndexSet::ptr, MPQCDataFragmentMap_t> Result_perIndexSet_Fragment;
    4956};
    5057
  • src/Fragmentation/Automation/FragmentationResults.cpp

    r69e065 rb8f0b25  
    121121
    122122    typedef boost::mpl::remove<MPQCDataEnergyVector_t, MPQCDataFused::energy_eigenvalues>::type MPQCDataEnergyVector_noeigenvalues_t;
    123     Result_Energy_fused =
    124         OrthogonalSumUpPerLevel<MPQCDataEnergyMap_t, MPQCData, MPQCDataEnergyVector_t>(
    125             fragmentData, MPQCMatrixNrLookup, container, subsetmap);
    126     Result_Grid_fused =
    127       OrthogonalSumUpPerLevel<MPQCDataGridMap_t, MPQCData, MPQCDataGridVector_t>(
    128           fragmentData, MPQCMatrixNrLookup, container, subsetmap);
    129     Result_Time_fused =
    130       SumUpPerLevel<MPQCDataTimeMap_t, MPQCData, MPQCDataTimeVector_t>(
    131           fragmentData, MPQCMatrixNrLookup, container, subsetmap);
    132     Result_Fragment_fused =
    133       OrthogonalSumUpPerLevel<MPQCDataFragmentMap_t, MPQCData, MPQCDataFragmentVector_t>(
    134           fragmentData, MPQCMatrixNrLookup, container, subsetmap);
     123    OrthogonalSumUpPerLevel<MPQCDataEnergyMap_t, MPQCData, MPQCDataEnergyVector_t>(
     124        fragmentData, MPQCMatrixNrLookup, container, subsetmap,
     125        Result_Energy_fused, Result_perIndexSet_Energy);
     126    OrthogonalSumUpPerLevel<MPQCDataGridMap_t, MPQCData, MPQCDataGridVector_t>(
     127        fragmentData, MPQCMatrixNrLookup, container, subsetmap,
     128        Result_Grid_fused, Result_perIndexSet_Grid);
     129    SumUpPerLevel<MPQCDataTimeMap_t, MPQCData, MPQCDataTimeVector_t>(
     130        fragmentData, MPQCMatrixNrLookup, container, subsetmap,
     131        Result_Time_fused, Result_perIndexSet_Time);
     132    OrthogonalSumUpPerLevel<MPQCDataFragmentMap_t, MPQCData, MPQCDataFragmentVector_t>(
     133        fragmentData, MPQCMatrixNrLookup, container, subsetmap,
     134        Result_Fragment_fused, Result_perIndexSet_Fragment);
    135135
    136136    // multiply each short-range potential with the respective charge
     
    141141    }
    142142    // then sum up
    143     Result_LongRange_fused =
    144       OrthogonalSumUpPerLevel<VMGDataMap_t, VMGData, VMGDataVector_t>(
    145           longrangeData, VMGMatrixNrLookup, container, subsetmap);
     143    OrthogonalSumUpPerLevel<VMGDataMap_t, VMGData, VMGDataVector_t>(
     144        longrangeData, VMGMatrixNrLookup, container, subsetmap,
     145        Result_LongRange_fused, Result_perIndexSet_LongRange);
    146146
    147147    // force has extra data converter
     
    154154                container->getContainer(),
    155155                MPQCMatrixNrLookup,
    156                 Result_Force_fused);
     156                Result_Force_fused,
     157                Result_perIndexSet_Force);
    157158    boost::mpl::for_each<MPQCDataForceVector_t>(boost::ref(forceSummer));
    158159
  • src/Fragmentation/Automation/FragmentationResults.hpp

    r69e065 rb8f0b25  
    2020
    2121#include "JobMarket/types.hpp"
     22
     23#include "Fragmentation/Summation/IndexSet.hpp"
    2224
    2325#include "Jobs/MPQCData.hpp"
     
    7577  std::vector<VMGDataLongRangeMap_t> Result_LongRangeIntegrated_fused;
    7678
     79  //!> results per IndexSet of summed up energy
     80  std::map<IndexSet::ptr, MPQCDataEnergyMap_t> Result_perIndexSet_Energy;
     81  //!> results per IndexSet of summed up sampled grid charge
     82  std::map<IndexSet::ptr, MPQCDataGridMap_t> Result_perIndexSet_Grid;
     83  //!> results per IndexSet of summed up times
     84  std::map<IndexSet::ptr, MPQCDataTimeMap_t> Result_perIndexSet_Time;
     85  //!> results per IndexSet of summed up fragment positions and charges
     86  std::map<IndexSet::ptr, MPQCDataFragmentMap_t> Result_perIndexSet_Fragment;
     87  //!> results per IndexSet of summed up forces
     88  std::map<IndexSet::ptr, MPQCDataForceMap_t> Result_perIndexSet_Force;
     89  //!> results per IndexSet of summed up long range potential grids and energy
     90  std::map<IndexSet::ptr, VMGDataMap_t> Result_perIndexSet_LongRange;
     91  // we don't need the map pendant for Result_LongRangeIntegrated_fused, as this
     92  // quantity makes sense only level-wise
     93
    7794private:
    7895  //!> maximum level of summation
  • src/Fragmentation/Summation/AllLevelOrthogonalSummator.hpp

    r69e065 rb8f0b25  
    4545      const IndexSetContainer::Container_t &_container,
    4646      const std::map< JobId_t, size_t > &_MatrixNrLookup,
    47       std::vector<MapType> &_results) :
     47      std::vector<MapType> &_levelresults,
     48      std::map<IndexSet::ptr, MapType> &_keysetresults) :
    4849    subsetmap(_subsetmap),
    4950    data(_data),
    5051    container(_container),
    5152    MatrixNrLookup(_MatrixNrLookup),
    52     results(_results)
     53    levelresults(_levelresults),
     54    keysetresults(_keysetresults)
    5355  {
    54     ASSERT( results.size() >= subsetmap->getMaximumSetLevel(),
     56    ASSERT( levelresults.size() >= subsetmap->getMaximumSetLevel(),
    5557        "AllLevelOrthogonalSummator() - result vector is not large enough.");
    5658  }
     
    6567    // We retrieve the type of the MPQCData member variable from the boost::fusion::map.
    6668    typedef typename boost::fusion::result_of::value_at_key<MapType, MapKey>::type MapValue;
     69
    6770    // create OrthogonalSummator instance
    6871    OrthogonalSummator<MapType, MapKey> sum_value(
    6972        subsetmap, data, container, MatrixNrLookup
    7073        );
     74
     75    // fill levelresults
    7176    const size_t MaxLevel = subsetmap->getMaximumSetLevel();
    7277    for (size_t level=1; level <= MaxLevel; ++level) {
    73       MapType &LevelResults = results[level-1];
    74       // sum up and store in results
     78      MapType &LevelResults = levelresults[level-1];
     79      // sum up and store in levelresults
    7580      const MapValue value = sum_value(level);
    7681      boost::fusion::at_key<MapKey>(LevelResults) = value;
    7782      // print value
    7883      //LOG(0, "STATUS: Level " << level << " resulting " << printKeyNames::printName<MapKey>() << " is " << value << ".");
     84    }
     85
     86    // fill keysetresults
     87    for (IndexSetContainer::Container_t::const_iterator indexsetiter = container.begin();
     88        indexsetiter != container.end(); ++indexsetiter) {
     89      const IndexSet::ptr &index = *indexsetiter;
     90      // this either generates a new entry or updates the present one, as we obtain ref to value
     91      boost::fusion::at_key<MapKey>(keysetresults[index]) =
     92          sum_value.getContributionForIndexSet(index);
    7993    }
    8094  }
     
    89103  //!> lookup map from job ids to ordering in above vectors
    90104  const std::map< JobId_t, size_t > &MatrixNrLookup;
    91   //!> vector of results
    92   std::vector<MapType> &results;
     105  //!> vector of levelresults
     106  std::vector<MapType> &levelresults;
     107  typedef std::pair< IndexSet::ptr, MapType > keysetresults_pair_t;
     108  //!> typedef for map for keyset and each resulting value
     109  typedef std::map<IndexSet::ptr, MapType> keysetresults_t;
     110  //!> map for IndexSet and its associated contribution
     111  keysetresults_t &keysetresults;
    93112};
    94113
  • src/Fragmentation/Summation/AllLevelSummator.hpp

    r69e065 rb8f0b25  
    3838   *        to job id and hence to _data.
    3939   * \param _MatrixNrLookup lookup from job id to ordering in above vectors
    40    * \param _results vector place results into
     40   * \param _levelresults vector place levelresults into
    4141   */
    4242  AllLevelSummator(
     
    4545      const IndexSetContainer::Container_t &_container,
    4646      const std::map< JobId_t, size_t > &_MatrixNrLookup,
    47       std::vector<MapType> &_results) :
     47      std::vector<MapType> &_levelresults,
     48      std::map<IndexSet::ptr, MapType> &_keysetresults) :
    4849    subsetmap(_subsetmap),
    4950    data(_data),
    5051    container(_container),
    5152    MatrixNrLookup(_MatrixNrLookup),
    52     results(_results)
     53    levelresults(_levelresults),
     54    keysetresults(_keysetresults)
    5355  {
    54     ASSERT( results.size() >= subsetmap->getMaximumSetLevel(),
     56    ASSERT( levelresults.size() >= subsetmap->getMaximumSetLevel(),
    5557        "AllLevelSummator() - result vector is not large enough.");
    5658  }
     
    6567    // We retrieve the type of the MPQCData member variable from the boost::fusion::map.
    6668    typedef typename boost::fusion::result_of::value_at_key<MapType, MapKey>::type MapValue;
     69
    6770    // create Summator instance
    6871    Summator<MapType, MapKey> sum_value(
    6972        subsetmap, data, container, MatrixNrLookup
    7073        );
     74
     75    // fill levelresults
    7176    const size_t MaxLevel = subsetmap->getMaximumSetLevel();
    7277    for (size_t level=1; level <= MaxLevel; ++level) {
    73       MapType &LevelResults = results[level-1];
    74       // sum up and store in results
     78      MapType &LevelResults = levelresults[level-1];
     79      // sum up and store in levelresults
    7580      const MapValue value = sum_value(level);
    7681      boost::fusion::at_key<MapKey>(LevelResults) = value;
    7782      // print value
    7883      //LOG(0, "STATUS: Level " << level << " resulting " << printKeyNames::printName<MapKey>() << " is " << value << ".");
     84    }
     85
     86    // fill keysetresults
     87    for (IndexSetContainer::Container_t::const_iterator indexsetiter = container.begin();
     88        indexsetiter != container.end(); ++indexsetiter) {
     89      const IndexSet::ptr &index = *indexsetiter;
     90      // this either generates a new entry or updates the present one, as we obtain ref to value
     91      boost::fusion::at_key<MapKey>(keysetresults[index]) =
     92          sum_value.getContributionForIndexSet(index);
    7993    }
    8094  }
     
    89103  //!> lookup map from job ids to ordering in above vectors
    90104  const std::map< JobId_t, size_t > &MatrixNrLookup;
    91   //!> vector of results
    92   std::vector<MapType> &results;
     105  //!> vector of levelresults
     106  std::vector<MapType> &levelresults;
     107  typedef std::pair< IndexSet::ptr, MapType > keysetresults_pair_t;
     108  //!> typedef for map for keyset and each resulting value
     109  typedef std::map<IndexSet::ptr, MapType> keysetresults_t;
     110  //!> map for IndexSet and its associated contribution
     111  keysetresults_t &keysetresults;
    93112};
    94113
  • src/Fragmentation/Summation/OrthogonalSumUpPerLevel.hpp

    r69e065 rb8f0b25  
    2121#include "Fragmentation/Converter/DataConverter.hpp"
    2222#include "Fragmentation/Summation/AllLevelOrthogonalSummator.hpp"
     23#include "Fragmentation/Summation/IndexSet.hpp"
    2324#include "Fragmentation/Summation/IndexSetContainer.hpp"
    2425
     
    2829
    2930template <typename TypeMap, typename TypeData, typename TypeVector>
    30 std::vector<TypeMap> OrthogonalSumUpPerLevel(
     31void OrthogonalSumUpPerLevel(
    3132    const std::map<JobId_t, TypeData> &fragmentData,
    3233    const std::map< JobId_t, size_t > &MatrixNrLookup,
    3334    const IndexSetContainer::ptr &container,
    34     SubsetMap::ptr &subsetmap
     35    SubsetMap::ptr &subsetmap,
     36    std::vector<TypeMap> &levelresults,
     37    std::map<IndexSet::ptr, TypeMap> &keysetresults
    3538    )
    3639{
     
    3942  convertDataTo<TypeData, TypeMap>(fragmentData, Data_fused);
    4043  // instantiate summator
    41   std::vector<TypeMap> Result_fused(subsetmap->getMaximumSetLevel());
     44  levelresults.resize(subsetmap->getMaximumSetLevel());
    4245  AllLevelOrthogonalSummator<TypeMap> Summer(
    4346              subsetmap,
     
    4548              container->getContainer(),
    4649              MatrixNrLookup,
    47               Result_fused);
     50              levelresults,
     51              keysetresults);
    4852  // sum up for each type key in TypeVector
    4953  boost::mpl::for_each<TypeVector>(boost::ref(Summer));
    50   return Result_fused;
    5154}
    5255
  • src/Fragmentation/Summation/SumUpPerLevel.hpp

    r69e065 rb8f0b25  
    2020#include "Fragmentation/Converter/DataConverter.hpp"
    2121#include "Fragmentation/Summation/AllLevelSummator.hpp"
     22#include "Fragmentation/Summation/IndexSet.hpp"
    2223#include "Fragmentation/Summation/IndexSetContainer.hpp"
    2324
     
    2728
    2829template <typename TypeMap, typename TypeData, typename TypeVector>
    29 std::vector<TypeMap> SumUpPerLevel(
     30void SumUpPerLevel(
    3031    const std::map<JobId_t, TypeData> &fragmentData,
    3132    const std::map< JobId_t, size_t > &MatrixNrLookup,
    3233    const IndexSetContainer::ptr &container,
    33     SubsetMap::ptr &subsetmap
     34    SubsetMap::ptr &subsetmap,
     35    std::vector<TypeMap> &levelresults,
     36    std::map<IndexSet::ptr, TypeMap> &keysetresults
    3437    )
    3538{
     
    3841  convertDataTo<TypeData, TypeMap>(fragmentData, Data_fused);
    3942  // instantiate summator
    40   std::vector<TypeMap> Result_fused(subsetmap->getMaximumSetLevel());
     43  levelresults.resize(subsetmap->getMaximumSetLevel());
    4144  AllLevelSummator<TypeMap> Summer(
    4245              subsetmap,
     
    4447              container->getContainer(),
    4548              MatrixNrLookup,
    46               Result_fused);
     49              levelresults,
     50              keysetresults);
    4751  // sum up for each type key in TypeVector
    4852  boost::mpl::for_each<TypeVector>(boost::ref(Summer));
    49   return Result_fused;
    5053}
    5154
Note: See TracChangeset for help on using the changeset viewer.