Changeset 6ca578 for src/Actions


Ignore:
Timestamp:
Nov 8, 2012, 1:13:19 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:
40698b
Parents:
188639
git-author:
Frederik Heber <heber@…> (07/26/12 11:29:18)
git-committer:
Frederik Heber <heber@…> (11/08/12 13:13:19)
Message:

Simple use of OrthogonalSummation in FragmentationAutomationAction.

  • so far, we just make use of the already parsed in keysets, translate it to IndexSets and sum up the energy.total found in MPQCData.
  • note that internal MPQCJob just creates empty MPQCData regardless of the actual job.
  • TESTFIX: regression tests tests/JobMarket/molecuilderrun does not check for the resulting energy and forces as we only get empty results.
  • libMolecuilderUI now requires libMolecuilderFragmentationSummation.
File:
1 edited

Legend:

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

    r188639 r6ca578  
    3939#include "CodePatterns/MemDebug.hpp"
    4040
     41#include <boost/assign.hpp>
     42
     43#include "CodePatterns/Assert.hpp"
    4144#include "CodePatterns/Info.hpp"
    4245#include "CodePatterns/Log.hpp"
     
    4952#include "Fragmentation/Fragmentation.hpp"
    5053#include "Fragmentation/HydrogenSaturation_enum.hpp"
     54#include "Fragmentation/KeySet.hpp"
    5155#include "Fragmentation/KeySetsContainer.hpp"
     56#include "Fragmentation/Summation/OrthogonalSummation.hpp"
     57#include "Fragmentation/Summation/SetValue.hpp"
    5258#include "Graph/DepthFirstSearchAnalysis.hpp"
    5359#include "Jobs/MPQCJob.hpp"
     
    6369
    6470using namespace MoleCuilder;
     71
     72using namespace boost::assign;
    6573
    6674// and construct the stuff
     
    146154  ForceMatrix Force;
    147155  ForceMatrix ForceFragments;
    148   KeySetsContainer KeySet;
    149156
    150157  // align fragments
     
    235242    return false;
    236243
     244  // initialise indices
     245  KeySetsContainer KeySet;
     246  if (!Energy.InitialiseIndices()) return false;
     247
     248  if (!Force.ParseIndices(KeySetFilename.c_str())) return false;
     249
     250  if (!KeySet.ParseKeySets(KeySetFilename.c_str(), Force.RowCounter, Force.MatrixCounter)) return false;
     251
     252  /// prepare for OrthogonalSummation
     253
     254  // gather all present indices in AllIndices
     255  IndexSet::ptr AllIndices(new IndexSet);
     256  for (KeySetsContainer::ArrayOfIntVectors::const_iterator iter = KeySet.KeySets.begin();
     257      iter != KeySet.KeySets.end(); ++iter)
     258    for(KeySetsContainer::IntVector::const_iterator keyiter = (*iter).begin();
     259        keyiter != (*iter).end(); ++keyiter) {
     260      if (*keyiter != -1)
     261        (*AllIndices) += *keyiter;
     262    }
     263  LOG(1, "INFO: AllIndices is " << AllIndices << ".");
     264  // create container with all keysets
     265  IndexSetContainer::ptr container(new IndexSetContainer(AllIndices));
     266  for (KeySetsContainer::ArrayOfIntVectors::const_iterator iter = KeySet.KeySets.begin();
     267      iter != KeySet.KeySets.end(); ++iter) {
     268    IndexSet tempset;
     269    for(KeySetsContainer::IntVector::const_iterator keyiter = (*iter).begin();
     270        keyiter != (*iter).end(); ++keyiter)
     271      if (*keyiter != -1)
     272        tempset += *keyiter;
     273    container->insert(tempset);
     274  }
     275  // create the map of all keysets
     276  SubsetMap::ptr subsetmap(new SubsetMap(*container));
     277
     278  // associate each index set with its value
     279  {
     280    const IndexSetContainer::Container_t &_container = container->getContainer();
     281    OrthogonalSummation<double>::InputSets_t indices(_container.begin(), _container.end());
     282    OrthogonalSummation<double>::InputValues_t values(_container.size(), 0.);
     283    std::vector<MPQCData>::const_iterator dataiter = fragmentData.begin();
     284    std::vector<FragmentResult::ptr>::const_iterator resultiter = results.begin();
     285    for (; dataiter != fragmentData.end(); ++dataiter, ++resultiter) {
     286      const MPQCData &extractedData = *dataiter;
     287      values[ MatrixNrLookup[(*resultiter)->getId()] ] = extractedData.energies.total;
     288    }
     289
     290    // create the summation functor and evaluate
     291    OrthogonalSummation<double> OS(indices, values, subsetmap);
     292    const double energyresult = OS();
     293    LOG(0, "STATUS: Resulting energy is " << energyresult << ".");
     294  }
    237295
    238296  // combine all found data
    239   if (!Energy.InitialiseIndices()) return false;
    240 
    241   if (!Force.ParseIndices(KeySetFilename.c_str())) return false;
    242 
    243   if (!KeySet.ParseKeySets(KeySetFilename.c_str(), Force.RowCounter, Force.MatrixCounter)) return false;
    244 
    245297  if (!KeySet.ParseManyBodyTerms()) return false;
    246298
Note: See TracChangeset for help on using the changeset viewer.