Changeset 58952a for src/Fragmentation/Summation
- Timestamp:
- Oct 17, 2013, 7:24:06 AM (11 years ago)
- 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:
- 675cd6
- Parents:
- 955051
- git-author:
- Frederik Heber <heber@…> (09/27/13 11:26:56)
- git-committer:
- Frederik Heber <heber@…> (10/17/13 07:24:06)
- Location:
- src/Fragmentation/Summation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Summation/SetValue.hpp
r955051 r58952a 20 20 #include "IndexSet.hpp" 21 21 #include "IndexSetContainer.hpp" 22 #include "ZeroInstance.hpp" 22 23 23 24 #include "CodePatterns/Cacheable.hpp" … … 106 107 /** Calculates the contribution for this subset. 107 108 * 108 * Internal function that is bound to the cacheable 109 * We calculate by value minus the summed contributions(!) from all subsets 110 * of this subset. If the value is ZeroInstance<T> however, we set its 111 * contribution to zero, as it is designated thereby as not contributing. 109 112 * 110 * @return 113 * \note This is internal function that is bound to the Cacheable contribution. 114 * 115 * @return value minus the summed contribution's from all subsets 111 116 */ 112 117 const T calcSum() { … … 114 119 // we initialize with value 115 120 T result = getValue(); 116 // then subtract contributions from all subsets 117 const IndexSetContainer::ptr &container = lookupSubset(indices); 118 if (container) { 119 const IndexSetContainer::Container_t &subsets = container->getContainer(); 120 for (IndexSetContainer::Container_t::const_iterator iter = subsets.begin(); 121 iter != subsets.end(); ++iter) { 122 LOG(3, "DEBUG: Current subset is " << **iter << "."); 123 // NOTE: our subset is not contained in the number of subsets 124 typename SetValue<T>::ptr ptr = lookupValue(*iter); 125 if (ptr) 126 result -= ptr->getContribution(); 127 else 128 ELOG(1, "Cannot find " << **iter << " via lookup."); 121 // ZeroInstance<T>() is a specific value, if set, this subset does not contribute 122 if (result != ZeroInstance<T>()) { // compare directly, not numerically! 123 // then subtract contributions from all subsets 124 const IndexSetContainer::ptr &container = lookupSubset(indices); 125 if (container) { 126 const IndexSetContainer::Container_t &subsets = container->getContainer(); 127 for (IndexSetContainer::Container_t::const_iterator iter = subsets.begin(); 128 iter != subsets.end(); ++iter) { 129 LOG(3, "DEBUG: Current subset is " << **iter << "."); 130 // NOTE: our subset is not contained in the number of subsets 131 typename SetValue<T>::ptr ptr = lookupValue(*iter); 132 if (ptr) 133 result -= ptr->getContribution(); 134 else 135 ELOG(1, "Cannot find " << **iter << " via lookup."); 136 } 137 } else { 138 ELOG(1, "Cannot find subsets for " << *indices << " via lookup."); 129 139 } 130 } else { 131 ELOG(1, "Cannot find subsets for " << *indices << " via lookup."); 132 } 140 } // else we return ZeroInstance<T>() as contribution 133 141 return result; 134 142 } -
src/Fragmentation/Summation/ZeroInstance.hpp
r955051 r58952a 17 17 /** This functions returns an instance equal to zero. 18 18 * 19 * This serves two functions: One the one hand we need a zero value to intialize 20 * the (Orthogonal)Summation. On the other hand, ZeroInstance<T> also marks a 21 * special (Set)Value of a subset that should not contribute, i.e. whose 22 * contribution is set to zero. 23 * 19 24 * @return instance initialized to zero 20 25 */
Note:
See TracChangeset
for help on using the changeset viewer.