source: src/FunctionApproximation/Extractors.hpp@ 9c793c

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 Candidate_v1.7.0 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 9c793c was 9c793c, checked in by Frederik Heber <heber@…>, 9 years ago

All ..Potentials now return BindingModel instead of HomologyGraph, Extractors::reorderArg..() uses it.

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