Ignore:
Timestamp:
Nov 21, 2012, 10:00:17 AM (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:
849cd8
Parents:
635645
git-author:
Frederik Heber <heber@…> (08/08/12 12:35:31)
git-committer:
Frederik Heber <heber@…> (11/21/12 10:00:17)
Message:

Added template function SumUpPerLevel() that does now all the summation on one function.

File:
1 edited

Legend:

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

    r635645 r94d530f  
    396396}
    397397
     398template <typename TypeMap, typename TypeVector>
     399std::vector<TypeMap> SumUpPerLevel(
     400    const std::vector<MPQCData> &fragmentData,
     401    const std::vector<JobId_t> &jobids,
     402    std::map< JobId_t, size_t > &MatrixNrLookup,
     403    const IndexSetContainer::ptr &container,
     404    SubsetMap::ptr &subsetmap
     405    )
     406{
     407  // place data into boost::fusion::map instance
     408  std::vector<TypeMap> MPQCData_fused;
     409  convertMPQCDataTo<TypeMap>(fragmentData, MPQCData_fused);
     410  // instantiate summator
     411  std::vector<TypeMap> Result_fused(subsetmap->getMaximumSubsetLevel());
     412  AllLevelOrthogonalSummator<TypeMap> Summer(
     413              subsetmap,
     414              MPQCData_fused,
     415              jobids,
     416              container->getContainer(),
     417              MatrixNrLookup,
     418              Result_fused);
     419  // sum up for each type key in TypeVector
     420  boost::mpl::for_each<TypeVector>(boost::ref(Summer));
     421  return Result_fused;
     422}
     423
    398424/** Print MPQCData from received results.
    399425 *
     
    459485        "FragmentationAutomationAction::performCall() - ForceKeySet's KeySets and fragmentData differ in size.");
    460486
    461     std::vector<MPQCDataEnergyMap_t> MPQCData_Energy_fused;
    462     convertMPQCDataTo<MPQCDataEnergyMap_t>(fragmentData, MPQCData_Energy_fused);
     487    std::vector<MPQCDataEnergyMap_t> Result_Energy_fused(
     488        SumUpPerLevel<MPQCDataEnergyMap_t, MPQCDataEnergyVector_t>(
     489            fragmentData, jobids, MatrixNrLookup, container, subsetmap));
     490    std::vector<MPQCDataGridMap_t> Result_Grid_fused(
     491      SumUpPerLevel<MPQCDataGridMap_t, MPQCDataGridVector_t>(
     492          fragmentData, jobids, MatrixNrLookup, container, subsetmap));
     493    std::vector<MPQCDataTimeMap_t> Result_Time_fused(
     494      SumUpPerLevel<MPQCDataTimeMap_t, MPQCDataTimeVector_t>(
     495          fragmentData, jobids, MatrixNrLookup, container, subsetmap));
     496
     497    // force has extra converter
    463498    std::vector<MPQCDataForceMap_t> MPQCData_Force_fused;
    464499    convertMPQCDatatoForceMap(fragmentData, ForceKeySet, MPQCData_Force_fused);
    465     std::vector<MPQCDataGridMap_t> MPQCData_Grid_fused;
    466     convertMPQCDataTo<MPQCDataGridMap_t>(fragmentData, MPQCData_Grid_fused);
    467     std::vector<MPQCDataTimeMap_t> MPQCData_Time_fused;
    468     convertMPQCDataTo<MPQCDataTimeMap_t>(fragmentData, MPQCData_Time_fused);
    469 
    470     // create summation instances
    471     std::vector<MPQCDataEnergyMap_t> Result_Energy_fused(subsetmap->getMaximumSubsetLevel());
    472     AllLevelOrthogonalSummator<MPQCDataEnergyMap_t> energySummer(
    473                 subsetmap,
    474                 MPQCData_Energy_fused,
    475                 jobids,
    476                 container->getContainer(),
    477                 MatrixNrLookup,
    478                 Result_Energy_fused);
    479500    std::vector<MPQCDataForceMap_t> Result_Force_fused(subsetmap->getMaximumSubsetLevel());
    480501    AllLevelOrthogonalSummator<MPQCDataForceMap_t> forceSummer(
     
    485506                MatrixNrLookup,
    486507                Result_Force_fused);
    487     std::vector<MPQCDataGridMap_t> Result_Grid_fused(subsetmap->getMaximumSubsetLevel());
    488     AllLevelOrthogonalSummator<MPQCDataGridMap_t> gridSummer(
    489                 subsetmap,
    490                 MPQCData_Grid_fused,
    491                 jobids,
    492                 container->getContainer(),
    493                 MatrixNrLookup,
    494                 Result_Grid_fused);
    495     std::vector<MPQCDataTimeMap_t> Result_Time_fused(subsetmap->getMaximumSubsetLevel());
    496     AllLevelSummator<MPQCDataTimeMap_t> timeSummer(
    497                 subsetmap,
    498                 MPQCData_Time_fused,
    499                 jobids,
    500                 container->getContainer(),
    501                 MatrixNrLookup,
    502                 Result_Time_fused);
    503 
    504     // sum up
    505     boost::mpl::for_each<MPQCDataEnergyVector_t>(boost::ref(energySummer));
    506508    boost::mpl::for_each<MPQCDataForceVector_t>(boost::ref(forceSummer));
    507     boost::mpl::for_each<MPQCDataGridVector_t>(boost::ref(gridSummer));
    508     boost::mpl::for_each<MPQCDataTimeVector_t>(boost::ref(timeSummer));
    509509
    510510    // print tables (without eigenvalues, they go extra)
Note: See TracChangeset for help on using the changeset viewer.