source: src/FunctionApproximation/Extractors.hpp@ 6cfb355

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 v1.3.11
Last change on this file since 6cfb355 was 52e7da, checked in by Frederik Heber <heber@…>, 12 years ago

Angle training now also uses TrainingData.

  • Property mode set to 100644
File size: 4.7 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 positions from the same aligned vector of charges.
38 *
39 * Basically, we filter the positions indicated by the targets but
40 * from a different vector that has the same layout.
41 *
42 * \param positions positions to search
43 * \param charges charges to match with \targets
44 * \param targets iterators on charges
45 * \return filtered positions
46 */
47 Fragment::positions_t gatherPositionsFromCharges(
48 const Fragment::positions_t &positions,
49 const Fragment::charges_t &charges,
50 const chargeiters_t targets
51 );
52
53 /** Counts all same elements in the vector and places into map of elements.
54 *
55 * \param elements vector of elements
56 * \return count of same element in vector
57 */
58 elementcounts_t getElementCounts(
59 const Fragment::charges_t elements
60 );
61
62 /** Gather iterators to the elements related to the desired elementcounts.
63 *
64 * \param charges charges wherein to search for the elements
65 * \param elementcounts number of desired hits per element
66 * \return iterators equal to the initial vector of elements
67 */
68 elementtargets_t convertElementcountsToTargets(
69 const Fragment::charges_t &charges,
70 const elementcounts_t &elementcounts
71 );
72
73 /** Convert the alignment back to as it was in the original vector.
74 *
75 * We lost the information by storing it in a map. Hence, we need this
76 * final step.
77 *
78 * \param elementtargets targets as they are in the map \a elementcounts
79 * \param elements the original order of the elements
80 * \param elementcounts the count per element for debugging checks
81 * \return vector of targets in the order as they are in \a element
82 */
83 chargeiters_t realignElementtargets(
84 const elementtargets_t &elementtargets,
85 const Fragment::charges_t elements,
86 const elementcounts_t &elementcounts
87 );
88 }
89
90 /** Gather all distances from a given set of positions.
91 *
92 * \param positions vector of positions
93 * \param globalid index to associated in argument_t with
94 * \return vector of argument_ , each with a distance
95 */
96 FunctionModel::arguments_t
97 gatherAllDistanceArguments(
98 const Fragment::positions_t &positions,
99 const size_t globalid);
100
101 /** Gather all distances from a given set of positions.
102 *
103 * Here, we only return one of the two equal distances.
104 *
105 * \param positions vector of positions
106 * \param globalid index to associated in argument_t with
107 * \return vector of argument_ , each with a distance
108 */
109 FunctionModel::arguments_t
110 gatherAllSymmetricDistanceArguments(
111 const Fragment::positions_t &positions,
112 const size_t globalid);
113
114 /** Simple extractor of all unique pair distances of a given \a fragment.
115 *
116 * \param fragment fragment with all nuclei positions
117 * \param index index refers to the index within the global set of configurations
118 * \return vector of of argument_t containing all found distances
119 */
120 inline FunctionModel::arguments_t gatherAllDistances(
121 const Fragment& fragment,
122 const size_t index
123 ) {
124 // get distance out of Fragment
125 return gatherAllDistanceArguments(fragment.getPositions(), index);
126 }
127
128 /** Gather all positions associated to the matching \a elements.
129 *
130 * \param fragment fragment with all nuclei positions
131 * \param elements tuple of desired elements
132 * \return vector of positions_t containing
133 */
134 Fragment::positions_t gatherPositionOfTuples(
135 const Fragment& fragment,
136 const Fragment::charges_t elements
137 );
138
139 /** Reorder arguments by increasing distance.
140 *
141 * \param args arguments to reorder
142 * \return reordered args
143 */
144 FunctionModel::arguments_t reorderArgumentsByIncreasingDistance(
145 const FunctionModel::arguments_t &args
146 );
147
148}; /* namespace Extractors */
149
150
151#endif /* TRAININGDATA_EXTRACTORS_HPP_ */
Note: See TracBrowser for help on using the repository browser.