Ignore:
Timestamp:
Oct 2, 2016, 1:59:41 PM (9 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Fix_FitPotential_needs_atomicnumbers
Children:
6ffdf2
Parents:
8d5db8
git-author:
Frederik Heber <heber@…> (10/02/16 13:59:35)
git-committer:
Frederik Heber <heber@…> (10/02/16 13:59:41)
Message:

REFACTOR: Removed many unused functions from Extractor namespace.

  • TESTFIX: Extractor unit test now only checks on getAllSymmetricDistances().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/FunctionApproximation/Extractors.hpp

    r8d5db8 ra13e21  
    5252   */
    5353  namespace _detail {
    54     /** Gather all distance arguments from the same aligned vector of charges.
    55      *
    56      * Basically, we filter the positions indicated by the targets but
    57      * from a different vector that has the same layout.
    58      *
    59      * \param positions all nuclei positions
    60      * \param charges all nuclei charges
    61      * \param targets iterators on charges
    62      * \return filtered distance arguments
    63      */
    64     FunctionModel::arguments_t gatherDistancesFromTargets(
    65         const Fragment::positions_t& positions,
    66         const Fragment::charges_t& charges,
    67         const chargeiters_t &targets,
    68         const size_t globalid
    69         );
    70 
    71     /** Gather all positions from the same aligned vector of charges.
    72      *
    73      * Basically, we filter the positions indicated by the targets but
    74      * from a different vector that has the same layout.
    75      *
    76      * \param positions all nuclei positions
    77      * \param charges all nuclei charges
    78      * \param targets iterators on charges
    79      * \return filtered positions
    80      */
    81     Fragment::positions_t gatherPositionsFromTargets(
    82         const Fragment::positions_t& positions,
    83         const Fragment::charges_t& charges,
    84         const chargeiters_t& targets
    85         );
    8654
    8755    /** Counts all same elements in the vector and places into map of elements.
     
    9462        );
    9563
    96     /** Gather iterators to the elements related to the desired elementcounts.
    97      *
    98      * \param charges charges wherein to search for the elements
    99      * \param elementcounts number of desired hits per element
    100      * \return iterators equal to the initial vector of elements
    101      */
    102     elementtargets_t convertElementcountsToTargets(
    103         const Fragment::charges_t &charges,
    104         const elementcounts_t &elementcounts
    105         );
    106 
    107     /** Convert the alignment back to as it was in the original vector.
    108      *
    109      * We lost the information by storing it in a map. Hence, we need this
    110      * final step.
    111      *
    112      * \param elementtargets targets as they are in the map \a elementcounts
    113      * \param elements the original order of the elements
    114      * \param elementcounts the count per element for debugging checks
    115      * \return vector of targets in the order as they are in \a element
    116      */
    117     chargeiters_t realignElementtargets(
    118         const elementtargets_t &elementtargets,
    119         const Fragment::charges_t elements,
    120         const elementcounts_t &elementcounts
    121         );
    122 
    123     /** Searches for desired elements in charges in a unique manner.
    124      *
    125      * The idea is to have e.g. a fragment with charges 8,1,1,2 and
    126      * elements as 1,8,1 (e.g. for an angle HOH) and we get the
    127      * chargeiters in the desired manner on indices: 1,0,3.
    128      *
    129      * \param charges charges to look through
    130      * \param elements vector of elements to find
    131      */
    132     chargeiters_t
    133     gatherTargetsFromFragment(
    134         const Fragment::charges_t& charges,
    135         const Fragment::charges_t elements
    136         );
    137 
    138     /** Brings all charges together in a map.
    139      *
    140      * @param charges charges as possible keys and their iterators as values in the map
    141      * @param elements list of charges to pick as keys
    142      * @return map of key and a vector of charge iterators
    143      */
    144     elementtargets_t convertChargesToTargetMap(
    145         const Fragment::charges_t& charges,
    146         Fragment::charges_t elements
    147         );
    148 
    149     /** Brings combinatorially together desired list of \a charges and \a targets.
    150      *
    151      * @param charges list of desired charges
    152      * @param elementtargets map of available targets per element
    153      * @return vector of chargeiters with all unique combinations
    154      */
    155     targets_per_combination_t
    156     CombineChargesAndTargets(
    157         const Fragment::charges_t& charges,
    158         const elementtargets_t& elementtargets
    159         );
    160 
    161     /** Recursive function to pick the next target.
    162      *
    163      * This is used by \sa CombineChargesAndTargets()
    164      *
    165      * @param charges set of charges, reduced by one per recursion
    166      * @param elementtargets targets, map of targets to pick from
    167      * @param currenttargets current set of targets, "global" through recursion
    168      * @param addFunction bound function to add a set when complete
    169      */
    170     void pickLastElementAsTarget(
    171         Fragment::charges_t elements,
    172         elementtargets_t elementtargets,
    173         chargeiters_t& currenttargets,
    174         boost::function<void (const chargeiters_t &currenttargets)> &addFunction
    175         );
    176 
    177     /** Converts a list of chargeiters to a list of respective arguments.
    178      *
    179      * @param positions positions from fragment
    180      * @param charges charges associated to each element in \a positions
    181      * @param combinations vector of chargeiters
    182      * \param globalid refers to the index within the global set of configurations
    183      * @return list of arguments
    184      */
    185     FunctionModel::arguments_t
    186     convertTargetsToArguments(
    187         const Fragment::positions_t& positions,
    188         const Fragment::charges_t& charges,
    189         const targets_per_combination_t combinations,
    190         const size_t globalid
    191         );
    19264  }
    193 
    194   /** Gather all distances from a given set of positions.
    195    *
    196    * \param positions all nuclei positions
    197    * \param charges all nuclei charges
    198    * \param globalid index to associated in argument_t with
    199    * \return vector of argument_ , each with a distance
    200    */
    201   FunctionModel::arguments_t
    202   gatherAllDistanceArguments(
    203       const Fragment::positions_t& positions,
    204       const Fragment::charges_t& charges,
    205       const size_t globalid);
    20665
    20766  /** Gather all distances from a given set of positions.
     
    21978      const Fragment::charges_t& charges,
    22079      const size_t globalid);
    221 
    222   /** Simple extractor of all unique pair distances of a given \a fragment.
    223    *
    224    * \param positions all nuclei positions
    225    * \param charges all nuclei charges
    226    * \param index index refers to the index within the global set of configurations
    227    * \return vector of of argument_t containing all found distances
    228    */
    229   inline FunctionModel::arguments_t gatherAllDistances(
    230       const Fragment::positions_t& positions,
    231       const Fragment::charges_t& charges,
    232       const size_t index
    233       ) {
    234     // get distance out of Fragment
    235     return gatherAllDistanceArguments(positions, charges, index);
    236   }
    23780
    23881  /** Simple extractor of all unique pair distances of a given \a fragment, where
     
    25295    return gatherAllSymmetricDistanceArguments(positions, charges, index);
    25396  }
    254 
    255   /** Filters only those positions out of given \a fragment that match \a elements.
    256    *
    257    * \param positions all nuclei positions
    258    * \param charges all nuclei charges
    259    * \param elements tuple of desired elements
    260    * \return vector of positions_t containing
    261    */
    262   Fragment::positions_t gatherPositionsFromFragment(
    263       const Fragment::positions_t positions,
    264       const Fragment::charges_t charges,
    265       const Fragment::charges_t& elements
    266       );
    267 
    268   /** Filters only those distances out of given \a fragment that match \a elements.
    269    *
    270    * \param positions all nuclei positions
    271    * \param charges all nuclei charges
    272    * \param elements tuple of desired elements
    273    * \param globalid refers to the index within the global set of configurations
    274    * \return vector of arguments_t containing those matched with elements
    275    */
    276   FunctionModel::arguments_t gatherDistancesFromFragment(
    277       const Fragment::positions_t positions,
    278       const Fragment::charges_t charges,
    279       const Fragment::charges_t& elements,
    280       const size_t globalid
    281       );
    282 
    283   /** Gather all combinations of charges as distance arguments from the fragment.
    284    *
    285    * E.g. we have a water fragment, i.e. (8,1,1) and we we want elements (8,1),
    286    * then two arguments are returned, first to second and first to third.
    287    *
    288    * With \sa gatherDistancesFromFragment() only the first distance would be
    289    * returned.
    290    *
    291    * @param positions positions in fragment
    292    * @param charges charges in fragment
    293    * @param elements list of desired elements
    294    * @param globalid some global id to discern training data tuples
    295    * @return list of arguments with distances
    296    */
    297   FunctionModel::arguments_t gatherAllDistancesFromFragment(
    298       const Fragment::positions_t& positions,
    299       const Fragment::charges_t& charges,
    300       const Fragment::charges_t elements,
    301       const size_t globalid
    302       );
    303 
    304   /** Reorder arguments by increasing distance.
    305    *
    306    * \param listargs list of arguments to reorder each
    307    * \return reordered args
    308    */
    309   FunctionModel::list_of_arguments_t reorderArgumentsByIncreasingDistance(
    310       const FunctionModel::list_of_arguments_t &listargs
    311       );
    31297
    31398  /** Reorder the arguments to bring adjacent ones together.
Note: See TracChangeset for help on using the changeset viewer.