source: src/FunctionApproximation/Extractors.hpp@ 67044a

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 67044a was 67044a, checked in by Frederik Heber <heber@…>, 9 years ago

Extractors require additional binding model which EmpiricalPotentials supply in getSpecificFilter().

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