source: src/FunctionApproximation/Extractors.hpp@ 228340

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator 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_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 228340 was 228340, checked in by Frederik Heber <heber@…>, 8 years ago

Extractors::gatherAllSymmetricDistances..() additionaly gets edge set to set bonded flag.

  • Property mode set to 100644
File size: 5.8 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 <boost/function.hpp>
17
18#include "Fragmentation/EdgesPerFragment.hpp"
19#include "Fragmentation/Summation/SetValues/Fragment.hpp"
20#include "FunctionApproximation/FunctionModel.hpp"
21
22class Fragment;
23class HomologyGraph;
24
25/** Namespace containing all simple extractor functions.
26 *
27 * Extractor functions extract distances from a given fragment matching with
28 * a given set of particle types (i.e. elements, e.h. H2O).
29 * Filter functions extract a subset of distances from a given set of distances
30 * to be used with a specific model.
31 *
32 * To this end, each FunctionModel has both a filter and an extractor function.
33 *
34 * The functions in this namespace act as helpers or basic building blocks in
35 * constructing such filters and extractors.
36 *
37 */
38namespace Extractors {
39 typedef Fragment::charges_t::const_iterator chargeiter_t;
40 typedef std::vector<chargeiter_t> chargeiters_t;
41
42 typedef size_t count_t;
43 typedef Fragment::atomicNumber_t element_t;
44 typedef std::map< element_t, count_t> elementcounts_t;
45 typedef std::map< element_t, chargeiters_t > elementtargets_t;
46 typedef std::vector< chargeiters_t > targets_per_combination_t;
47 //!> typedef for particle designation
48 typedef unsigned int ParticleType_t;
49 //!> typedef for a vector of particle designations
50 typedef std::vector<ParticleType_t> ParticleTypes_t;
51
52 /** Namespace for some internal helper functions.
53 *
54 */
55 namespace _detail {
56
57 /** Counts all same elements in the vector and places into map of elements.
58 *
59 * \param elements vector of elements
60 * \return count of same element in vector
61 */
62 elementcounts_t getElementCounts(
63 const Fragment::atomicnumbers_t elements
64 );
65
66 }
67
68 /** Gather all distances from a given set of positions.
69 *
70 * Here, we only return one of the two equal distances.
71 *
72 * \param positions all nuclei positions
73 * \param atomicNumber all nuclei atomic numbers
74 * \param edges edges of the fragment's bond graph
75 * \param globalid index to associated in argument_t with
76 * \return vector of argument_ , each with a distance
77 */
78 FunctionModel::arguments_t
79 gatherAllSymmetricDistanceArguments(
80 const Fragment::positions_t& positions,
81 const Fragment::atomicnumbers_t& atomicnumbers,
82 const FragmentationEdges::edges_t &edges,
83 const size_t globalid);
84
85 /** Simple extractor of all unique pair distances of a given \a fragment, where
86 * the first index is less than the second one.
87 *
88 * \param positions all nuclei positions
89 * \param atomicNumber all nuclei atomic numbers
90 * \param edges edges of the fragment's bond graph
91 * \param index index refers to the index within the global set of configurations
92 * \return vector of of argument_t containing all found distances
93 */
94 inline FunctionModel::arguments_t gatherAllSymmetricDistances(
95 const Fragment::positions_t& positions,
96 const Fragment::atomicnumbers_t& atomicnumbers,
97 const FragmentationEdges::edges_t &edges,
98 const size_t index
99 ) {
100 // get distance out of Fragment
101 return gatherAllSymmetricDistanceArguments(positions, atomicnumbers, edges, index);
102 }
103
104 /** Reorder the arguments to bring adjacent ones together.
105 *
106 * After filtering via particle types arguments related via same indices
107 * must not necessarily be contained in the same bunch. This reordering
108 * is done here, preserving the alignment given in
109 * \sa filterArgumentsByParticleTypes()
110 *
111 * \param listargs list of arguments to reorder each
112 * \param _graph contains binding model of graph
113 * \param _types particle type vector
114 * \return reordered args
115 */
116 FunctionModel::list_of_arguments_t reorderArgumentsByParticleTypes(
117 const FunctionModel::list_of_arguments_t &eachargs,
118 const HomologyGraph &_graph,
119 const ParticleTypes_t &_types,
120 const HomologyGraph &_bindingmodel
121 );
122
123 /** Filter arguments according to types, allowing multiples.
124 *
125 * If particle types is (0,1,2) and three arguments, each with a pair of types,
126 * are given, then the alignment will be: (0,1), (0,2), and (1,2).
127 *
128 * \param args arguments to reorder
129 * \param _graph contains binding model of graph
130 * \param _types particle type vector
131 * \return filtered list of args
132 */
133 FunctionModel::list_of_arguments_t filterArgumentsByParticleTypes(
134 const FunctionModel::arguments_t &args,
135 const HomologyGraph &_graph,
136 const ParticleTypes_t &_types,
137 const HomologyGraph &_bindingmodel
138 );
139
140 /** Combines two argument lists by sorting and making unique.
141 *
142 * @param firstargs first list of arguments
143 * @param secondargs second list of arguments
144 * @return concatenated lists
145 */
146 FunctionModel::arguments_t combineArguments(
147 const FunctionModel::arguments_t &firstargs,
148 const FunctionModel::arguments_t &secondargs);
149
150 /** Combines two argument lists by concatenation.
151 *
152 * @param firstargs first list of arguments
153 * @param secondargs second list of arguments
154 * @return concatenated lists
155 */
156 FunctionModel::arguments_t concatenateArguments(
157 const FunctionModel::arguments_t &firstargs,
158 const FunctionModel::arguments_t &secondargs);
159
160 /** Combines two argument lists by concatenation.
161 *
162 * @param firstlistargs first list of argument tuples
163 * @param secondlistargs second list of argument tuples
164 * @return concatenated lists
165 */
166 FunctionModel::list_of_arguments_t concatenateListOfArguments(
167 const FunctionModel::list_of_arguments_t &firstlistargs,
168 const FunctionModel::list_of_arguments_t &secondlistargs);
169
170}; /* namespace Extractors */
171
172
173#endif /* TRAININGDATA_EXTRACTORS_HPP_ */
Note: See TracBrowser for help on using the repository browser.