source: src/FunctionApproximation/Extractors.hpp@ c211f7

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 Candidate_v1.7.0 Candidate_v1.7.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
Last change on this file since c211f7 was c211f7, checked in by Frederik Heber <heber@…>, 13 years ago

Refactored convertElementcountsToTargets() out of gatherDistanceOfTuples().

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*
2 * Extractors.hpp
3 *
4 * Created on: 15.10.2012
5 * Author: heber
6 */
7
8#ifndef TRAININGDATA_EXTRACTORS_HPP_
9#define TRAININGDATA_EXTRACTORS_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include "Fragmentation/SetValues/Fragment.hpp"
17#include "FunctionApproximation/FunctionModel.hpp"
18
19class Fragment;
20
21/** Namespace containing all simple extractor functions.
22 *
23 */
24namespace Extractors {
25 typedef Fragment::charges_t::const_iterator chargeiter_t;
26 typedef std::vector<chargeiter_t> chargeiters_t;
27
28 typedef size_t count_t;
29 typedef Fragment::charge_t element_t;
30 typedef std::map< element_t, count_t> elementcounts_t;
31 typedef std::map< element_t, chargeiters_t > elementtargets_t;
32
33 /** Namespace for some internal helper functions.
34 *
35 */
36 namespace _detail {
37 /** Gather all distances from a given set of positions.
38 *
39 * \param positins vector of positions
40 * \param globalid index to associated in argument_t with
41 * \return vector of argument_ , each with a distance
42 */
43 FunctionModel::arguments_t
44 gatherAllDistanceArguments(
45 const Fragment::positions_t &positions,
46 const size_t globalid);
47
48 /** Gather all positions from the same aligned vector of charges.
49 *
50 * Basically, we filter the positions indicated by the targets but
51 * from a different vector that has the same layout.
52 *
53 * \param positions positions to search
54 * \param charges charges to match with \targets
55 * \param targets iterators on charges
56 * \return filtered positions
57 */
58 Fragment::positions_t gatherPositionsFromCharges(
59 const Fragment::positions_t &positions,
60 const Fragment::charges_t &charges,
61 const chargeiters_t targets
62 );
63
64 /** Counts all same elements in the vector and places into map of elements.
65 *
66 * \param elements vector of elements
67 * \return count of same element in vector
68 */
69 elementcounts_t getElementCounts(
70 const Fragment::charges_t elements
71 );
72
73 /** Gather iterators to the elements related to the desired elementcounts.
74 *
75 * \param charges charges wherein to search for the elements
76 * \param elementcounts number of desired hits per element
77 * \return iterators equal to the initial vector of elements
78 */
79 elementtargets_t convertElementcountsToTargets(
80 const Fragment::charges_t &charges,
81 const elementcounts_t &elementcounts
82 );
83 }
84
85 /** Simple extractor of all unique pair distances of a given \a fragment.
86 *
87 * \param fragment fragment with all nuclei positions
88 * \param index index refers to the index within the global set of configurations
89 * \return vector of of argument_t containing all found distances
90 */
91 inline FunctionModel::arguments_t gatherAllDistances(
92 const Fragment& fragment,
93 const size_t index
94 ) {
95 // get distance out of Fragment
96 return _detail::gatherAllDistanceArguments(fragment.getPositions(), index);
97 }
98
99 /** Gather all positions associated to the matching \a elements.
100 *
101 * \param fragment fragment with all nuclei positions
102 * \param elements tuple of desired elements
103 * \return vector of positions_t containing
104 */
105 Fragment::positions_t gatherDistanceOfTuples(
106 const Fragment& fragment,
107 const Fragment::charges_t elements
108 );
109
110 /** Reorder arguments by increasing distance.
111 *
112 * \param args arguments to reorder
113 * \return reordered args
114 */
115 FunctionModel::arguments_t reorderArgumentsByIncreasingDistance(
116 const FunctionModel::arguments_t &args
117 );
118
119}; /* namespace Extractors */
120
121
122#endif /* TRAININGDATA_EXTRACTORS_HPP_ */
Note: See TracBrowser for help on using the repository browser.